Downloads · 30 days
11
7% of all-time downloads
andreagalasso99/Qwen3.5-4B-NL2SH
Qwen3.5-4B-NL2SH is a image-text-to-text model from andreagalasso99. Use it for the image-text-to-text task on the model card, and read the license before you ship it in a product. It is set up for transformers. The card lists the license as apache-2.0.
This model is a fine-tuned version of Qwen3.5-4B, optimized for converting natural language instructions into functional Linux shell commands.
Downloads · 30 days
11
7% of all-time downloads
All-time downloads
151
Public
Parameters
4.7B
9.3 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors9.3 GB · 100%
How the weights are stored.
BF164.7B · 100%
From the Hugging Face model README
This model is a fine-tuned version of Qwen3.5-4B, optimized for converting natural language instructions into functional Linux shell commands.
IMPORTANT: The model is still under evaluation, so be carefull when using it and always verify its output!
Model Details:
tags:
Direct Use
The model is designed to assist users in generating shell commands from natural language descriptions. It is particularly useful for:
Out-of-Scope Use
You can use the code below to run inference with the model:
from transformers import AutoModelForCausalLM, AutoTokenizer
model_id = "andreagalasso99/Qwen3.5-4B-NL2SH"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(model_id, device_map="auto")
SYSTEM_PROMPT = """You are a Linux System Automator. \
Your goal is to convert natural language instructions into precise, \
safe Bash commands. Given the following instruction, \
output a JSON object with two keys: 'command' (the string to execute) \
and 'safety_warning' (a string describing eventual risks, or 'none')."""
def generate_command(user_instruction):
messages = [
{"role": "system", "content": SYSTEM_PROMPT},
{"role": "user", "content": user_instruction},
]
# Apply ChatML template
prompt = tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True
)
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
outputs = model.generate(
**inputs,
max_new_tokens=128,
temperature=0.7,
do_sample=True,
pad_token_id=tokenizer.pad_token_id,
eos_token_id=tokenizer.eos_token_id
)
# Decode and extract only the new tokens
decoded_output = tokenizer.decode(outputs[0][inputs['input_ids'].shape[1]:], skip_special_tokens=True)
return decoded_output.strip()
# Example Usage
instruction = "Find all files in /home/user/ that end with .txt and count them."
response = generate_command(instruction)
print(response)
The model was trained on the NL2SH-ALPACA dataset ((https://huggingface.co/datasets/abandonedmonk/NL2SH-ALPACA). This dataset follows the Alpaca instruction format:
Hyperparameters
Tools & Frameworks
Hardware