Instructions to use np-n/meditron-7b_Q4_K_M.gguf with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- llama-cpp-python
How to use np-n/meditron-7b_Q4_K_M.gguf with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="np-n/meditron-7b_Q4_K_M.gguf", filename="meditron-7b_Q4_K_M.gguf", )
output = llm( "Once upon a time,", max_tokens=512, echo=True ) print(output)
- Notebooks
- Google Colab
- Kaggle
- Local Apps
- llama.cpp
How to use np-n/meditron-7b_Q4_K_M.gguf with llama.cpp:
Install from brew
brew install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf np-n/meditron-7b_Q4_K_M.gguf:Q4_K_M # Run inference directly in the terminal: llama-cli -hf np-n/meditron-7b_Q4_K_M.gguf:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf np-n/meditron-7b_Q4_K_M.gguf:Q4_K_M # Run inference directly in the terminal: llama-cli -hf np-n/meditron-7b_Q4_K_M.gguf:Q4_K_M
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf np-n/meditron-7b_Q4_K_M.gguf:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf np-n/meditron-7b_Q4_K_M.gguf:Q4_K_M
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf np-n/meditron-7b_Q4_K_M.gguf:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf np-n/meditron-7b_Q4_K_M.gguf:Q4_K_M
Use Docker
docker model run hf.co/np-n/meditron-7b_Q4_K_M.gguf:Q4_K_M
- LM Studio
- Jan
- Ollama
How to use np-n/meditron-7b_Q4_K_M.gguf with Ollama:
ollama run hf.co/np-n/meditron-7b_Q4_K_M.gguf:Q4_K_M
- Unsloth Studio
How to use np-n/meditron-7b_Q4_K_M.gguf with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for np-n/meditron-7b_Q4_K_M.gguf to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for np-n/meditron-7b_Q4_K_M.gguf to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for np-n/meditron-7b_Q4_K_M.gguf to start chatting
- Docker Model Runner
How to use np-n/meditron-7b_Q4_K_M.gguf with Docker Model Runner:
docker model run hf.co/np-n/meditron-7b_Q4_K_M.gguf:Q4_K_M
- Lemonade
How to use np-n/meditron-7b_Q4_K_M.gguf with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull np-n/meditron-7b_Q4_K_M.gguf:Q4_K_M
Run and chat with the model
lemonade run user.meditron-7b_Q4_K_M.gguf-Q4_K_M
List all available models
lemonade list
This model the 4-bit quantized version of the Meditron-7b.Please follow the following instruction to run the model on your device:
There are multiple ways to infer the model. Firstly, let's install llama.cpp and use it for the inference
- Install
git clone https://github.com/ggerganov/llama.cpp
!mkdir llama.cpp/build && cd llama.cpp/build && cmake .. && cmake --build . --config Release
- Inference
./llama.cpp/build/bin/llama-cli -m ./meditron-7b_Q4_K_M.gguf -cnv -p "You are a helpful assistant"
Here, you can interact with model from your terminal.
Alternatively, we can use python binding of the llama.cpp to run the model on both CPU and GPU.
- Install
pip install --no-cache-dir llama-cpp-python==0.2.85 --extra-index-url https://abetlen.github.io/llama-cpp-python/whl/cu122
- Inference on CPU
from llama_cpp import Llama
model_path = "./meditron-7b_Q4_K_M.gguf"
llm = Llama(model_path=model_path, n_threads=8, verbose=False)
prompt = "What should I do when my eyes are dry?"
output = llm(
prompt=f"<|user|>\n{prompt}<|end|>\n<|assistant|>",
max_tokens=4096,
stop=["<|end|>"],
echo=False, # Whether to echo the prompt
)
print(output)
- Inference on GPU
from llama_cpp import Llama
model_path = "./meditron-7b_Q4_K_M.gguf"
llm = Llama(model_path=model_path, n_threads=8, n_gpu_layers=-1, verbose=False)
prompt = "What should I do when my eyes are dry?"
output = llm(
prompt=f"<|user|>\n{prompt}<|end|>\n<|assistant|>",
max_tokens=4096,
stop=["<|end|>"],
echo=False, # Whether to echo the prompt
)
print(output)
- Downloads last month
- 3
Hardware compatibility
Log In to add your hardware
4-bit
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐ Ask for provider support