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)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("unsloth/functiongemma-270m-it") model = AutoModelForCausalLM.from_pretrained("unsloth/functiongemma-270m-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]:])) - 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
Update config.json
Browse fileshttps://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.
"""
- config.json +0 -2
|
@@ -44,8 +44,6 @@
|
|
| 44 |
"query_pre_attn_scalar": 256,
|
| 45 |
"rms_norm_eps": 1e-06,
|
| 46 |
"rope_local_base_freq": 10000.0,
|
| 47 |
-
"rope_parameters": null,
|
| 48 |
-
"rope_scaling": null,
|
| 49 |
"rope_theta": 1000000.0,
|
| 50 |
"sliding_window": 512,
|
| 51 |
"transformers_version": "4.57.3",
|
|
|
|
| 44 |
"query_pre_attn_scalar": 256,
|
| 45 |
"rms_norm_eps": 1e-06,
|
| 46 |
"rope_local_base_freq": 10000.0,
|
|
|
|
|
|
|
| 47 |
"rope_theta": 1000000.0,
|
| 48 |
"sliding_window": 512,
|
| 49 |
"transformers_version": "4.57.3",
|