Instructions to use mlabonne/gemma-2b-GGUF with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use mlabonne/gemma-2b-GGUF with Transformers:
# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("mlabonne/gemma-2b-GGUF", dtype="auto") - llama-cpp-python
How to use mlabonne/gemma-2b-GGUF with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="mlabonne/gemma-2b-GGUF", filename="gemma-2b.Q2_K.gguf", )
output = llm( "Once upon a time,", max_tokens=512, echo=True ) print(output)
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use mlabonne/gemma-2b-GGUF with llama.cpp:
Install from brew
brew install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf mlabonne/gemma-2b-GGUF:Q4_K_M # Run inference directly in the terminal: llama-cli -hf mlabonne/gemma-2b-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 mlabonne/gemma-2b-GGUF:Q4_K_M # Run inference directly in the terminal: llama-cli -hf mlabonne/gemma-2b-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 mlabonne/gemma-2b-GGUF:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf mlabonne/gemma-2b-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 mlabonne/gemma-2b-GGUF:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf mlabonne/gemma-2b-GGUF:Q4_K_M
Use Docker
docker model run hf.co/mlabonne/gemma-2b-GGUF:Q4_K_M
- LM Studio
- Jan
- Ollama
How to use mlabonne/gemma-2b-GGUF with Ollama:
ollama run hf.co/mlabonne/gemma-2b-GGUF:Q4_K_M
- Unsloth Studio
How to use mlabonne/gemma-2b-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 mlabonne/gemma-2b-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 mlabonne/gemma-2b-GGUF to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for mlabonne/gemma-2b-GGUF to start chatting
- Docker Model Runner
How to use mlabonne/gemma-2b-GGUF with Docker Model Runner:
docker model run hf.co/mlabonne/gemma-2b-GGUF:Q4_K_M
- Lemonade
How to use mlabonne/gemma-2b-GGUF with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull mlabonne/gemma-2b-GGUF:Q4_K_M
Run and chat with the model
lemonade run user.gemma-2b-GGUF-Q4_K_M
List all available models
lemonade list
Unable to run the gemma-2b.Q4_K_M.gguf
hi, First Thank you very much. I was trying to run the gguf version from your quantized version but I encountered with following error. llama_model_load: error loading model: create_tensor: tensor 'output.weight' not found
llama_load_model_from_file: failed to load model
llama_init_from_gpt_params: error: failed to load model 'gemma-2b.Q4_K_M.gguf'
main: error: unable to load model
I think this "general.architecture str = llama " will be gemma instead of llama as in this PR for the gemma model in llama.cpp https://github.com/ggerganov/llama.cpp/pull/5631#issuecomment-1957223298 . Regards
Same issue.
Same issue: "llama.cpp error: 'create_tensor: tensor 'output.weight' not found'"
I am adding this edit at 9:47pm eastern
I also had this problem with other gemmas from other people. I am using LM Studio. I missed this myself but it clearly states:
"Google DeepMind's Gemma (2B, 7B) is supported in v0.2.15!"
When I'm in the app it says I have v0.2.14 and I have the most current version. No updates available. I am now trying to download a fresh installation of 0.2.15. and then retry.
this doesn't work for me either. I'm also getting that tensor error.
None of the GGUF quant models would work because of this issue https://github.com/ggerganov/llama.cpp/issues/5635
I am waiting for this PR to be merged to re-run the quant: https://github.com/ggerganov/llama.cpp/pull/5650
Yea, that was my understanding also , I found this one user's quant gguf model seems to be working in my local environment with very bad quality output though. Here is the link for that working quant version gguf. https://huggingface.co/rahuldshetty/gemma-7b-it-gguf-quantized
Yea, that was my understanding also , I found this one user's quant gguf model seems to be working in my local environment with very bad quality output though. Here is the link for that working quant version gguf. https://huggingface.co/rahuldshetty/gemma-7b-it-gguf-quantized
Yes, if we use the latest llama.cpp from the main branch it works. It is no longer failing with error, but the quality of the quants is terrible! I am really hoping that PR fixes the issue
I worked on it today and the quants can be executed with llama.cpp now. Will re-upload everything in a few hours, should be working now.