初始化项目,由ModelHub XC社区提供模型
Model: OrdenWills/LFM2.5-350M-home-assistant-sft Source: Original Platform
This commit is contained in:
41
.gitattributes
vendored
Normal file
41
.gitattributes
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
*.7z filter=lfs diff=lfs merge=lfs -text
|
||||
*.arrow filter=lfs diff=lfs merge=lfs -text
|
||||
*.bin filter=lfs diff=lfs merge=lfs -text
|
||||
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
||||
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
||||
*.ftz filter=lfs diff=lfs merge=lfs -text
|
||||
*.gz filter=lfs diff=lfs merge=lfs -text
|
||||
*.h5 filter=lfs diff=lfs merge=lfs -text
|
||||
*.joblib filter=lfs diff=lfs merge=lfs -text
|
||||
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
||||
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
||||
*.model filter=lfs diff=lfs merge=lfs -text
|
||||
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
||||
*.npy filter=lfs diff=lfs merge=lfs -text
|
||||
*.npz filter=lfs diff=lfs merge=lfs -text
|
||||
*.onnx filter=lfs diff=lfs merge=lfs -text
|
||||
*.ot filter=lfs diff=lfs merge=lfs -text
|
||||
*.parquet filter=lfs diff=lfs merge=lfs -text
|
||||
*.pb filter=lfs diff=lfs merge=lfs -text
|
||||
*.pickle filter=lfs diff=lfs merge=lfs -text
|
||||
*.pkl filter=lfs diff=lfs merge=lfs -text
|
||||
*.pt filter=lfs diff=lfs merge=lfs -text
|
||||
*.pth filter=lfs diff=lfs merge=lfs -text
|
||||
*.rar filter=lfs diff=lfs merge=lfs -text
|
||||
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
||||
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
||||
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
||||
*.tar filter=lfs diff=lfs merge=lfs -text
|
||||
*.tflite filter=lfs diff=lfs merge=lfs -text
|
||||
*.tgz filter=lfs diff=lfs merge=lfs -text
|
||||
*.wasm filter=lfs diff=lfs merge=lfs -text
|
||||
*.xz filter=lfs diff=lfs merge=lfs -text
|
||||
*.zip filter=lfs diff=lfs merge=lfs -text
|
||||
*.zst filter=lfs diff=lfs merge=lfs -text
|
||||
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
||||
LFM2.5-350M.Q4_K_M.gguf filter=lfs diff=lfs merge=lfs -text
|
||||
model-q4_k_m.gguf filter=lfs diff=lfs merge=lfs -text
|
||||
LFM2.5-350M.Q8_0.gguf filter=lfs diff=lfs merge=lfs -text
|
||||
LFM2.5-350M-home-assistant-sft-stage2.Q8_0.gguf filter=lfs diff=lfs merge=lfs -text
|
||||
LFM2.5-350M-home-assistant-sft-stage2.Q4_K_M.gguf filter=lfs diff=lfs merge=lfs -text
|
||||
LFM2.5-350M.F16.gguf filter=lfs diff=lfs merge=lfs -text
|
||||
3
LFM2.5-350M-home-assistant-sft-stage2.Q4_K_M.gguf
Normal file
3
LFM2.5-350M-home-assistant-sft-stage2.Q4_K_M.gguf
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:a6e36727e724f0f6b298a01b498fb459c5b06efc1fd37e88aa7a998786c65c96
|
||||
size 229311776
|
||||
3
LFM2.5-350M-home-assistant-sft-stage2.Q8_0.gguf
Normal file
3
LFM2.5-350M-home-assistant-sft-stage2.Q8_0.gguf
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:f0c558dd727a2b121cb09f54fc71df0b6deba3ee703fc6abc08bdc6cde10b194
|
||||
size 379217184
|
||||
3
LFM2.5-350M.F16.gguf
Normal file
3
LFM2.5-350M.F16.gguf
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:f98600a76b7fb98b6ca23293ac4c1e1b2b8b5c990dca848261918b5b2ba0d6c1
|
||||
size 711484704
|
||||
3
LFM2.5-350M.Q4_K_M.gguf
Normal file
3
LFM2.5-350M.Q4_K_M.gguf
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:b97cc4516a34e97fb3cb2e0f8e5c8cf9b853d5a3f19e0a4f35eeccaeee6fd6a7
|
||||
size 229311776
|
||||
3
LFM2.5-350M.Q8_0.gguf
Normal file
3
LFM2.5-350M.Q8_0.gguf
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:a7b70427655988023a7fe36f1dd2533c4960cc1f4a5ced7c25f6c178afb57a99
|
||||
size 379217184
|
||||
282
README.md
Normal file
282
README.md
Normal file
@@ -0,0 +1,282 @@
|
||||
---
|
||||
language:
|
||||
- en
|
||||
license: apache-2.0
|
||||
base_model: LiquidAI/LFM2.5-350M
|
||||
tags:
|
||||
- smart-home
|
||||
- home-automation
|
||||
- tool-calling
|
||||
- function-calling
|
||||
- iot
|
||||
- unsloth
|
||||
- lora
|
||||
- lfm2
|
||||
pipeline_tag: text-generation
|
||||
---
|
||||
|
||||
# LFM2.5-350M Home Assistant (Stage 2 Stable Release)
|
||||
|
||||
A purpose-trained smart home automation model fine-tuned from [LiquidAI/LFM2.5-350M](https://huggingface.co/LiquidAI/LFM2.5-350M). This model controls lights, doors, thermostats, TVs, fans, speakers, and home scenes through structured tool calls, with full awareness of current device states.
|
||||
|
||||
**⚠️ Version Notice:** This is the **Stable Release**, trained exclusively on our robust Stage 2 State-Aware dataset (v13 Final Merge). The experimental multi-stage version is currently still in training and will be released for comparison once stabilized.
|
||||
|
||||
**👉 Which file should I download?**
|
||||
For the most stable experience right now, download one of the following GGUF files:
|
||||
* `LFM2.5-350M.F16.gguf`
|
||||
* `LFM2.5-350M.Q4_K_M.gguf` (Recommended for most users, best balance of speed and size)
|
||||
* `LFM2.5-350M.Q8_0.gguf` (Highest quality quantization)
|
||||
|
||||
---
|
||||
|
||||
## What It Does
|
||||
|
||||
Given a natural language command and the current state of all connected devices, the model outputs the correct tool call — or explains in plain text why no action is needed. It handles:
|
||||
|
||||
- **Advanced Device Disambiguation** — If you say "Turn off the TV", the model will intelligently resolve which TV you mean by checking if only one TV is connected, checking if you are in a room with a TV, or inferring intent from the state (e.g., if only one TV is currently ON, it turns that one off via a `<think>` trace).
|
||||
- **Media & Music Playback** — "Play Truth In The World By Lucky Dube" → `control_speaker(room='living_room', action='play', media='Truth In The World By Lucky Dube')`
|
||||
- **Direct commands** — "Turn on the bedroom light" → `toggle_lights(room='bedroom', state='on')`
|
||||
- **Already-satisfied detection** — "Turn on the bedroom light" when `bedroom:on` in STATE → "The bedroom light is already on." (no tool call)
|
||||
- **Pronoun resolution** — "Turn off the light" when `current_user_room=kitchen` → `toggle_lights(room='kitchen', state='off')`
|
||||
- **Bulk state-aware actions** — "Turn off what's on" → reads STATE, emits one call per lit room using `<think>` logic.
|
||||
- **Undo / repeat via action log** — "Undo that" + `[RECENT ACTIONS: toggle_lights(bedroom, on)]` → `toggle_lights(room='bedroom', state='off')`
|
||||
- **Multi-device compound commands** — "Lock the front door and turn off the living room light" → uses a rigid reasoning format (`Total: N tool calls required`) to emit parallel tool calls.
|
||||
- **Topology-aware rejection** — "Turn on the garage light" when garage not in connected rooms → `intent_unclear(reason='unsupported_device')`
|
||||
- **Scene activation** — "Movie night" / "Bedtime" / "I'm leaving" → `set_scene(...)`
|
||||
- **Fan control** — "Set the bedroom fan to high" → `control_fan(room='bedroom', state='on', speed='high')`
|
||||
- **Thermostat** — "Make it 72 degrees" → `set_thermostat(temperature=72, mode='heat')`
|
||||
- **Syntactic Action Triggers** — Internal reasoning strictly concludes with `ACTION REQUIRED.` or `ACTION NOT REQUIRED. Text reply only.` to reliably signal structural intent before opening a JSON block.
|
||||
|
||||
---
|
||||
|
||||
## Tool Schema
|
||||
|
||||
The model outputs calls from the following 10-tool schema. All tools use exact parameter names.
|
||||
|
||||
```python
|
||||
toggle_lights(room: str, state: 'on'|'off')
|
||||
# room: living_room | bedroom | kitchen | bathroom | office | hallway
|
||||
|
||||
toggle_all_lights(state: 'on'|'off')
|
||||
|
||||
lock_door(door: str, state: 'lock'|'unlock')
|
||||
# door: front | back | garage | side | bedroom | bathroom | office | kitchen | living_room
|
||||
|
||||
lock_all_doors(state: 'lock'|'unlock')
|
||||
|
||||
set_thermostat(temperature: int, mode: 'heat'|'cool'|'auto')
|
||||
# temperature range: 60–80°F
|
||||
|
||||
set_scene(scene: 'movie_night'|'bedtime'|'morning'|'away'|'party')
|
||||
|
||||
control_tv(room: str, state: 'on'|'off')
|
||||
# room: living_room | bedroom | office
|
||||
|
||||
control_fan(room: str, state: 'on'|'off', speed: 'low'|'medium'|'high' = optional)
|
||||
# room: living_room | bedroom | kitchen | office
|
||||
|
||||
control_speaker(room: str, action: 'play'|'pause'|'stop'|'next'|'previous', media: str = optional)
|
||||
# room: living_room | bedroom | kitchen | office | hallway
|
||||
|
||||
intent_unclear(reason: 'off_topic'|'incomplete'|'unsupported_device'|'unsupported_feature')
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## State Format
|
||||
|
||||
Every user message must be prefixed with a `[STATE:]` block.
|
||||
|
||||
```text
|
||||
[STATE: lights={bedroom:on, kitchen:off, living_room:on}, doors={back:locked, front:unlocked}, thermostat=70F/heat, scene=none, tv={bedroom:off, living_room:on}, speaker={kitchen:stopped}, fan={bedroom:on(low)}, current_user_room=kitchen]
|
||||
```
|
||||
|
||||
**Field breakdown:**
|
||||
|
||||
| Field | Values | Notes |
|
||||
|---|---|---|
|
||||
| `lights` | `room:on\|off` | Only include connected rooms |
|
||||
| `doors` | `door:locked\|unlocked` | Only include connected doors |
|
||||
| `thermostat` | `<temp>F/<mode>` | e.g. `72F/heat` |
|
||||
| `scene` | scene name or `none` | Active scene or none |
|
||||
| `tv` | `{room:on\|off, ...}` | Dictionary of connected TVs |
|
||||
| `speaker` | `{room:playing\|paused\|stopped, ...}` | Dictionary of connected speakers |
|
||||
| `fan` | `{room:on\|off(speed), ...}` | Dictionary of connected fans |
|
||||
| `current_user_room` | room name or empty | Drives pronoun ("this room") resolution |
|
||||
|
||||
---
|
||||
|
||||
## Usage
|
||||
|
||||
### Minimal inference example
|
||||
|
||||
```python
|
||||
from transformers import AutoModelForCausalLM, AutoTokenizer
|
||||
import torch
|
||||
|
||||
model_id = "OrdenWills/LFM2.5-350M-home-assistant-sft"
|
||||
|
||||
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
||||
model = AutoModelForCausalLM.from_pretrained(
|
||||
model_id,
|
||||
torch_dtype=torch.float16,
|
||||
device_map="auto",
|
||||
)
|
||||
|
||||
SYSTEM_PROMPT = """You are a smart home assistant AI. Use tools to control the home.
|
||||
|
||||
Output function calls as JSON.
|
||||
|
||||
TOOLS:
|
||||
toggle_lights(room, state='on'|'off')
|
||||
toggle_all_lights(state='on'|'off')
|
||||
lock_door(door, state='lock'|'unlock')
|
||||
lock_all_doors(state='lock'|'unlock')
|
||||
set_thermostat(temperature=<int>, mode='heat'|'cool'|'auto')
|
||||
set_scene(scene='movie_night'|'bedtime'|'morning'|'away'|'party')
|
||||
control_tv(room, state='on'|'off')
|
||||
control_fan(room, state='on'|'off'[, speed='low'|'medium'|'high'])
|
||||
control_speaker(room, action='play'|'pause'|'stop'|'next'|'previous'[, media='<str>'])
|
||||
intent_unclear(reason='off_topic'|'incomplete'|'unsupported_device'|'unsupported_feature')
|
||||
|
||||
CONNECTED ROOMS (lights): living_room, bedroom, kitchen, bathroom, office, hallway
|
||||
CONNECTED DOORS: front, back, garage
|
||||
CONNECTED TVs: living_room, bedroom
|
||||
CONNECTED SPEAKERS: living_room
|
||||
CONNECTED FANS: bedroom
|
||||
|
||||
STATE RULES:
|
||||
[STATE:] shows all current device states.
|
||||
State already matches request → plain text reply, NO tool call.
|
||||
Only rooms listed under CONNECTED TVs/SPEAKERS/FANS have those devices.
|
||||
Requesting a device in an unlisted room → intent_unclear(unsupported_device).
|
||||
|
||||
TV / SPEAKER / FAN RESOLUTION when user says 'the TV'/'the fan'/'the speaker':
|
||||
1. Exactly one connected → use that room automatically.
|
||||
2. Multiple connected + current_user_room has device → use current_user_room.
|
||||
3. Multiple connected + exactly ONE is in the eligible state for the action
|
||||
(e.g. only one TV is on and user says 'turn off the TV') → infer that room.
|
||||
4. Multiple connected + ambiguous (rule 2 & 3 don't apply) → intent_unclear(incomplete).
|
||||
|
||||
LIGHT / DOOR RESOLUTION:
|
||||
current_user_room set + connected → use current_user_room.
|
||||
current_user_room set + NOT connected → intent_unclear(unsupported_device).
|
||||
current_user_room empty → intent_unclear(incomplete).
|
||||
|
||||
[RECENT ACTIONS:] → transaction log, newest entry first. Format:
|
||||
(X mins ago) [call1, call2, ...] -> summary.
|
||||
Each [...] bracket is ONE command the user previously issued.
|
||||
For 'undo'/'reverse'/'back': invert ONLY the most recent transaction
|
||||
(the FIRST [...] block). Older transactions are always ignored.
|
||||
For pronouns ('it'/'them'): refer to the device(s) in the first [...] block.
|
||||
Do NOT use recent actions to infer which room 'the light' or 'the door'
|
||||
refers to when current_user_room is explicitly set — current_user_room wins.
|
||||
For 'all lights' / 'all doors': use toggle_all_lights / lock_all_doors
|
||||
regardless of current_user_room.
|
||||
SYNONYMS: 'open'='unlock'; 'close'/'shut'='lock'; 'skip'='next';
|
||||
'back'='previous' (for speaker track navigation), but can also mean 'undo' for
|
||||
reverting device states based on [RECENT ACTIONS].
|
||||
'continue'/'resume'/'on the music'='play'; 'play <song/artist>' = action='play' + media='<str>'.
|
||||
Relative state clauses ('the light that is on', 'the door that is locked')
|
||||
override current_user_room — check STATE and act on the matching device."""
|
||||
|
||||
state = "[STATE: lights={bathroom:off, bedroom:off, hallway:off, kitchen:off, living_room:on, office:off}, doors={back:locked, front:locked, garage:unlocked}, thermostat=70F/heat, scene=none, tv={bedroom:off, living_room:on}, speaker={living_room:stopped}, fan={bedroom:off(medium)}, current_user_room=kitchen]"
|
||||
|
||||
messages = [
|
||||
{"role": "system", "content": SYSTEM_PROMPT},
|
||||
{"role": "user", "content": f"{state}\nTurn off the TV."},
|
||||
]
|
||||
|
||||
input_ids = tokenizer.apply_chat_template(
|
||||
messages, tokenize=True, add_generation_prompt=True, return_tensors="pt"
|
||||
).to(model.device)
|
||||
|
||||
with torch.no_grad():
|
||||
output = model.generate(
|
||||
input_ids,
|
||||
max_new_tokens=256,
|
||||
temperature=0.1, # low temp for deterministic tool calls
|
||||
do_sample=True,
|
||||
pad_token_id=tokenizer.eos_token_id,
|
||||
)
|
||||
|
||||
response = tokenizer.decode(
|
||||
output[0][input_ids.shape[-1]:], skip_special_tokens=True
|
||||
)
|
||||
print(response)
|
||||
# Expected behavior: The model will generate a <think> trace noting that only the living_room TV is currently ON, infer the user wants to turn off the living_room TV, conclude with ACTION REQUIRED, and emit the tool call.
|
||||
```
|
||||
|
||||
### GGUF / Ollama
|
||||
|
||||
```bash
|
||||
# Pull the recommended q4_k_m quantization
|
||||
ollama run hf.co/OrdenWills/LFM2.5-350M-home-assistant-sft:Q4_K_M
|
||||
|
||||
# Or use the higher precision q8_0 version
|
||||
ollama run hf.co/OrdenWills/LFM2.5-350M-home-assistant-sft:Q8_0
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Training Details (Stage 2 Stable)
|
||||
|
||||
This release was fine-tuned directly on a 70,000-example state-aware synthetic dataset ("v13 Final Merge").
|
||||
|
||||
| Parameter | Value |
|
||||
|---|---|
|
||||
| Base model | LiquidAI/LFM2.5-350M |
|
||||
| Dataset Size | 70,000 examples |
|
||||
| Categories | 33 distinct instruction schemas |
|
||||
| Think Traces | Extensive (Present in majority of complex scenarios) |
|
||||
| Hardware | Kaggle T4 (16 GB) |
|
||||
|
||||
### Training Categories
|
||||
|
||||
| Category | Description | Think Trace? |
|
||||
|---|---|---|
|
||||
| `already_satisfied` / `state_grounding` | Graceful replies if the device is already in the requested state. Forces reading of state arrays. | **Yes** / No |
|
||||
| `action_required` / `relative_clause` | Standard explicit device triggers and relative logic ("turn off the light that is on"). | **Yes** / No |
|
||||
| `user_room_lights/doors` | Resolves "the light" / "the door" based on `current_user_room`. | **Yes** |
|
||||
| `bulk_plus_local_door` | Complex compound logic mixing global state-aware commands with implicit local commands. | **Yes** |
|
||||
| `action_log_*` / `them_plurality` | "Undo", "repeat", "same for bedroom", and resolving plural pronouns using `[RECENT ACTIONS:]`. | **Yes** |
|
||||
| `scenes/thermostat` | Standard NLP triggering for scenes and temperature bounds. | No |
|
||||
| `rejections/missing` | "Make me coffee", unconnected rooms, and resolving `incomplete` vs `unsupported_device`. | **Yes** / No |
|
||||
| `compound_count` | Parallel tool calling with forced sub-action counting before generation. | **Yes** |
|
||||
| `status_queries` | "Are the lights on?" / "What is the thermostat set to?" plain text answers. | **Yes** |
|
||||
| `tv/speaker/fan commands`| Multi-device disambiguation logic (State inference via `Rule 3` vs implicit fallback). | **Yes**|
|
||||
| `local_media_commands` | Parsing local track titles via the `media` parameter for specific song playback. | **Yes** |
|
||||
|
||||
**Selective Thinking (`<think>...`):** For complex tasks (e.g., bulk state updates, parsing action logs, determining which TV the user meant based on state arrays, counting compound actions), the model is trained to output a reasoning trace before making the tool call. For direct explicit commands, it skips thinking entirely for speed. All thinking traces now end with explicitly formulated `ACTION REQUIRED.` triggers.
|
||||
|
||||
---
|
||||
|
||||
## Known Limitations
|
||||
|
||||
- **Temperature range is fixed at 60–80°F.** Requests outside this range produce a plain-text explanation, not a tool call.
|
||||
- **No brightness or colour control.** Dimming and colour-change requests correctly trigger `intent_unclear(reason='unsupported_feature')`. This is by design — the connected lights only support on/off.
|
||||
- **Local music library only.** The speaker control `media` parameter maps to specific tracks from a bounded internal list of artists and songs. Out-of-domain conversational queries will likely trigger `intent_unclear(reason='off_topic')`.
|
||||
- **English only.** All training data is English. Performance in other languages is untested.
|
||||
- **State must be accurate.** The model trusts `[STATE:]` completely. If your app sends stale state, the model may incorrectly say a device is already in the requested state or infer the wrong device during disambiguation.
|
||||
|
||||
---
|
||||
|
||||
## Citation
|
||||
|
||||
```bibtex
|
||||
@misc{lfm2-home-assistant-2025,
|
||||
author = {OrdenWills},
|
||||
title = {LFM2.5-350M Home Assistant: A Purpose-Trained Smart Home Automation Model},
|
||||
year = {2025},
|
||||
publisher = {HuggingFace},
|
||||
url = {https://huggingface.co/OrdenWills/LFM2.5-350M-home-assistant-sft}
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Acknowledgements
|
||||
|
||||
- [LiquidAI](https://www.liquid.ai/) for the incredible and highly capable LFM2.5-350M base model.
|
||||
- [Unsloth](https://github.com/unslothai/unsloth) for the fine-tuning framework.
|
||||
```
|
||||
64
chat_template.jinja
Normal file
64
chat_template.jinja
Normal file
@@ -0,0 +1,64 @@
|
||||
{{- bos_token -}}
|
||||
{%- set keep_past_thinking = keep_past_thinking | default(false) -%}
|
||||
{%- set ns = namespace(system_prompt="") -%}
|
||||
{%- if messages[0]["role"] == "system" -%}
|
||||
{%- set sys_content = messages[0]["content"] -%}
|
||||
{%- if sys_content is not string -%}
|
||||
{%- for item in sys_content -%}
|
||||
{%- if item["type"] == "text" -%}
|
||||
{%- set ns.system_prompt = ns.system_prompt + item["text"] -%}
|
||||
{%- endif -%}
|
||||
{%- endfor -%}
|
||||
{%- else -%}
|
||||
{%- set ns.system_prompt = sys_content -%}
|
||||
{%- endif -%}
|
||||
{%- set messages = messages[1:] -%}
|
||||
{%- endif -%}
|
||||
{%- if tools -%}
|
||||
{%- set ns.system_prompt = ns.system_prompt + ("\n" if ns.system_prompt else "") + "List of tools: [" -%}
|
||||
{%- for tool in tools -%}
|
||||
{%- if tool is not string -%}
|
||||
{%- set tool = tool | tojson -%}
|
||||
{%- endif -%}
|
||||
{%- set ns.system_prompt = ns.system_prompt + tool -%}
|
||||
{%- if not loop.last -%}
|
||||
{%- set ns.system_prompt = ns.system_prompt + ", " -%}
|
||||
{%- endif -%}
|
||||
{%- endfor -%}
|
||||
{%- set ns.system_prompt = ns.system_prompt + "]" -%}
|
||||
{%- endif -%}
|
||||
{%- if ns.system_prompt -%}
|
||||
{{- "<|im_start|>system\n" + ns.system_prompt + "<|im_end|>\n" -}}
|
||||
{%- endif -%}
|
||||
{%- set ns.last_assistant_index = -1 -%}
|
||||
{%- for message in messages -%}
|
||||
{%- if message["role"] == "assistant" -%}
|
||||
{%- set ns.last_assistant_index = loop.index0 -%}
|
||||
{%- endif -%}
|
||||
{%- endfor -%}
|
||||
{%- for message in messages -%}
|
||||
{{- "<|im_start|>" + message["role"] + "\n" -}}
|
||||
{%- set content = message["content"] -%}
|
||||
{%- if content is not string -%}
|
||||
{%- set ns.content = "" -%}
|
||||
{%- for item in content -%}
|
||||
{%- if item["type"] == "image" -%}
|
||||
{%- set ns.content = ns.content + "<image>" -%}
|
||||
{%- elif item["type"] == "text" -%}
|
||||
{%- set ns.content = ns.content + item["text"] -%}
|
||||
{%- else -%}
|
||||
{%- set ns.content = ns.content + item | tojson -%}
|
||||
{%- endif -%}
|
||||
{%- endfor -%}
|
||||
{%- set content = ns.content -%}
|
||||
{%- endif -%}
|
||||
{%- if message["role"] == "assistant" and not keep_past_thinking and loop.index0 != ns.last_assistant_index -%}
|
||||
{%- if "</think>" in content -%}
|
||||
{%- set content = content.split("</think>")[-1] | trim -%}
|
||||
{%- endif -%}
|
||||
{%- endif -%}
|
||||
{{- content + "<|im_end|>\n" -}}
|
||||
{%- endfor -%}
|
||||
{%- if add_generation_prompt -%}
|
||||
{{- "<|im_start|>assistant\n" -}}
|
||||
{%- endif -%}
|
||||
62
config.json
Normal file
62
config.json
Normal file
@@ -0,0 +1,62 @@
|
||||
{
|
||||
"architectures": [
|
||||
"Lfm2ForCausalLM"
|
||||
],
|
||||
"block_auto_adjust_ff_dim": true,
|
||||
"block_dim": 1024,
|
||||
"block_ffn_dim_multiplier": 1.0,
|
||||
"block_mlp_init_scale": 1.0,
|
||||
"block_multiple_of": 256,
|
||||
"block_norm_eps": 1e-05,
|
||||
"block_out_init_scale": 1.0,
|
||||
"block_use_swiglu": true,
|
||||
"block_use_xavier_init": true,
|
||||
"bos_token_id": 1,
|
||||
"conv_L_cache": 3,
|
||||
"conv_bias": false,
|
||||
"conv_dim": 1024,
|
||||
"conv_use_xavier_init": true,
|
||||
"dtype": "float16",
|
||||
"eos_token_id": 7,
|
||||
"full_attn_idxs": null,
|
||||
"hidden_size": 1024,
|
||||
"initializer_range": 0.02,
|
||||
"intermediate_size": 6656,
|
||||
"layer_types": [
|
||||
"conv",
|
||||
"conv",
|
||||
"full_attention",
|
||||
"conv",
|
||||
"conv",
|
||||
"full_attention",
|
||||
"conv",
|
||||
"conv",
|
||||
"full_attention",
|
||||
"conv",
|
||||
"full_attention",
|
||||
"conv",
|
||||
"full_attention",
|
||||
"conv",
|
||||
"full_attention",
|
||||
"conv"
|
||||
],
|
||||
"max_position_embeddings": 128000,
|
||||
"model_name": "LiquidAI/LFM2.5-350M",
|
||||
"model_type": "lfm2",
|
||||
"norm_eps": 1e-05,
|
||||
"num_attention_heads": 16,
|
||||
"num_heads": 16,
|
||||
"num_hidden_layers": 16,
|
||||
"num_key_value_heads": 8,
|
||||
"pad_token_id": 7,
|
||||
"rope_parameters": {
|
||||
"rope_theta": 1000000.0,
|
||||
"rope_type": "default"
|
||||
},
|
||||
"tie_word_embeddings": true,
|
||||
"transformers_version": "5.5.0",
|
||||
"unsloth_version": "2026.5.2",
|
||||
"use_cache": false,
|
||||
"use_pos_enc": true,
|
||||
"vocab_size": 64402
|
||||
}
|
||||
10
generation_config.json
Normal file
10
generation_config.json
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"_from_model_config": true,
|
||||
"bos_token_id": 1,
|
||||
"eos_token_id": [
|
||||
7
|
||||
],
|
||||
"max_length": 128000,
|
||||
"pad_token_id": 7,
|
||||
"transformers_version": "5.5.0"
|
||||
}
|
||||
3
model-q4_k_m.gguf
Normal file
3
model-q4_k_m.gguf
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:9a46078304aff50887d892f8fdfbb1237474f1cd10bbfc66cee2223f46307239
|
||||
size 229311584
|
||||
3
model.safetensors
Normal file
3
model.safetensors
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:aeb4fd96fc38d28796a3dfd656302f2e9900877050d77b9398be46c1068c5404
|
||||
size 706661880
|
||||
323830
tokenizer.json
Normal file
323830
tokenizer.json
Normal file
File diff suppressed because it is too large
Load Diff
4099
tokenizer_config.json
Normal file
4099
tokenizer_config.json
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user