DiyRex/Llama-3.2-1B-nl2bash
033
Llama-3.2-1B-nl2bash
A fine-tuned version of mlx-community/Llama-3.2-1B-Instruct-4bit for converting natural language descriptions into bash commands.
Fine-tuned using LoRA via mlx-lm on Apple Silicon.
Training
Usage
With mlx-lm
pip install mlx-lmfrom mlx_lm import load, generate
model, tokenizer = load("devinxx/Llama-3.2-1B-nl2bash")
messages = [
{"role": "system", "content": "You are a bash expert. Convert the user's natural language description into a single bash command. Output only the bash command, no explanation."},
{"role": "user", "content": "find all python files modified in the last 7 days"},
]
prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
response = generate(model, tokenizer, prompt=prompt, max_tokens=128, verbose=False)
print(response)
# find . -name "*.py" -mtime -7CLI
mlx_lm.generate \
--model devinxx/Llama-3.2-1B-nl2bash \
--prompt "find all log files larger than 100MB"Example Outputs
Dataset
Training data: devinxx/nl2bash-combined
Combined from:
- jiacheng-ye/nl2bash — original NL2Bash corpus (Lin et al., LREC 2018)
- AnishJoshi/nl2bash-custom
Limitations
- Primarily covers common Unix/Linux file, text, and process operations
- Limited coverage of Docker, Kubernetes, cloud CLIs — the training data does not include these
- May produce incorrect flags or syntax for edge cases
- Always review generated commands before running, especially with rm, chmod, or destructive operations
License
Llama 3.2 Community License — see Meta's license terms.
