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", dtype="auto") - llama-cpp-python
How to use cmp-nct/llava-1.6-gguf with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="cmp-nct/llava-1.6-gguf", filename="ggml-mistral-7b-q_5_k.gguf", )
llm.create_chat_completion( 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" } } ] } ] ) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use cmp-nct/llava-1.6-gguf with llama.cpp:
Install from brew
brew install llama.cpp # 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
Install from WinGet (Windows)
winget install llama.cpp # 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
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
Do you have the llava-34b.gguf file?
Your folder have mmproj-llava-34b-f16-q6_k.gguf but not the main file llava-34b.gguf. Do you have it and could you upload it?
I'm just uploading a Q3_K quantized version of 34B but I don't have that a great upload rate, so getting the other 34B ones up might take a while.
You can use my PR (see the readme) together with the official llava-1.6 release model to convert the model yourself also.
- lava-surgery-v2.py (with -C flag)
- convert.py
- quantize the model as you'd quantize any llm
Thank you very much for your work!
Off-topic stupid question: The "-i, --interactive run in interactive mode" does not seem to work with the ./llava-cli. Are there other ways to chat with the model? Now it just ends the program and unloads the models after first question and answer.
Just making sure: Look at the number of tokens that were used.
If the prompt processing is below 1200 tokens you are not using the new code, but old code (with no quality on llava 1.6)
When using the correct code, with the correct mmproj file, you'll see 1200-3000 tokens used for the prompt
-i is not supported by llava-cli but the server app and the libraries of coure support it, I don't know about your wrapper library
Not sure if you mean these numbers: encode_image_with_clip: image embedding created: 2884 tokens, llama_print_timings: total time = 370632.47 ms / 1729 tokens
Oh, I thought it supported -i, because "./llava-cli --help" prints:
usage: ./llava-cli [options]
options:
-h, --help show this help message and exit
--version show version and build info
-i, --interactive run in interactive mode
Yes, looks great except for the slow processing speed.
If you have accelerating hardware (GPU) make sure to compile with offload support and offload the model.
Example on a 4090:encode_image_with_clip: 5 segments encoded in 159.16 ms Image was split into 5 features (llava 1.6 will always be 3-5)encode_image_with_clip: image embedding created: 2884 tokens the number of features generated in total
And finally:llama_print_timings: prompt eval time = 1179.70 ms / 2930 tokens ( 0.40 ms per token, 2483.67 tokens per second) 2930 tokens in total were evaluated for the prompt (2884 + text)
encode_image_with_clip: 5 segments encoded in 417.37 ms
My horrible "370632.47 ms / 1729 tokens" might be because I use WSL2 and I load the weights from different drive
Make sure you have full offloading enabled (in llama.cpp that would be true for all the models when using "-ngl 99"
When using WSL from a non-linux file system you need to manually disable mmap, when using a native filesystem it should be at least as fast as on native Windows.
Aside of the loading time, there should not be a performance hit, when using full offloading. Once the weights are loaded into the GPU VRAM (or RAM) the disk is not accessed anymore.