Instructions to use tiny-random/gemma-4-assistant with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use tiny-random/gemma-4-assistant with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="tiny-random/gemma-4-assistant")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("tiny-random/gemma-4-assistant") model = AutoModelForCausalLM.from_pretrained("tiny-random/gemma-4-assistant") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use tiny-random/gemma-4-assistant with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "tiny-random/gemma-4-assistant" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "tiny-random/gemma-4-assistant", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/tiny-random/gemma-4-assistant
- SGLang
How to use tiny-random/gemma-4-assistant 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 "tiny-random/gemma-4-assistant" \ --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": "tiny-random/gemma-4-assistant", "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 "tiny-random/gemma-4-assistant" \ --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": "tiny-random/gemma-4-assistant", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use tiny-random/gemma-4-assistant with Docker Model Runner:
docker model run hf.co/tiny-random/gemma-4-assistant
Upload folder using huggingface_hub
Browse files- .meta.json +1 -1
- README.md +15 -15
- model.safetensors +1 -1
.meta.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
{
|
| 2 |
-
"torch": "2.
|
| 3 |
"transformers": "5.9.0"
|
| 4 |
}
|
|
|
|
| 1 |
{
|
| 2 |
+
"torch": "2.10.0+cu130",
|
| 3 |
"transformers": "5.9.0"
|
| 4 |
}
|
README.md
CHANGED
|
@@ -42,20 +42,20 @@ messages = [
|
|
| 42 |
{"type": "text", "text": "What is shown in this image?"},
|
| 43 |
],
|
| 44 |
},
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
]
|
| 60 |
inputs = processor.apply_chat_template(
|
| 61 |
messages,
|
|
@@ -219,5 +219,5 @@ Gemma4AssistantForCausalLM(
|
|
| 219 |
|
| 220 |
### Test environment:
|
| 221 |
|
| 222 |
-
- torch: 2.
|
| 223 |
- transformers: 5.9.0
|
|
|
|
| 42 |
{"type": "text", "text": "What is shown in this image?"},
|
| 43 |
],
|
| 44 |
},
|
| 45 |
+
{
|
| 46 |
+
"role": "assistant",
|
| 47 |
+
"content": [{"type": "text", "text": "Dummy response for image"}],
|
| 48 |
+
},
|
| 49 |
+
{
|
| 50 |
+
"role": "user",
|
| 51 |
+
"content": [
|
| 52 |
+
{
|
| 53 |
+
"type": "video",
|
| 54 |
+
"video": "https://github.com/bebechien/gemma/raw/refs/heads/main/videos/ForBiggerBlazes.mp4",
|
| 55 |
+
},
|
| 56 |
+
{"type": "text", "text": "Describe this video."},
|
| 57 |
+
],
|
| 58 |
+
},
|
| 59 |
]
|
| 60 |
inputs = processor.apply_chat_template(
|
| 61 |
messages,
|
|
|
|
| 219 |
|
| 220 |
### Test environment:
|
| 221 |
|
| 222 |
+
- torch: 2.10.0+cu130
|
| 223 |
- transformers: 5.9.0
|
model.safetensors
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 4253552
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:c50759ae4d2f54230b67cc17c5f1f21341ed87153d25bc36f0eac868535358d6
|
| 3 |
size 4253552
|