Text Generation
Transformers
Safetensors
gemma3_text
gemma3
gemma
google
functiongemma
conversational
text-generation-inference
Instructions to use unsloth/functiongemma-270m-it with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use unsloth/functiongemma-270m-it with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="unsloth/functiongemma-270m-it") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("unsloth/functiongemma-270m-it") model = AutoModelForCausalLM.from_pretrained("unsloth/functiongemma-270m-it", device_map="auto") 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=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use unsloth/functiongemma-270m-it with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "unsloth/functiongemma-270m-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": "unsloth/functiongemma-270m-it", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/unsloth/functiongemma-270m-it
- SGLang
How to use unsloth/functiongemma-270m-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 "unsloth/functiongemma-270m-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": "unsloth/functiongemma-270m-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 "unsloth/functiongemma-270m-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": "unsloth/functiongemma-270m-it", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use unsloth/functiongemma-270m-it with Docker Model Runner:
docker model run hf.co/unsloth/functiongemma-270m-it
Commit History
-
Update config.json
Verified signaturehttps://huggingface.co/google/functiongemma-270m-it/discussions/5#694457b5ad6f76a0d3c43917 """ vLLM has started using the Transformers v5 style rope_parameters and patches it into configs loaded with Transformers v4. vLLM 0.12.0 uses the existence of rope_parameters to decide whether or not to set a default value for it, i.e.: if rope_theta is not None: if not hasattr(config, "rope_parameters"): config.rope_parameters = {"rope_type": "default"} config.rope_parameters["rope_theta"] = rope_theta This causes an error with this model because rope_parameters will remain None and the following dict assignment will fail. https://github.com/vllm-project/vllm/pull/30983 fixes this on the vLLM side for (hopefully) v0.13.0 onwards. Removing these fields from the checkpoint should fix this model for vLLM v0.12.0 in the meantime. """5c044ab
-
Upload folder using huggingface_hub
Verified signature78d4fe7 -
Update config.json
Verified signature87f5326 -
Update README.md
Verified signature5837e5c -
Update README.md
Verified signature3c77f8c -
Update README.md
Verified signature07091cc -
Upload folder using huggingface_hub
Verified signaturee65771c -
Update chat_template.jinja
Verified signature138f1cd -
Delete tiny_garden.litertlm
Verified signature9e13130 -
Add files using upload-large-folder tool
Verified signature32581f0
-
Add files using upload-large-folder tool
Verified signatured840801 -
initial commit
Verified signaturefa70096