Downloads · 30 days
20
17% of all-time downloads
DarylFranxx/functiongemma-270m-mika
functiongemma-270m-mika is a text generation model from DarylFranxx. Use it when you need the model to write or continue text. It is set up for mlx. The card lists the license as apache-2.0.
基于 lmstudio-community/functiongemma-270m-it-MLX-bf16 修改发布。
Downloads · 30 days
20
17% of all-time downloads
All-time downloads
119
Public
Parameters
268M
570 MB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors536 MB · 94%
From the Hugging Face model README
基于 lmstudio-community/functiongemma-270m-it-MLX-bf16 修改发布。
| 参数 | 值 |
|---|---|
| 架构 | Gemma3ForCausalLM |
| 参数量 | ~270M |
| Hidden Size | 640 |
| 层数 | 18 (sliding + full attention混合) |
| 词表大小 | 262,144 |
| 最大上下文 | 32,768 tokens |
| 精度 | bfloat16 |
generation_config.jsonfrom mlx_lm import load, generate
model, tokenizer = load("DarylFranxx/functiongemma-270m-mika")
# 普通对话
response = generate(model, tokenizer,
prompt="你好,请介绍一下自己",
max_tokens=256)
print(response)
from mlx_lm import load, generate
model, tokenizer = load("DarylFranxx/functiongemma-270m-mika")
tools = [
{
"name": "get_weather",
"description": "获取指定城市的天气信息",
"parameters": {
"type": "object",
"properties": {
"city": {"type": "string", "description": "城市名称"},
"date": {"type": "string", "description": "日期,格式YYYY-MM-DD"}
},
"required": ["city"]
}
}
]
messages = [
{"role": "user", "content": "北京今天天气怎么样?"}
]
# 使用tokenizer的chat_template格式化
prompt = tokenizer.apply_chat_template(
messages,
tools=tools,
tokenize=False,
add_generation_prompt=True
)
response = generate(model, tokenizer, prompt=prompt, max_tokens=512)
print(response)
from transformers import AutoTokenizer, AutoModelForCausalLM
import torch
model_id = "DarylFranxx/functiongemma-270m-mika"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
model_id,
torch_dtype=torch.bfloat16,
device_map="auto"
)
messages = [{"role": "user", "content": "Hello!"}]
inputs = tokenizer.apply_chat_template(
messages, return_tensors="pt", add_generation_prompt=True
).to(model.device)
outputs = model.generate(inputs, max_new_tokens=256)
print(tokenizer.decode(outputs[0][inputs.shape[-1]:], skip_special_tokens=True))
transformers >= 4.57.3 才支持 Gemma3ForCausalLM