Text Generation
Transformers
Safetensors
English
Korean
lfm2_moe
terminal
sft
vllm
tb2-lite
conversational
Instructions to use LLM-OS-Models/LFM2-8B-Terminal-SFT-2Epoch-Unsloth with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use LLM-OS-Models/LFM2-8B-Terminal-SFT-2Epoch-Unsloth with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="LLM-OS-Models/LFM2-8B-Terminal-SFT-2Epoch-Unsloth") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("LLM-OS-Models/LFM2-8B-Terminal-SFT-2Epoch-Unsloth") model = AutoModelForCausalLM.from_pretrained("LLM-OS-Models/LFM2-8B-Terminal-SFT-2Epoch-Unsloth") 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
- vLLM
How to use LLM-OS-Models/LFM2-8B-Terminal-SFT-2Epoch-Unsloth with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "LLM-OS-Models/LFM2-8B-Terminal-SFT-2Epoch-Unsloth" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "LLM-OS-Models/LFM2-8B-Terminal-SFT-2Epoch-Unsloth", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/LLM-OS-Models/LFM2-8B-Terminal-SFT-2Epoch-Unsloth
- SGLang
How to use LLM-OS-Models/LFM2-8B-Terminal-SFT-2Epoch-Unsloth 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 "LLM-OS-Models/LFM2-8B-Terminal-SFT-2Epoch-Unsloth" \ --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": "LLM-OS-Models/LFM2-8B-Terminal-SFT-2Epoch-Unsloth", "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 "LLM-OS-Models/LFM2-8B-Terminal-SFT-2Epoch-Unsloth" \ --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": "LLM-OS-Models/LFM2-8B-Terminal-SFT-2Epoch-Unsloth", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use LLM-OS-Models/LFM2-8B-Terminal-SFT-2Epoch-Unsloth with Docker Model Runner:
docker model run hf.co/LLM-OS-Models/LFM2-8B-Terminal-SFT-2Epoch-Unsloth
Update model card with corrected TB2-lite evaluation
Browse files
README.md
ADDED
|
@@ -0,0 +1,144 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
language:
|
| 3 |
+
- en
|
| 4 |
+
- ko
|
| 5 |
+
library_name: transformers
|
| 6 |
+
pipeline_tag: text-generation
|
| 7 |
+
tags:
|
| 8 |
+
- terminal
|
| 9 |
+
- sft
|
| 10 |
+
- vllm
|
| 11 |
+
- tb2-lite
|
| 12 |
+
base_model: LiquidAI/LFM2-8B
|
| 13 |
+
---
|
| 14 |
+
|
| 15 |
+
# LLM-OS-Models/LFM2-8B-Terminal-SFT-2Epoch-Unsloth
|
| 16 |
+
|
| 17 |
+
ํฐ๋ฏธ๋ ์์
์๋ํ๋ฅผ ์ํ Terminal SFT ๋ชจ๋ธ์
๋๋ค. ์
๋ ฅ๋ ์์
/์ด์ ํฐ๋ฏธ๋ ์ํ๋ฅผ ๋ณด๊ณ ๋ค์์ ์คํํ ๋ช
๋ น์ JSON ํํ๋ก ์์ฑํ๋ ์ฉ๋๋ก ํ์ตํ์ต๋๋ค.
|
| 18 |
+
|
| 19 |
+
## ๋ชจ๋ธ ์์ฝ
|
| 20 |
+
|
| 21 |
+
- Base model: `LiquidAI/LFM2-8B`
|
| 22 |
+
- Training setup: `2 epochs, Unsloth SFT`
|
| 23 |
+
- Evaluation snapshot: `2026-05-07 22:36:37 UTC`
|
| 24 |
+
- Evaluation result id: `lfm2_8b_sft_unsloth_e2`
|
| 25 |
+
|
| 26 |
+
## ์ฌ์ฉ ๋ฐฉ๋ฒ
|
| 27 |
+
|
| 28 |
+
Transformers ์์:
|
| 29 |
+
|
| 30 |
+
```python
|
| 31 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 32 |
+
import torch
|
| 33 |
+
|
| 34 |
+
model_id = "LLM-OS-Models/LFM2-8B-Terminal-SFT-2Epoch-Unsloth"
|
| 35 |
+
tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
|
| 36 |
+
model = AutoModelForCausalLM.from_pretrained(
|
| 37 |
+
model_id,
|
| 38 |
+
torch_dtype=torch.bfloat16,
|
| 39 |
+
device_map="auto",
|
| 40 |
+
trust_remote_code=True,
|
| 41 |
+
)
|
| 42 |
+
|
| 43 |
+
messages = [
|
| 44 |
+
{"role": "system", "content": "You are a terminal automation assistant. Return JSON only."},
|
| 45 |
+
{"role": "user", "content": "List the current directory and identify Python files."},
|
| 46 |
+
]
|
| 47 |
+
prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
|
| 48 |
+
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
|
| 49 |
+
outputs = model.generate(**inputs, max_new_tokens=512, do_sample=False)
|
| 50 |
+
print(tokenizer.decode(outputs[0][inputs.input_ids.shape[-1]:], skip_special_tokens=False))
|
| 51 |
+
```
|
| 52 |
+
|
| 53 |
+
vLLM ์์:
|
| 54 |
+
|
| 55 |
+
```python
|
| 56 |
+
from vllm import LLM, SamplingParams
|
| 57 |
+
from transformers import AutoTokenizer
|
| 58 |
+
|
| 59 |
+
model_id = "LLM-OS-Models/LFM2-8B-Terminal-SFT-2Epoch-Unsloth"
|
| 60 |
+
tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
|
| 61 |
+
llm = LLM(model=model_id, dtype="bfloat16", trust_remote_code=True)
|
| 62 |
+
messages = [{"role": "user", "content": "Show disk usage for the current folder."}]
|
| 63 |
+
prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
|
| 64 |
+
result = llm.generate([prompt], SamplingParams(temperature=0.0, max_tokens=512))
|
| 65 |
+
print(result[0].outputs[0].text)
|
| 66 |
+
```
|
| 67 |
+
|
| 68 |
+
๊ถ์ฅ ์ถ๋ ฅ ํ์:
|
| 69 |
+
|
| 70 |
+
```json
|
| 71 |
+
{
|
| 72 |
+
"analysis": "brief reasoning about the next terminal action",
|
| 73 |
+
"plan": "short execution plan",
|
| 74 |
+
"commands": [
|
| 75 |
+
{"keystrokes": "ls -la\n", "duration": 0.1}
|
| 76 |
+
],
|
| 77 |
+
"task_complete": false
|
| 78 |
+
}
|
| 79 |
+
```
|
| 80 |
+
|
| 81 |
+
## ํ๊ฐ ๊ฒฐ๊ณผ
|
| 82 |
+
|
| 83 |
+
ํ๊ฐ๋ corrected TB2-lite replay set์์ vLLM์ผ๋ก ์ํํ์ต๋๋ค. ์์ ์ ์๋ `100 * avg_command_f1`๋ง ์ฌ์ฉํ๊ณ , `first_cmd_exact_pct`๋ ๋ณด์กฐ ์งํ๋ก๋ง ๋ด
๋๋ค.
|
| 84 |
+
|
| 85 |
+
- Rank: `28 / 41`
|
| 86 |
+
- Score: `27.33`
|
| 87 |
+
- Command F1: `0.2733`
|
| 88 |
+
- Command precision: `0.3526`
|
| 89 |
+
- Command recall: `0.2872`
|
| 90 |
+
- First command exact: `24.1%`
|
| 91 |
+
- Valid JSON: `62.0%`
|
| 92 |
+
- Steps / tasks: `303 / 50`
|
| 93 |
+
- Template status: `chat_template`
|
| 94 |
+
- Rank eligible: `True`
|
| 95 |
+
- Eval timestamp: `2026-05-07T21:54:41.049014`
|
| 96 |
+
- ํ์ฌ ์ง๊ณ๋ ํ๊ฐ ๊ฒฐ๊ณผ ์: `41`
|
| 97 |
+
|
| 98 |
+
์ฌํ ๋ช
๋ น ์์:
|
| 99 |
+
|
| 100 |
+
```bash
|
| 101 |
+
python tb2_lite/scripts/replay_eval.py \
|
| 102 |
+
--model LLM-OS-Models/LFM2-8B-Terminal-SFT-2Epoch-Unsloth \
|
| 103 |
+
--model-short lfm2_8b_sft_unsloth_e2 \
|
| 104 |
+
--eval-path tb2_lite/data/replay_full.jsonl \
|
| 105 |
+
--output-dir /home/work/.data/tb2_lite_eval/corrected_readme_models_vllm \
|
| 106 |
+
--dtype bfloat16 \
|
| 107 |
+
--max-model-len 49152 \
|
| 108 |
+
--max-tokens 1024 \
|
| 109 |
+
--temperature 0.0 \
|
| 110 |
+
--top-p 1.0 \
|
| 111 |
+
--gpu-memory-utilization 0.94 \
|
| 112 |
+
--language-model-only
|
| 113 |
+
```
|
| 114 |
+
|
| 115 |
+
Prompt/template audit:
|
| 116 |
+
|
| 117 |
+
```json
|
| 118 |
+
{
|
| 119 |
+
"template_status": "chat_template",
|
| 120 |
+
"rank_eligible": true,
|
| 121 |
+
"steps": 303,
|
| 122 |
+
"tasks": 50
|
| 123 |
+
}
|
| 124 |
+
```
|
| 125 |
+
|
| 126 |
+
## ์ฅ์
|
| 127 |
+
|
| 128 |
+
- ํน์ ํฌ๊ธฐ/๊ฐ์ ๊ฒฝ๋ก์์ ๋น์ฉ ๋๋น ๋น ๋ฅธ ์ถ๋ก ์ ๊ธฐ๋ํ ์ ์์ต๋๋ค.
|
| 129 |
+
- ์๋ชป๋ ๋ช
๋ น์ ๋ง์ด ๋ด๊ธฐ๋ณด๋ค ๋ณด์์ ์ผ๋ก ๋ง๋ ๋ช
๋ น์ ๋ด๋ ๊ฒฝํฅ์ด ์์ต๋๋ค.
|
| 130 |
+
- LFM ๊ณ์ด์ Liquid chat template๊ณผ ํฐ๋ฏธ๋ SFT ํฌ๋งท์ ๋ง์ถ ๊ฒฝ๋/ํจ์จ ์คํ์ ์ ๋ฆฌํฉ๋๋ค.
|
| 131 |
+
|
| 132 |
+
## ํ๊ณ์ ์ฃผ์์ฌํญ
|
| 133 |
+
|
| 134 |
+
- recall์ด ์๋์ ์ผ๋ก ๋ฎ์ ํ์ํ ๋ช
๋ น ์ผ๋ถ๋ฅผ ๋น ๋จ๋ฆด ์ ์์ต๋๋ค.
|
| 135 |
+
- JSON ํ์ ์คํจ๊ฐ ์์ด ์คํ ์ ์ ํ์ฑ ๊ฒ์ฆ/์ฌ์๋๊ฐ ํ์ํฉ๋๋ค.
|
| 136 |
+
- Qwen ์์๊ถ ๋๋น command F1์ด ๋ฎ๊ฒ ๋์จ ๊ฒฐ๊ณผ๋ ์ง๋ฅ ์ฐจ์ด์ ํจ๊ป ํฌ๋งท, ํ ํฌ๋์ด์ , ํ์ต ๊ฒฝ๋ก ์ฐจ์ด๊ฐ ์์ธ ๊ฐ์
๋๋ค.
|
| 137 |
+
- ์ด ๋ชจ๋ธ์ ์๋ ํฐ๋ฏธ๋ ์กฐ์ ๋ณด์กฐ์ฉ SFT ๋ชจ๋ธ์ด๋ฉฐ, ์ผ๋ฐ ๋ํ/๋ฒ์ฉ ์ถ๋ก ์ฑ๋ฅ์ ๋ณด์ฅํ์ง ์์ต๋๋ค.
|
| 138 |
+
- ์์ฑ ๋ช
๋ น์ ์ค์ ์คํ ์ ์ sandbox, allowlist, human review ๊ฐ์ ์์ ์ฅ์น๋ฅผ ๊ฑฐ์ณ์ผ ํฉ๋๋ค.
|
| 139 |
+
|
| 140 |
+
## ํด์ ๋ฉ๋ชจ
|
| 141 |
+
|
| 142 |
+
TB2-lite ์ ์๋ ์ผ๋ฐ ์ง๋ฅ ๋ฒค์น๋งํฌ๊ฐ ์๋๋ผ ํฐ๋ฏธ๋ next-action JSON ์ฌํ ๋ฅ๋ ฅ์ ์ธก์ ํฉ๋๋ค. ๋ฐ๋ผ์ ๋ชจ๋ธ ํฌ๊ธฐ, chat template ์ผ์น, assistant-only masking, tokenizer, ํ์ต ๋ฐ์ดํฐ holdout ์ฌ๋ถ๊ฐ ๋ชจ๋ ์ ์์ ์ํฅ์ ์ค๋๋ค.
|
| 143 |
+
|
| 144 |
+
README.md์ MODEL_EVALUATION_REPORT.md์ ๊ฐ์ด ๋ ์ต์ ์ด๋ฉด ํด๋น ๊ฐ์ ์ฐ์ ํ์ธํ์ธ์. ์ด ๋ชจ๋ธ์นด๋๋ ์๋ฃ๋ ํ๊ฐ JSON์ ๊ธฐ์ค์ผ๋ก ๊ฐ๋ณ ์ ์ฅ์์ ๏ฟฝ๏ฟฝ๏ฟฝ๋ฅด๊ฒ ๋ฐ์ํ ์ค๋
์ท์
๋๋ค.
|