gyung commited on
Commit
ec065cf
ยท
verified ยท
1 Parent(s): acb41cd

Update model card with pending TB2-lite evaluation status

Browse files
Files changed (1) hide show
  1. README.md +130 -1
README.md CHANGED
@@ -21,10 +21,139 @@ base_model: LiquidAI/LFM2-8B
21
 
22
  - Base model: `LiquidAI/LFM2-8B`
23
  - Training setup: `2 epochs, Unsloth SFT`
24
- - Model card snapshot: `2026-05-08 16:04:13 UTC`
25
  - Corrected TB2-lite evaluated results currently indexed: `56`
26
  - Corrected TB2-lite score: `pending / not matched in current result directory`
27
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
28
  ## ํ‰๊ฐ€ ์ƒํƒœ
29
 
30
  - Current corrected TB2-lite score: `pending`
 
21
 
22
  - Base model: `LiquidAI/LFM2-8B`
23
  - Training setup: `2 epochs, Unsloth SFT`
24
+ - Model card snapshot: `2026-05-08 16:08:51 UTC`
25
  - Corrected TB2-lite evaluated results currently indexed: `56`
26
  - Corrected TB2-lite score: `pending / not matched in current result directory`
27
 
28
+ ## Quickstart
29
+
30
+ ์„ค์น˜์™€ ๋กœ๊ทธ์ธ:
31
+
32
+ ```bash
33
+ pip install -U vllm transformers huggingface_hub
34
+ huggingface-cli login
35
+ ```
36
+
37
+ ๊ด€๋ จ ์ฝ”๋“œ:
38
+
39
+ - GitHub: https://github.com/LLM-OS-Models/Terminal
40
+ - vLLM ํ‰๊ฐ€ ์‹คํ–‰: `tb2_lite/scripts/replay_eval.py`
41
+ - chat template/fallback ์ƒ์„ฑ: `tb2_lite/scripts/prompt_builder.py`
42
+ - JSON/command ์ฑ„์ : `tb2_lite/scripts/replay_metrics.py`
43
+
44
+ vLLM ์ง์ ‘ ์‹คํ–‰ ์˜ˆ์‹œ. ํ‰๊ฐ€ ์ฝ”๋“œ์™€ ๋™์ผํ•˜๊ฒŒ chat template์„ ์šฐ์„  ์‚ฌ์šฉํ•˜๊ณ , template์ด ์—†์œผ๋ฉด ChatML/Gemma fallback์„ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค.
45
+
46
+ ```python
47
+ from transformers import AutoTokenizer
48
+ from vllm import LLM, SamplingParams
49
+
50
+ model_id = "LLM-OS-Models/LFM2-8B-Terminal-SFT-2Epoch-Unsloth-7GPU"
51
+ tp = 1
52
+
53
+ tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
54
+ llm = LLM(
55
+ model=model_id,
56
+ tokenizer=model_id,
57
+ trust_remote_code=True,
58
+ dtype="bfloat16",
59
+ tensor_parallel_size=tp,
60
+ max_model_len=49152,
61
+ gpu_memory_utilization=0.92,
62
+ )
63
+
64
+ messages = [
65
+ {"role": "system", "content": "You are a terminal automation assistant. Return JSON only."},
66
+ {"role": "user", "content": "Inspect the current directory and list Python files."},
67
+ ]
68
+
69
+ def render_chatml(messages):
70
+ parts = []
71
+ for message in messages:
72
+ role = "assistant" if message["role"] == "assistant" else message["role"]
73
+ if role == "tool":
74
+ role = "user"
75
+ parts.append(f"<|im_start|>{role}\n{message['content']}<|im_end|>\n")
76
+ parts.append("<|im_start|>assistant\n")
77
+ return "".join(parts)
78
+
79
+ def render_gemma4_turn(messages, empty_thought_channel=False):
80
+ parts = ["<bos>"]
81
+ for message in messages:
82
+ role = "model" if message["role"] == "assistant" else message["role"]
83
+ if role == "tool":
84
+ role = "user"
85
+ parts.append(f"<|turn>{role}\n{message['content'].strip()}<turn|>\n")
86
+ parts.append("<|turn>model\n")
87
+ if empty_thought_channel:
88
+ parts.append("<|channel>thought\n<channel|>")
89
+ return "".join(parts)
90
+
91
+ def render_prompt(model_id, tokenizer, messages):
92
+ model_key = model_id.lower()
93
+ if "gemma-4" in model_key:
94
+ try:
95
+ return tokenizer.apply_chat_template(
96
+ messages,
97
+ tokenize=False,
98
+ add_generation_prompt=True,
99
+ enable_thinking=False,
100
+ )
101
+ except Exception:
102
+ return render_gemma4_turn(
103
+ messages,
104
+ empty_thought_channel=("26b" in model_key or "31b" in model_key),
105
+ )
106
+ try:
107
+ return tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
108
+ except Exception:
109
+ return render_chatml(messages)
110
+
111
+ prompt = render_prompt(model_id, tokenizer, messages)
112
+ sampling = SamplingParams(
113
+ temperature=0.0,
114
+ top_p=1.0,
115
+ max_tokens=1024,
116
+ repetition_penalty=1.0,
117
+ )
118
+ outputs = llm.generate([prompt], sampling_params=sampling)
119
+ print(outputs[0].outputs[0].text)
120
+ ```
121
+
122
+ ๊ถŒ์žฅ ์ถœ๋ ฅ ํ˜•์‹:
123
+
124
+ ```json
125
+ {
126
+ "analysis": "brief reasoning about the next terminal action",
127
+ "plan": "short execution plan",
128
+ "commands": [
129
+ {"keystrokes": "ls -la\n", "duration": 0.1}
130
+ ],
131
+ "task_complete": false
132
+ }
133
+ ```
134
+
135
+ ํ‰๊ฐ€์™€ ๋™์ผํ•œ replay ๋ช…๋ น:
136
+
137
+ ```bash
138
+ python tb2_lite/scripts/replay_eval.py \
139
+ --model LLM-OS-Models/LFM2-8B-Terminal-SFT-2Epoch-Unsloth-7GPU \
140
+ --model-short LLM-OS-Models__LFM2-8B-Terminal-SFT-2Epoch-Unsloth-7GPU \
141
+ --eval-path tb2_lite/data/replay_full.jsonl \
142
+ --output-dir /home/work/.data/tb2_lite_eval/corrected_readme_models_vllm \
143
+ --dtype bfloat16 \
144
+ --tp 1 \
145
+ --max-model-len 49152 \
146
+ --max-tokens 1024 \
147
+ --temperature 0.0 \
148
+ --top-p 1.0 \
149
+ --gpu-memory-utilization 0.92 \
150
+ --language-model-only
151
+ ```
152
+
153
+ - ๊ธฐ๋ณธ ๊ถŒ์žฅ tensor parallel: `1`. OOM์ด๋ฉด `--tp`์™€ `tensor_parallel_size`๋ฅผ 2/4/8๋กœ ์˜ฌ๋ฆฌ์„ธ์š”.
154
+ - corrected TB2-lite ํ‰๊ฐ€๋Š” `temperature=0.0`, `top_p=1.0`, `max_tokens=1024`๋กœ ๊ณ ์ •ํ–ˆ์Šต๋‹ˆ๋‹ค.
155
+ - Gemma 4๋Š” JSON ์ถœ๋ ฅ์„ ์œ„ํ•ด `enable_thinking=False`๋ฅผ ์‚ฌ์šฉํ•˜๊ณ , 26B/31B ๊ณ„์—ด์€ ํ‰๊ฐ€ ์ฝ”๋“œ์—์„œ empty thought channel ์ฒ˜๋ฆฌ๋ฅผ ์ž๋™ ์ ์šฉํ•ฉ๋‹ˆ๋‹ค.
156
+
157
  ## ํ‰๊ฐ€ ์ƒํƒœ
158
 
159
  - Current corrected TB2-lite score: `pending`