Instructions to use cmp-nct/llava-1.6-gguf with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use cmp-nct/llava-1.6-gguf with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="cmp-nct/llava-1.6-gguf") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("cmp-nct/llava-1.6-gguf", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use cmp-nct/llava-1.6-gguf with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf cmp-nct/llava-1.6-gguf:F16 # Run inference directly in the terminal: llama cli -hf cmp-nct/llava-1.6-gguf:F16
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf cmp-nct/llava-1.6-gguf:F16 # Run inference directly in the terminal: llama cli -hf cmp-nct/llava-1.6-gguf:F16
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 cmp-nct/llava-1.6-gguf:F16 # Run inference directly in the terminal: ./llama-cli -hf cmp-nct/llava-1.6-gguf:F16
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 cmp-nct/llava-1.6-gguf:F16 # Run inference directly in the terminal: ./build/bin/llama-cli -hf cmp-nct/llava-1.6-gguf:F16
Use Docker
docker model run hf.co/cmp-nct/llava-1.6-gguf:F16
- LM Studio
- Jan
- vLLM
How to use cmp-nct/llava-1.6-gguf with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "cmp-nct/llava-1.6-gguf" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "cmp-nct/llava-1.6-gguf", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker
docker model run hf.co/cmp-nct/llava-1.6-gguf:F16
- SGLang
How to use cmp-nct/llava-1.6-gguf with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "cmp-nct/llava-1.6-gguf" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "cmp-nct/llava-1.6-gguf", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "cmp-nct/llava-1.6-gguf" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "cmp-nct/llava-1.6-gguf", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }' - Ollama
How to use cmp-nct/llava-1.6-gguf with Ollama:
ollama run hf.co/cmp-nct/llava-1.6-gguf:F16
- Unsloth Studio
How to use cmp-nct/llava-1.6-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 cmp-nct/llava-1.6-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 cmp-nct/llava-1.6-gguf to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for cmp-nct/llava-1.6-gguf to start chatting
- Docker Model Runner
How to use cmp-nct/llava-1.6-gguf with Docker Model Runner:
docker model run hf.co/cmp-nct/llava-1.6-gguf:F16
- Lemonade
How to use cmp-nct/llava-1.6-gguf with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull cmp-nct/llava-1.6-gguf:F16
Run and chat with the model
lemonade run user.llava-1.6-gguf-F16
List all available models
lemonade list
- Atomic Chat
Not working (llama_cpp_python)
I run some example llama_cpp_python code and it's unable to load the model:
from llama_cpp import Llama
llm = Llama(model_path="/repos/llava-1.6-gguf", chat_format="chatml")
llm.create_chat_completion(
messages=[
{
"role": "system",
"content": "You are a helpful assistant that outputs in JSON.",
},
{"role": "user", "content": "Who won the world series in 2020"},
],
response_format={
"type": "json_object",
"schema": {
"type": "object",
"properties": {"team_name": {"type": "string"}},
"required": ["team_name"],
},
},
temperature=0.7,
)
Gets this error:
gguf_init_from_file: invalid magic characters '�'
llama_model_load: error loading model: llama_model_loader: failed to load model from /share/whirl/repos/llava-1.6-gguf
llama_load_model_from_file: failed to load model
{
"name": "AssertionError",
"message": "",
"stack": "---------------------------------------------------------------------------
AssertionError Traceback (most recent call last)
Cell In[2], line 3
1 from llama_cpp import Llama
----> 3 llm = Llama(model_path=\"/repos/llava-1.6-gguf\", chat_format=\"chatml\")
4 llm.create_chat_completion(
5 messages=[
6 {
(...)
20 temperature=0.7,
21 )
File /liquid-logic/.venv/lib/python3.10/site-packages/llama_cpp/llama.py:296, in Llama.__init__(self, model_path, n_gpu_layers, split_mode, main_gpu, tensor_split, vocab_only, use_mmap, use_mlock, kv_overrides, seed, n_ctx, n_batch, n_threads, n_threads_batch, rope_scaling_type, rope_freq_base, rope_freq_scale, yarn_ext_factor, yarn_attn_factor, yarn_beta_fast, yarn_beta_slow, yarn_orig_ctx, mul_mat_q, logits_all, embedding, offload_kqv, last_n_tokens_size, lora_base, lora_scale, lora_path, numa, chat_format, chat_handler, draft_model, verbose, **kwargs)
293 self.context_params.n_ctx = self._model.n_ctx_train()
294 self.context_params.n_batch = self.n_batch
--> 296 self._ctx = _LlamaContext(
297 model=self._model,
298 params=self.context_params,
299 verbose=self.verbose,
300 )
302 self._batch = _LlamaBatch(
303 n_tokens=self.n_batch,
304 embd=0,
305 n_seq_max=self.context_params.n_ctx,
306 verbose=self.verbose,
307 )
309 if self.lora_path:
File /liquid-logic/.venv/lib/python3.10/site-packages/llama_cpp/_internals.py:252, in _LlamaContext.__init__(self, model, params, verbose)
248 self.verbose = verbose
250 self._llama_free = llama_cpp._lib.llama_free # type: ignore
--> 252 assert self.model.model is not None
254 self.ctx = llama_cpp.llama_new_context_with_model(
255 self.model.model, self.params
256 )
AssertionError: "
}
You would need to apply https://github.com/ggerganov/llama.cpp/pull/5267 to the llama.cpp code, also you'd have to load it as llava and not as chat model and you can not load it by using my HF URL.
You'll need to download the correct gguf pair and load those.
I am not sure if the library you are using supports llava
It does, I realized I messed up the model path. Sorry for the dumb question.