Instructions to use NotoriousH2/gemma-3-1b-it-Math with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use NotoriousH2/gemma-3-1b-it-Math with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="NotoriousH2/gemma-3-1b-it-Math") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("NotoriousH2/gemma-3-1b-it-Math") model = AutoModelForCausalLM.from_pretrained("NotoriousH2/gemma-3-1b-it-Math") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use NotoriousH2/gemma-3-1b-it-Math with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "NotoriousH2/gemma-3-1b-it-Math" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "NotoriousH2/gemma-3-1b-it-Math", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/NotoriousH2/gemma-3-1b-it-Math
- SGLang
How to use NotoriousH2/gemma-3-1b-it-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 "NotoriousH2/gemma-3-1b-it-Math" \ --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": "NotoriousH2/gemma-3-1b-it-Math", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'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 "NotoriousH2/gemma-3-1b-it-Math" \ --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": "NotoriousH2/gemma-3-1b-it-Math", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use NotoriousH2/gemma-3-1b-it-Math with Docker Model Runner:
docker model run hf.co/NotoriousH2/gemma-3-1b-it-Math
Upload Gemma3ForCausalLM
Browse files- config.json +3 -6
- generation_config.json +2 -1
- model.safetensors +1 -1
config.json
CHANGED
|
@@ -9,10 +9,7 @@
|
|
| 9 |
"bos_token_id": 2,
|
| 10 |
"cache_implementation": "hybrid",
|
| 11 |
"dtype": "bfloat16",
|
| 12 |
-
"eos_token_id":
|
| 13 |
-
1,
|
| 14 |
-
106
|
| 15 |
-
],
|
| 16 |
"final_logit_softcapping": null,
|
| 17 |
"head_dim": 256,
|
| 18 |
"hidden_activation": "gelu_pytorch_tanh",
|
|
@@ -52,7 +49,7 @@
|
|
| 52 |
"num_attention_heads": 4,
|
| 53 |
"num_hidden_layers": 26,
|
| 54 |
"num_key_value_heads": 1,
|
| 55 |
-
"pad_token_id":
|
| 56 |
"query_pre_attn_scalar": 256,
|
| 57 |
"rms_norm_eps": 1e-06,
|
| 58 |
"rope_local_base_freq": 10000,
|
|
@@ -62,6 +59,6 @@
|
|
| 62 |
"sliding_window_pattern": 6,
|
| 63 |
"transformers_version": "4.57.3",
|
| 64 |
"use_bidirectional_attention": false,
|
| 65 |
-
"use_cache":
|
| 66 |
"vocab_size": 262144
|
| 67 |
}
|
|
|
|
| 9 |
"bos_token_id": 2,
|
| 10 |
"cache_implementation": "hybrid",
|
| 11 |
"dtype": "bfloat16",
|
| 12 |
+
"eos_token_id": 1,
|
|
|
|
|
|
|
|
|
|
| 13 |
"final_logit_softcapping": null,
|
| 14 |
"head_dim": 256,
|
| 15 |
"hidden_activation": "gelu_pytorch_tanh",
|
|
|
|
| 49 |
"num_attention_heads": 4,
|
| 50 |
"num_hidden_layers": 26,
|
| 51 |
"num_key_value_heads": 1,
|
| 52 |
+
"pad_token_id": 1,
|
| 53 |
"query_pre_attn_scalar": 256,
|
| 54 |
"rms_norm_eps": 1e-06,
|
| 55 |
"rope_local_base_freq": 10000,
|
|
|
|
| 59 |
"sliding_window_pattern": 6,
|
| 60 |
"transformers_version": "4.57.3",
|
| 61 |
"use_bidirectional_attention": false,
|
| 62 |
+
"use_cache": false,
|
| 63 |
"vocab_size": 262144
|
| 64 |
}
|
generation_config.json
CHANGED
|
@@ -3,10 +3,11 @@
|
|
| 3 |
"cache_implementation": "hybrid",
|
| 4 |
"do_sample": true,
|
| 5 |
"eos_token_id": [
|
|
|
|
| 6 |
1,
|
| 7 |
106
|
| 8 |
],
|
| 9 |
-
"pad_token_id":
|
| 10 |
"top_k": 64,
|
| 11 |
"top_p": 0.95,
|
| 12 |
"transformers_version": "4.57.3"
|
|
|
|
| 3 |
"cache_implementation": "hybrid",
|
| 4 |
"do_sample": true,
|
| 5 |
"eos_token_id": [
|
| 6 |
+
1,
|
| 7 |
1,
|
| 8 |
106
|
| 9 |
],
|
| 10 |
+
"pad_token_id": 1,
|
| 11 |
"top_k": 64,
|
| 12 |
"top_p": 0.95,
|
| 13 |
"transformers_version": "4.57.3"
|
model.safetensors
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 1999811208
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:6fa46f2ee0ff78b3929eb742ecb774db451a64233958dc9205337265625c88aa
|
| 3 |
size 1999811208
|