Team Ai
Modelpublic

DiyRex/Llama-3.2-1B-nl2bash

sourceHugging Facellama3.2updated 6mo agoView on Hugging Face
0likes33downloads
Model Card

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

PropertyValue
Base modelLlama-3.2-1B-Instruct (4-bit)
MethodLoRA (rank 8, 16 layers)
Datasetdevinxx/nl2bash-combined
Training examples27,748
Iterations2,000
Learning rate1e-4 (cosine decay)
HardwareApple Silicon (MLX)
Peak memory~2.9 GB

Usage

With mlx-lm

bash
pip install mlx-lm
python
from 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 -7

CLI

bash
mlx_lm.generate \
  --model devinxx/Llama-3.2-1B-nl2bash \
  --prompt "find all log files larger than 100MB"

Example Outputs

Natural LanguageCommand
find all python files modified in the last weekfind . -name "*.py" -mtime -7
list all running processes sorted by memoryps aux --sort=-%mem
count lines in all csv files recursively`find . -name "*.csv" \xargs wc -l`
show disk usage of current directory sorted by size`du -sh * \sort -rh`
compress a folder to tar.gztar -czf archive.tar.gz folder/

Dataset

Training data: devinxx/nl2bash-combined

Combined from:

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.