Instructions to use google/gemma-3-1b-it with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use google/gemma-3-1b-it with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="google/gemma-3-1b-it") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("google/gemma-3-1b-it") model = AutoModelForCausalLM.from_pretrained("google/gemma-3-1b-it") 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]:])) - Inference
- Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use google/gemma-3-1b-it with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "google/gemma-3-1b-it" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "google/gemma-3-1b-it", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/google/gemma-3-1b-it
- SGLang
How to use google/gemma-3-1b-it 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 "google/gemma-3-1b-it" \ --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": "google/gemma-3-1b-it", "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 "google/gemma-3-1b-it" \ --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": "google/gemma-3-1b-it", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use google/gemma-3-1b-it with Docker Model Runner:
docker model run hf.co/google/gemma-3-1b-it
Install & run google/gemma-3-1b-it easily using llmpm
#41 opened 2 months ago
by
sarthak-saxena
Request: DOI
1
#40 opened 3 months ago
by
MartaAguilarMorcillo
Request: DOI
1
#39 opened 4 months ago
by
Behnambagi
Personal
#38 opened 5 months ago
by
zak90zakarezohra
Multilingual Translation?
1
#36 opened 6 months ago
by
anshuKr
Request: DOI
1
#35 opened 6 months ago
by
rabiulhassan
GraiLLM
#34 opened 7 months ago
by
Caesaropapism
How to finetune this and make it work using mediapipe on kotlin with GPU delegate support like litert-community/Gemma3-1B-IT ?
1
#32 opened 7 months ago
by
andromedazt
Request: DOI
1
#31 opened 7 months ago
by
Najin06
Add chat_template.json
#30 opened 8 months ago
by
raphaelmerx
Is it able to select languages after training for generating text?
1
#29 opened 8 months ago
by
DuongLeVan
Get AutoProcessor working
#28 opened 8 months ago
by
mamousavi
[Gemma-3-1B] Gibberish outputs after instruction fine-tuning
1
#27 opened 9 months ago
by
razumelo
Honest Review
🔥 1
2
#26 opened 9 months ago
by
kalashshah19
Update README.md
#25 opened 10 months ago
by
krooner
Request: DOI
1
#24 opened 10 months ago
by
frdfd
TRAINING DATA
4
#23 opened 11 months ago
by
amanpreet7
OSError: Can't load tokenizer for 'google/gemma-3-1b-it'.
1
#20 opened about 1 year ago
by
JeffMII
RuntimeError: value cannot be converted to type uint8_t without overflow
1
#19 opened about 1 year ago
by
TyJaJa
Request: DOI
1
#18 opened about 1 year ago
by
S22-22
Why are vocab_size and tokenizer different length?
👀 5
5
#17 opened about 1 year ago
by
choco9966
GUI python
1
#14 opened about 1 year ago
by
sportcmaneiro
Serving on vLLM creates nonsense responses
3
#12 opened about 1 year ago
by
cahmetcan
Remove development branch of transformers
3
#11 opened about 1 year ago
by
farzadab
Use the model as a sequence classifier
🤝👍 5
4
#10 opened about 1 year ago
by
A123hmed
Transformers Pipeline Error: AttributeError: 'NoneType' object has no attribute 'apply_chat_template'
🔥 1
16
#9 opened about 1 year ago
by
steve122192
AttributeError: 'HybridCache' object has no attribute 'float'
3
#8 opened about 1 year ago
by
naruto-soop
Remove processor class from tokenizer_config.json
1
#7 opened about 1 year ago
by
Xenova
What transformers version can this be deployed with?
4
#6 opened about 1 year ago
by
Khalizo