| --- |
| language: |
| - en |
| - ko |
| library_name: transformers |
| pipeline_tag: text-generation |
| tags: |
| - terminal |
| - sft |
| - vllm |
| - tb2-lite |
| - evaluation-pending |
| base_model: unknown |
| --- |
| |
| # LLM-OS-Models/KoHRM-Text-1.4B |
|
|
| ํฐ๋ฏธ๋ ์์
์๋ํ๋ฅผ ์ํ Terminal SFT ๋ชจ๋ธ์
๋๋ค. ์
๋ ฅ๋ ์์
/์ด์ ํฐ๋ฏธ๋ ์ํ๋ฅผ ๋ณด๊ณ ๋ค์์ ์คํํ ๋ช
๋ น์ JSON ํํ๋ก ์์ฑํ๋ ์ฉ๋๋ก ํ์ตํ์ต๋๋ค. |
|
|
| ## ๋ชจ๋ธ ์์ฝ |
|
|
| - Base model: `unknown` |
| - Training setup: `Terminal SFT` |
| - Model card snapshot: `2026-05-23 09:04:40 UTC` |
| - Corrected TB2-lite evaluated results currently indexed: `56` |
| - Corrected TB2-lite score: `pending / not matched in current result directory` |
|
|
| ## Quickstart |
|
|
| ์ค์น์ ๋ก๊ทธ์ธ: |
|
|
| ```bash |
| pip install -U vllm transformers huggingface_hub |
| huggingface-cli login |
| ``` |
|
|
| ๊ด๋ จ ์ฝ๋: |
|
|
| - GitHub: https://github.com/LLM-OS-Models/Terminal |
| - vLLM ํ๊ฐ ์คํ: `tb2_lite/scripts/replay_eval.py` |
| - chat template/fallback ์์ฑ: `tb2_lite/scripts/prompt_builder.py` |
| - JSON/command ์ฑ์ : `tb2_lite/scripts/replay_metrics.py` |
|
|
| vLLM ์ง์ ์คํ ์์. ํ๊ฐ ์ฝ๋์ ๋์ผํ๊ฒ chat template์ ์ฐ์ ์ฌ์ฉํ๊ณ , template์ด ์์ผ๋ฉด ChatML/Gemma fallback์ ์ฌ์ฉํฉ๋๋ค. |
|
|
| ```python |
| from transformers import AutoTokenizer |
| from vllm import LLM, SamplingParams |
| |
| model_id = "LLM-OS-Models/KoHRM-Text-1.4B" |
| tp = 1 |
| |
| tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True) |
| llm = LLM( |
| model=model_id, |
| tokenizer=model_id, |
| trust_remote_code=True, |
| dtype="bfloat16", |
| tensor_parallel_size=tp, |
| max_model_len=49152, |
| gpu_memory_utilization=0.92, |
| ) |
| |
| messages = [ |
| {"role": "system", "content": "You are a terminal automation assistant. Return JSON only."}, |
| {"role": "user", "content": "Inspect the current directory and list Python files."}, |
| ] |
| |
| def render_chatml(messages): |
| parts = [] |
| for message in messages: |
| role = "assistant" if message["role"] == "assistant" else message["role"] |
| if role == "tool": |
| role = "user" |
| parts.append(f"<|im_start|>{role}\n{message['content']}<|im_end|>\n") |
| parts.append("<|im_start|>assistant\n") |
| return "".join(parts) |
| |
| def render_gemma4_turn(messages, empty_thought_channel=False): |
| parts = ["<bos>"] |
| for message in messages: |
| role = "model" if message["role"] == "assistant" else message["role"] |
| if role == "tool": |
| role = "user" |
| parts.append(f"<|turn>{role}\n{message['content'].strip()}<turn|>\n") |
| parts.append("<|turn>model\n") |
| if empty_thought_channel: |
| parts.append("<|channel>thought\n<channel|>") |
| return "".join(parts) |
| |
| def render_prompt(model_id, tokenizer, messages): |
| model_key = model_id.lower() |
| if "gemma-4" in model_key: |
| try: |
| return tokenizer.apply_chat_template( |
| messages, |
| tokenize=False, |
| add_generation_prompt=True, |
| enable_thinking=False, |
| ) |
| except Exception: |
| return render_gemma4_turn( |
| messages, |
| empty_thought_channel=("26b" in model_key or "31b" in model_key), |
| ) |
| try: |
| return tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True) |
| except Exception: |
| return render_chatml(messages) |
| |
| prompt = render_prompt(model_id, tokenizer, messages) |
| sampling = SamplingParams( |
| temperature=0.0, |
| top_p=1.0, |
| max_tokens=1024, |
| repetition_penalty=1.0, |
| ) |
| outputs = llm.generate([prompt], sampling_params=sampling) |
| print(outputs[0].outputs[0].text) |
| ``` |
|
|
| ๊ถ์ฅ ์ถ๋ ฅ ํ์: |
|
|
| ```json |
| { |
| "analysis": "brief reasoning about the next terminal action", |
| "plan": "short execution plan", |
| "commands": [ |
| {"keystrokes": "ls -la\n", "duration": 0.1} |
| ], |
| "task_complete": false |
| } |
| ``` |
|
|
| ํ๊ฐ์ ๋์ผํ replay ๋ช
๋ น: |
|
|
| ```bash |
| python tb2_lite/scripts/replay_eval.py \ |
| --model LLM-OS-Models/KoHRM-Text-1.4B \ |
| --model-short LLM-OS-Models__KoHRM-Text-1.4B \ |
| --eval-path tb2_lite/data/replay_full.jsonl \ |
| --output-dir /home/work/.data/tb2_lite_eval/corrected_readme_models_vllm \ |
| --dtype bfloat16 \ |
| --tp 1 \ |
| --max-model-len 49152 \ |
| --max-tokens 1024 \ |
| --temperature 0.0 \ |
| --top-p 1.0 \ |
| --gpu-memory-utilization 0.92 \ |
| --language-model-only |
| ``` |
|
|
| - ๊ธฐ๋ณธ ๊ถ์ฅ tensor parallel: `1`. OOM์ด๋ฉด `--tp`์ `tensor_parallel_size`๋ฅผ 2/4/8๋ก ์ฌ๋ฆฌ์ธ์. |
| - corrected TB2-lite ํ๊ฐ๋ `temperature=0.0`, `top_p=1.0`, `max_tokens=1024`๋ก ๊ณ ์ ํ์ต๋๋ค. |
| - Gemma 4๋ JSON ์ถ๋ ฅ์ ์ํด `enable_thinking=False`๋ฅผ ์ฌ์ฉํ๊ณ , 26B/31B ๊ณ์ด์ ํ๊ฐ ์ฝ๋์์ empty thought channel ์ฒ๋ฆฌ๋ฅผ ์๋ ์ ์ฉํฉ๋๋ค. |
|
|
| ## ํ๊ฐ ์ํ |
|
|
| - Current corrected TB2-lite score: `pending` |
| - Reason: ํ์ฌ `/home/work/.data/tb2_lite_eval/corrected_readme_models_vllm` ์ง๊ณ ๊ฒฐ๊ณผ์ ์ด HF repo๋ช
์ด ์ง์ ๋งค์นญ๋์ง ์์์ต๋๋ค. |
| - Next step: ๋์ผํ `tb2_lite/scripts/replay_eval.py` ๊ฒฝ๋ก๋ก ํ๊ฐ๋ฅผ ๋๋ฆฐ ๋ค ์ ์ ์นด๋๋ก ์๋ ๊ต์ฒดํฉ๋๋ค. |
|
|
| ## ๋ชจ๋ธ๊ตฐ ํด์ |
|
|
| - ์ด repo๋ ์์ง ํ์ฌ corrected TB2-lite ์ง๊ณ JSON๊ณผ ์ง์ ๋งค์นญ๋๋ ์ ์๊ฐ ์์ต๋๋ค. |
| - TB2-lite ์ ์๋ ์ผ๋ฐ ์ง๋ฅ ๋ฒค์น๋งํฌ๊ฐ ์๋๋ผ ํฐ๋ฏธ๋ next-action JSON ์ฌํ ๋ฅ๋ ฅ์ ์ธก์ ํฉ๋๋ค. |
| - ์์ฑ ๋ช
๋ น์ ์ค์ ์คํ ์ ์ sandbox, allowlist, human review ๊ฐ์ ์์ ์ฅ์น๋ฅผ ๊ฑฐ์ณ์ผ ํฉ๋๋ค. |
|
|