Instructions to use benjamin/Gemma2-2B-Distilled-Math with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use benjamin/Gemma2-2B-Distilled-Math with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="benjamin/Gemma2-2B-Distilled-Math")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("benjamin/Gemma2-2B-Distilled-Math") model = AutoModelForCausalLM.from_pretrained("benjamin/Gemma2-2B-Distilled-Math") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use benjamin/Gemma2-2B-Distilled-Math with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "benjamin/Gemma2-2B-Distilled-Math" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "benjamin/Gemma2-2B-Distilled-Math", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/benjamin/Gemma2-2B-Distilled-Math
- SGLang
How to use benjamin/Gemma2-2B-Distilled-Math 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 "benjamin/Gemma2-2B-Distilled-Math" \ --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": "benjamin/Gemma2-2B-Distilled-Math", "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 "benjamin/Gemma2-2B-Distilled-Math" \ --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": "benjamin/Gemma2-2B-Distilled-Math", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use benjamin/Gemma2-2B-Distilled-Math with Docker Model Runner:
docker model run hf.co/benjamin/Gemma2-2B-Distilled-Math
Upload Gemma2ForCausalLM
Browse files
generation_config.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
| 3 |
"bos_token_id": 2,
|
| 4 |
"cache_implementation": "hybrid",
|
| 5 |
"eos_token_id": 1,
|
| 6 |
-
"max_length":
|
| 7 |
"pad_token_id": 0,
|
| 8 |
"transformers_version": "4.46.0.dev0"
|
| 9 |
}
|
|
|
|
| 3 |
"bos_token_id": 2,
|
| 4 |
"cache_implementation": "hybrid",
|
| 5 |
"eos_token_id": 1,
|
| 6 |
+
"max_length": 1024,
|
| 7 |
"pad_token_id": 0,
|
| 8 |
"transformers_version": "4.46.0.dev0"
|
| 9 |
}
|
model-00001-of-00003.safetensors
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 4930368016
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:9041543a8a17383023a4d5b9a094f1cc283d06b6db3723417d9392d2bd8d0881
|
| 3 |
size 4930368016
|
model-00002-of-00003.safetensors
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 4983443424
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:85e1ac56f84c469aaf0b5b36d32b05e0298e276e1ba60f1d371339f2a9397574
|
| 3 |
size 4983443424
|
model-00003-of-00003.safetensors
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 566316152
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:0745f179dd00d73dc4e4c07dcf29456bcec32db4899e824f9bcfb1b64d23678b
|
| 3 |
size 566316152
|