Instructions to use kaushalkrishnax/kritha-functiongemma-270m-finetuned with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use kaushalkrishnax/kritha-functiongemma-270m-finetuned with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="kaushalkrishnax/kritha-functiongemma-270m-finetuned") 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("kaushalkrishnax/kritha-functiongemma-270m-finetuned") model = AutoModelForCausalLM.from_pretrained("kaushalkrishnax/kritha-functiongemma-270m-finetuned", 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]:])) - LiteRT
How to use kaushalkrishnax/kritha-functiongemma-270m-finetuned with LiteRT:
# No code snippets available yet for this library. # To use this model, check the repository files and the library's documentation. # Want to help? PRs adding snippets are welcome at: # https://github.com/huggingface/huggingface.js
- LiteRT-LM
How to use kaushalkrishnax/kritha-functiongemma-270m-finetuned with LiteRT-LM:
# LiteRT-LM runs on various platforms (Android, iOS, Windows, Linux, macOS, IoT, Web/WASM) # and supports many APIs (C++, Python, Kotlin, Swift, JavaScript, Flutter). # For platform-specific integration guides, please refer to the official developer website: # https://ai.google.dev/edge/litert-lm # To try LiteRT-LM, the easiest way is to use our CLI tool. # 1. Install the LiteRT-LM CLI tool: pip install -U litert-lm # 2. Download and run this model locally: # See: https://ai.google.dev/edge/litert-lm/cli # A single .litertlm file in the repo is picked automatically; otherwise the CLI asks which one to run # (or pass its name right after the repo id). litert-lm run \ --from-huggingface-repo=kaushalkrishnax/kritha-functiongemma-270m-finetuned \ --prompt="Write me a poem"
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use kaushalkrishnax/kritha-functiongemma-270m-finetuned with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "kaushalkrishnax/kritha-functiongemma-270m-finetuned" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "kaushalkrishnax/kritha-functiongemma-270m-finetuned", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/kaushalkrishnax/kritha-functiongemma-270m-finetuned
- SGLang
How to use kaushalkrishnax/kritha-functiongemma-270m-finetuned 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 "kaushalkrishnax/kritha-functiongemma-270m-finetuned" \ --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": "kaushalkrishnax/kritha-functiongemma-270m-finetuned", "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 "kaushalkrishnax/kritha-functiongemma-270m-finetuned" \ --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": "kaushalkrishnax/kritha-functiongemma-270m-finetuned", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use kaushalkrishnax/kritha-functiongemma-270m-finetuned with Docker Model Runner:
docker model run hf.co/kaushalkrishnax/kritha-functiongemma-270m-finetuned
Kritha FunctionGemma 270M Finetuned
Fine-tuned checkpoint and quantized on-device bundle of google/functiongemma-270m-it built as the local action router for Kritha, an open-source cross-platform on-device AI assistant (mobile, desktop, and edge runtimes).
Model Overview
- Base Model:
google/functiongemma-270m-it(270M parameters) - Architecture: Gemma 3 text decoder with FunctionGemma tool-calling chat template
- Task: Low-latency single-turn tool selection and structured argument extraction across 80 system, application, device, and assistant tools, plus negative no-tool rejection
- Training Dataset:
kaushalkrishnax/kritha-functiongemma-80tools-dataset(1,416 rows with Top-8 candidate tool retrieval per query) - Validation Tool Selection Accuracy: ~96.0% after 8 epochs of supervised fine-tuning
Repository Contents
model.litertlm: Quantized INT8 (dynamic_wi8_afp32) LiteRT-LM bundle (277.92 MB, prefill lengths 256 and 1024, KV cache 2048) for LiteRT-LM runtimes across mobile and desktop platformsrelease_manifest.json: Artifact metadata, file sizes, and SHA-256 checksums for Kritha on-device model downloadsmodel.safetensors,config.json,generation_config.json: Full fine-tuned PyTorch / Safetensors weightstokenizer.model,tokenizer.json,tokenizer_config.json,special_tokens_map.json,added_tokens.json,chat_template.jinja: FunctionGemma tokenizer and tool-calling prompt template
Prompt Format & Usage
At runtime, Kritha retrieves the Top-8 candidate tools for a user query and formats the conversation using chat_template.jinja:
from transformers import AutoTokenizer, AutoModelForCausalLM
model_id = "kaushalkrishnax/kritha-functiongemma-270m-finetuned"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(model_id, device_map="auto")
messages = [
{"role": "developer", "content": "You are a model that can do function calling with the following functions"},
{"role": "user", "content": "Turn on the flashlight"}
]
prompt = tokenizer.apply_chat_template(
messages,
tools=candidate_tools,
add_generation_prompt=True,
tokenize=False
)
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
outputs = model.generate(**inputs, max_new_tokens=96, do_sample=False)
print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[1]:], skip_special_tokens=False))
Expected output format:
<start_function_call>call:toggle_flashlight{state:<escape>on<escape>}<end_function_call>
On-Device LiteRT-LM Deployment
- Fetch
release_manifest.jsonfrom this repository to verify the rootmodel.litertlmSHA-256 digest (8fab50fcd7c14ba490023070aa9c751136763b7db11e12819b0bac4d2ecd1c8d). - Keep the developer prompt, Top-8 tool schemas, and user query within 1,024 tokens to match the precompiled prefill signature.
- Parse
call:<tool_name>{...}blocks from the model output and dispatch to the corresponding local tool handler, falling back to the primary assistant LLM when no tool call is emitted.
License
This model is derived from google/functiongemma-270m-it and is governed by the Gemma Terms of Use.
- Downloads last month
- -
Model tree for kaushalkrishnax/kritha-functiongemma-270m-finetuned
Base model
google/functiongemma-270m-it