Text Generation
Transformers
Safetensors
English
Korean
lfm2_moe
terminal
sft
vllm
tb2-lite
evaluated
toolbench
conversational
Instructions to use LLM-OS-Models/LFM2.5-8B-A1B-Terminal-ToolBench-Full-SFT-1Epoch with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use LLM-OS-Models/LFM2.5-8B-A1B-Terminal-ToolBench-Full-SFT-1Epoch with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="LLM-OS-Models/LFM2.5-8B-A1B-Terminal-ToolBench-Full-SFT-1Epoch") 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.5-8B-A1B-Terminal-ToolBench-Full-SFT-1Epoch") model = AutoModelForCausalLM.from_pretrained("LLM-OS-Models/LFM2.5-8B-A1B-Terminal-ToolBench-Full-SFT-1Epoch") 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 Settings
- vLLM
How to use LLM-OS-Models/LFM2.5-8B-A1B-Terminal-ToolBench-Full-SFT-1Epoch 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.5-8B-A1B-Terminal-ToolBench-Full-SFT-1Epoch" # 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.5-8B-A1B-Terminal-ToolBench-Full-SFT-1Epoch", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/LLM-OS-Models/LFM2.5-8B-A1B-Terminal-ToolBench-Full-SFT-1Epoch
- SGLang
How to use LLM-OS-Models/LFM2.5-8B-A1B-Terminal-ToolBench-Full-SFT-1Epoch 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.5-8B-A1B-Terminal-ToolBench-Full-SFT-1Epoch" \ --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.5-8B-A1B-Terminal-ToolBench-Full-SFT-1Epoch", "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.5-8B-A1B-Terminal-ToolBench-Full-SFT-1Epoch" \ --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.5-8B-A1B-Terminal-ToolBench-Full-SFT-1Epoch", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use LLM-OS-Models/LFM2.5-8B-A1B-Terminal-ToolBench-Full-SFT-1Epoch with Docker Model Runner:
docker model run hf.co/LLM-OS-Models/LFM2.5-8B-A1B-Terminal-ToolBench-Full-SFT-1Epoch
LLM-OS-Models/LFM2.5-8B-A1B-Terminal-ToolBench-Full-SFT-1Epoch
터미널 작업 자동화를 위한 Terminal SFT 모델입니다. 입력된 작업/이전 터미널 상태를 보고 다음에 실행할 명령을 JSON 형태로 생성하는 용도로 학습했습니다.
모델 요약
- Base model:
LiquidAI/LFM2.5-8B-A1B - Training setup: full SFT,
1 epoch, Terminal + ToolBench conversation data - Model card snapshot:
2026-06-04 23:09:57 UTC - Corrected TB2-lite score:
52.30 - Rank at publication:
#1in the local Terminal README ranking
Quickstart
설치와 로그인:
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을 사용합니다.
from transformers import AutoTokenizer
from vllm import LLM, SamplingParams
model_id = "LLM-OS-Models/LFM2.5-8B-A1B-Terminal-ToolBench-Full-SFT-1Epoch"
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)
권장 출력 형식:
{
"analysis": "brief reasoning about the next terminal action",
"plan": "short execution plan",
"commands": [
{"keystrokes": "ls -la\n", "duration": 0.1}
],
"task_complete": false
}
평가와 동일한 replay 명령:
python tb2_lite/scripts/replay_eval.py \
--model LLM-OS-Models/LFM2.5-8B-A1B-Terminal-ToolBench-Full-SFT-1Epoch \
--model-short LLM-OS-Models__LFM2.5-8B-A1B-Terminal-ToolBench-Full-SFT-1Epoch \
--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 처리를 자동 적용합니다.
평가 상태
- Corrected TB2-lite score:
52.30 - Cmd F1:
0.5230 - Precision:
0.5854 - Recall:
0.5431 - First command exact:
49.5% - Valid JSON:
76.9% - Sec/Step:
0.087 - Evaluation split: corrected TB2-lite full replay,
303/303steps - Result JSON:
tb2_lite/results/20260605T_live_hrm_lora_lfm_epoch1/LFM2.5-8B-A1B-terminal-toolbench-full-1epoch-checkpoint-1542.json
모델군 해석
- 이 1epoch checkpoint는 corrected TB2-lite 기준 Score
52.30으로 업로드 시점의 Terminal README 전체 1위입니다. - 같은 run의 2epoch checkpoint Score
50.48보다+1.82높았습니다. 2epoch는 command coverage가 약간 줄고 JSON 안정성도 조금 낮아져, 이 데이터 구성에서는 1epoch가 더 좋은 선택입니다. - 강점은 command coverage입니다. Recall
0.5431과 Precision0.5854가 같이 높아, 기존 30~40점대 모델보다 정답 command set을 더 넓게 복원합니다. - 약점은 완전한 JSON 안정성입니다. Valid JSON
76.9%라 strong baseline이지만, invalid JSON과 empty command case는 후속 JSON-only target 정제로 더 줄일 수 있습니다. - TB2-lite 점수는 일반 지능 벤치마크가 아니라 터미널 next-action JSON 재현 능력을 측정합니다.
- 생성 명령은 실제 실행 전에 sandbox, allowlist, human review 같은 안전장치를 거쳐야 합니다.
- Downloads last month
- 8,848
Model tree for LLM-OS-Models/LFM2.5-8B-A1B-Terminal-ToolBench-Full-SFT-1Epoch
Base model
LiquidAI/LFM2.5-8B-A1B-Base Finetuned
LiquidAI/LFM2.5-8B-A1B