Instructions to use QuantFactory/gemma-2-baku-2b-GGUF with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use QuantFactory/gemma-2-baku-2b-GGUF with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="QuantFactory/gemma-2-baku-2b-GGUF")# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("QuantFactory/gemma-2-baku-2b-GGUF", dtype="auto") - llama-cpp-python
How to use QuantFactory/gemma-2-baku-2b-GGUF with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="QuantFactory/gemma-2-baku-2b-GGUF", filename="gemma-2-baku-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 QuantFactory/gemma-2-baku-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 QuantFactory/gemma-2-baku-2b-GGUF:Q4_K_M # Run inference directly in the terminal: llama-cli -hf QuantFactory/gemma-2-baku-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 QuantFactory/gemma-2-baku-2b-GGUF:Q4_K_M # Run inference directly in the terminal: llama-cli -hf QuantFactory/gemma-2-baku-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 QuantFactory/gemma-2-baku-2b-GGUF:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf QuantFactory/gemma-2-baku-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 QuantFactory/gemma-2-baku-2b-GGUF:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf QuantFactory/gemma-2-baku-2b-GGUF:Q4_K_M
Use Docker
docker model run hf.co/QuantFactory/gemma-2-baku-2b-GGUF:Q4_K_M
- LM Studio
- Jan
- vLLM
How to use QuantFactory/gemma-2-baku-2b-GGUF with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "QuantFactory/gemma-2-baku-2b-GGUF" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "QuantFactory/gemma-2-baku-2b-GGUF", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/QuantFactory/gemma-2-baku-2b-GGUF:Q4_K_M
- SGLang
How to use QuantFactory/gemma-2-baku-2b-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 "QuantFactory/gemma-2-baku-2b-GGUF" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "QuantFactory/gemma-2-baku-2b-GGUF", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'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 "QuantFactory/gemma-2-baku-2b-GGUF" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "QuantFactory/gemma-2-baku-2b-GGUF", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Ollama
How to use QuantFactory/gemma-2-baku-2b-GGUF with Ollama:
ollama run hf.co/QuantFactory/gemma-2-baku-2b-GGUF:Q4_K_M
- Unsloth Studio
How to use QuantFactory/gemma-2-baku-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 QuantFactory/gemma-2-baku-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 QuantFactory/gemma-2-baku-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 QuantFactory/gemma-2-baku-2b-GGUF to start chatting
- Atomic Chat new
- Docker Model Runner
How to use QuantFactory/gemma-2-baku-2b-GGUF with Docker Model Runner:
docker model run hf.co/QuantFactory/gemma-2-baku-2b-GGUF:Q4_K_M
- Lemonade
How to use QuantFactory/gemma-2-baku-2b-GGUF with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull QuantFactory/gemma-2-baku-2b-GGUF:Q4_K_M
Run and chat with the model
lemonade run user.gemma-2-baku-2b-GGUF-Q4_K_M
List all available models
lemonade list
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 QuantFactory/gemma-2-baku-2b-GGUF to start chattingUsing HuggingFace Spaces for Unsloth
# No setup required# Open https://huggingface.co/spaces/unsloth/studio in your browser
# Search for QuantFactory/gemma-2-baku-2b-GGUF to start chattingQuantFactory/gemma-2-baku-2b-GGUF
This is quantized version of rinna/gemma-2-baku-2b created using llama.cpp
Original Model Card
Gemma 2 Baku 2B (rinna/gemma-2-baku-2b)
Overview
We conduct continual pre-training of google/gemma-2-2b on 80B tokens from a mixture of Japanese and English datasets. The continual pre-training improves the model's performance on Japanese tasks.
The name baku comes from the Japanese word 獏/ばく/Baku, which is a kind of Japanese mythical creature (妖怪/ようかい/Youkai).
| Size | Continual Pre-Training | Instruction-Tuning |
|---|---|---|
| 2B | Gemma 2 Baku 2B [HF] | Gemma 2 Baku 2B Instruct [HF] |
Library
The model was trained using code based on Lightning-AI/litgpt.
Model architecture
A 26-layer, 2304-hidden-size transformer-based language model. Please refer to the Gemma 2 Model Card for detailed information on the model's architecture.
Training
The model was initialized with the google/gemma-2-2b model and continually trained on around 80B tokens from a mixture of the following corpora
- Japanese CC-100
- Japanese C4
- Japanese OSCAR
- The Pile
- Wikipedia
- rinna curated Japanese dataset
Contributors
Benchmarking
Please refer to rinna's LM benchmark page.
How to use the model
import transformers
import torch
model_id = "rinna/gemma-2-baku-2b"
pipeline = transformers.pipeline(
"text-generation",
model=model_id,
model_kwargs={"torch_dtype": torch.bfloat16, "attn_implementation": "eager"},
device_map="auto"
)
output = pipeline(
"西田幾多郎は、",
max_new_tokens=256,
do_sample=True
)
print(output[0]["generated_text"])
It is recommended to use eager attention when conducting batch inference under bfloat16 precision. Currently, Gemma 2 yields NaN values for input sequences with padding when the default attention mechanism (torch.scaled_dot_product_attention) is employed in conjunction with bfloat16.
Tokenization
The model uses the original google/gemma-2-2b tokenizer.
How to cite
@misc{rinna-gemma-2-baku-2b,
title = {rinna/gemma-2-baku-2b},
author = {Wakatsuki, Toshiaki and Chen, Xinqi and Sawada, Kei},
url = {https://huggingface.co/rinna/gemma-2-baku-2b}
}
@inproceedings{sawada2024release,
title = {Release of Pre-Trained Models for the {J}apanese Language},
author = {Sawada, Kei and Zhao, Tianyu and Shing, Makoto and Mitsui, Kentaro and Kaga, Akio and Hono, Yukiya and Wakatsuki, Toshiaki and Mitsuda, Koh},
booktitle = {Proceedings of the 2024 Joint International Conference on Computational Linguistics, Language Resources and Evaluation (LREC-COLING 2024)},
month = {5},
year = {2024},
pages = {13898--13905},
url = {https://aclanthology.org/2024.lrec-main.1213},
note = {\url{https://arxiv.org/abs/2404.01657}}
}
References
@article{gemma-2-2024,
title = {Gemma 2},
url = {https://www.kaggle.com/models/google/gemma-2},
publisher = {Kaggle},
author = {Gemma Team},
year = {2024}
}
@misc{litgpt-2023,
author = {Lightning AI},
title = {LitGPT},
howpublished = {\url{https://github.com/Lightning-AI/litgpt}},
year = {2023}
}
License
- Downloads last month
- 112
2-bit
3-bit
4-bit
5-bit
6-bit
8-bit
Model tree for QuantFactory/gemma-2-baku-2b-GGUF
Base model
google/gemma-2-2b
Install Unsloth Studio (macOS, Linux, WSL)
# Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for QuantFactory/gemma-2-baku-2b-GGUF to start chatting