Text Generation
Transformers
Safetensors
English
lfm2
linux
bash
shell
command-generation
conversational
Instructions to use thealper2/lfm2-700m-linux-command with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use thealper2/lfm2-700m-linux-command with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="thealper2/lfm2-700m-linux-command") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("thealper2/lfm2-700m-linux-command") model = AutoModelForCausalLM.from_pretrained("thealper2/lfm2-700m-linux-command", device_map="auto") 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=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use thealper2/lfm2-700m-linux-command with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "thealper2/lfm2-700m-linux-command" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "thealper2/lfm2-700m-linux-command", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/thealper2/lfm2-700m-linux-command
- SGLang
How to use thealper2/lfm2-700m-linux-command 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 "thealper2/lfm2-700m-linux-command" \ --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": "thealper2/lfm2-700m-linux-command", "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 "thealper2/lfm2-700m-linux-command" \ --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": "thealper2/lfm2-700m-linux-command", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use thealper2/lfm2-700m-linux-command with Docker Model Runner:
docker model run hf.co/thealper2/lfm2-700m-linux-command
Download resolved_config.json from thealper2/lfm2-700m-linux-command: direct link, hf CLI and curl.
- Browser
- Download file 2.8 kB
-
https://huggingface.co/thealper2/lfm2-700m-linux-command/resolve/main/resolved_config.json
- Command line
-
hf download hf://thealper2/lfm2-700m-linux-command/resolved_config.json
-
curl -L -o resolved_config.json https://huggingface.co/thealper2/lfm2-700m-linux-command/resolve/main/resolved_config.json
2.8 kB
| { | |
| "paths": { | |
| "data_dir": "data", | |
| "raw_dir": "data/raw", | |
| "processed_dir": "data/processed", | |
| "train_dir": "data/train", | |
| "validation_dir": "data/validation", | |
| "test_dir": "data/test", | |
| "reports_dir": "reports", | |
| "outputs_dir": "outputs" | |
| }, | |
| "data": { | |
| "nl2bash_repo": "jiacheng-ye/nl2bash", | |
| "linux_commands_repo": "mecha-org/linux-command-dataset", | |
| "nl2bash_archive_url": "https://www.dropbox.com/s/wy7uahzbir7lrq1/nl2bash.zip?dl=1", | |
| "min_instruction_chars": 5, | |
| "min_command_chars": 2, | |
| "max_instruction_chars": 600, | |
| "max_command_chars": 600, | |
| "head_command_cap": 2500, | |
| "exact_command_cap": 40, | |
| "near_duplicate_threshold": 0.9, | |
| "drop_near_duplicates": false, | |
| "split_grouping": "template", | |
| "train_ratio": 0.9, | |
| "validation_ratio": 0.05, | |
| "test_ratio": 0.05, | |
| "seed": 42 | |
| }, | |
| "model": { | |
| "model_name": "LiquidAI/LFM2-700M", | |
| "dtype": "bfloat16", | |
| "attn_implementation": "sdpa", | |
| "system_prompt": null, | |
| "max_length": 128, | |
| "trust_remote_code": false | |
| }, | |
| "lora": { | |
| "r": 32, | |
| "alpha": 64, | |
| "dropout": 0.05, | |
| "target_modules": [ | |
| "q_proj", | |
| "k_proj", | |
| "v_proj", | |
| "out_proj", | |
| "w1", | |
| "w2", | |
| "w3", | |
| "in_proj" | |
| ], | |
| "exclude_modules": [ | |
| "conv.conv" | |
| ], | |
| "modules_to_save": [] | |
| }, | |
| "training": { | |
| "method": "full", | |
| "output_dir": "outputs/lfm2-linux-command", | |
| "run_name": "lfm2-700m-linux-command", | |
| "num_train_epochs": 3, | |
| "per_device_train_batch_size": 16, | |
| "per_device_eval_batch_size": 32, | |
| "gradient_accumulation_steps": 2, | |
| "learning_rate": 3e-05, | |
| "lr_scheduler_type": "cosine", | |
| "warmup_ratio": 0.03, | |
| "weight_decay": 0.01, | |
| "max_grad_norm": 1.0, | |
| "optim": "adamw_torch_fused", | |
| "adam_beta1": 0.9, | |
| "adam_beta2": 0.95, | |
| "adam_epsilon": 1e-08, | |
| "bf16": true, | |
| "fp16": false, | |
| "gradient_checkpointing": false, | |
| "group_by_length": true, | |
| "logging_steps": 20, | |
| "eval_strategy": "epoch", | |
| "save_strategy": "epoch", | |
| "save_total_limit": 2, | |
| "load_best_model_at_end": true, | |
| "metric_for_best_model": "eval_loss", | |
| "greater_is_better": false, | |
| "early_stopping_patience": 2, | |
| "dataloader_num_workers": 4, | |
| "seed": 42, | |
| "report_to": [] | |
| }, | |
| "generation": { | |
| "max_new_tokens": 128, | |
| "do_sample": false, | |
| "temperature": 1.0, | |
| "top_p": 1.0, | |
| "num_beams": 1, | |
| "repetition_penalty": 1.0, | |
| "batch_size": 32 | |
| }, | |
| "evaluation": { | |
| "limit": null, | |
| "execute_in_sandbox": false, | |
| "sandbox_image": "linux-cmd-sandbox:latest", | |
| "sandbox_timeout_s": 10, | |
| "sandbox_memory": "256m", | |
| "sandbox_cpus": "1.0", | |
| "sandbox_pids_limit": 128, | |
| "sandbox_network": false, | |
| "max_execution_examples": 200 | |
| } | |
| } |