Instructions to use NickIBrody/qwen-linux with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Local Apps
- Unsloth Studio new
How to use NickIBrody/qwen-linux with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for NickIBrody/qwen-linux to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for NickIBrody/qwen-linux to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for NickIBrody/qwen-linux to start chatting
Load model with FastModel
pip install unsloth from unsloth import FastModel model, tokenizer = FastModel.from_pretrained( model_name="NickIBrody/qwen-linux", max_seq_length=2048, )
Update README.md
Browse files
README.md
CHANGED
|
@@ -1,21 +1,158 @@
|
|
| 1 |
---
|
| 2 |
-
base_model: unsloth/Qwen2.5-3B-Instruct-bnb-4bit
|
| 3 |
-
tags:
|
| 4 |
-
- text-generation-inference
|
| 5 |
-
- transformers
|
| 6 |
-
- unsloth
|
| 7 |
-
- qwen2
|
| 8 |
-
license: apache-2.0
|
| 9 |
language:
|
|
|
|
| 10 |
- en
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
---
|
| 12 |
|
| 13 |
-
#
|
| 14 |
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
|
| 19 |
-
|
| 20 |
|
| 21 |
-
|
|
|
|
| 1 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
language:
|
| 3 |
+
- ru
|
| 4 |
- en
|
| 5 |
+
license: apache-2.0
|
| 6 |
+
tags:
|
| 7 |
+
- linux
|
| 8 |
+
- shell
|
| 9 |
+
- qwen2
|
| 10 |
+
- unsloth
|
| 11 |
+
- gguf
|
| 12 |
+
base_model: Qwen/Qwen2.5-3B-Instruct
|
| 13 |
+
pipeline_tag: text-generation
|
| 14 |
+
---
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
# Qwen2.5-3B Linux Assistant
|
| 18 |
+
|
| 19 |
+
A fine-tuned version of [Qwen2.5-3B-Instruct](https://huggingface.co/Qwen/Qwen2.5-3B-Instruct) trained to act as a Linux/Shell command assistant. Given a natural language description, the model outputs the correct shell command.
|
| 20 |
+
|
| 21 |
+
Supports both **Russian** and **English** input.
|
| 22 |
+
|
| 23 |
+
---
|
| 24 |
+
|
| 25 |
+
## Model Details
|
| 26 |
+
|
| 27 |
+
| Property | Value |
|
| 28 |
+
|---|---|
|
| 29 |
+
| Base model | Qwen2.5-3B-Instruct |
|
| 30 |
+
| Fine-tuning method | QLoRA (LoRA r=16, alpha=16) |
|
| 31 |
+
| Training steps | ~1700 |
|
| 32 |
+
| Epochs | 3 |
|
| 33 |
+
| Final loss | ~0.28 |
|
| 34 |
+
| Dataset size | ~4500 examples |
|
| 35 |
+
| Languages | Russian, English |
|
| 36 |
+
| Framework | Unsloth + TRL |
|
| 37 |
+
|
| 38 |
---
|
| 39 |
|
| 40 |
+
## Usage
|
| 41 |
|
| 42 |
+
### Ollama (recommended)
|
| 43 |
+
```bash
|
| 44 |
+
ollama run hf.co/NickIBrody/qwen-linux-gguf
|
| 45 |
+
```
|
| 46 |
+
|
| 47 |
+
### llama.cpp
|
| 48 |
+
```bash
|
| 49 |
+
llama-cli -hf NickIBrody/qwen-linux-gguf --jinja
|
| 50 |
+
```
|
| 51 |
+
|
| 52 |
+
### Python (transformers)
|
| 53 |
+
```python
|
| 54 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 55 |
+
import torch
|
| 56 |
+
|
| 57 |
+
model_id = "NickIBrody/qwen-linux"
|
| 58 |
+
tok = AutoTokenizer.from_pretrained(model_id)
|
| 59 |
+
model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype=torch.float16, device_map="auto")
|
| 60 |
+
|
| 61 |
+
messages = [
|
| 62 |
+
{"role": "system", "content": "You are a Linux assistant. Reply only with the shell command, no explanations."},
|
| 63 |
+
{"role": "user", "content": "show top 5 processes by memory usage"},
|
| 64 |
+
]
|
| 65 |
+
inp = tok.apply_chat_template(messages, tokenize=True, add_generation_prompt=True, return_tensors="pt").to(model.device)
|
| 66 |
+
out = model.generate(inp, max_new_tokens=128, temperature=0.3)
|
| 67 |
+
print(tok.decode(out[0][inp.shape[1]:], skip_special_tokens=True))
|
| 68 |
+
```
|
| 69 |
+
|
| 70 |
+
---
|
| 71 |
+
|
| 72 |
+
## Examples
|
| 73 |
+
|
| 74 |
+
| Input | Output |
|
| 75 |
+
|---|---|
|
| 76 |
+
| показажи топ 5 процессов по памяти | `ps aux --sort=-%mem \| head -n 5` |
|
| 77 |
+
| где я нахожусь в терминале | `pwd` |
|
| 78 |
+
| compress file data.txt with bzip2 | `bzip2 data.txt` |
|
| 79 |
+
| show disk usage in human readable format | `df -h` |
|
| 80 |
+
| find all .log files modified in last 7 days | `find / -name "*.log" -mtime -7` |
|
| 81 |
+
| kill process by name nginx | `pkill nginx` |
|
| 82 |
+
| show open ports | `ss -tulnp` |
|
| 83 |
+
|
| 84 |
+
---
|
| 85 |
+
|
| 86 |
+
## Dataset
|
| 87 |
+
|
| 88 |
+
Training data: [NickIBrody/linux-commands-ru-en](https://huggingface.co/datasets/NickIBrody/linux-commands-ru-en)
|
| 89 |
+
|
| 90 |
+
~4500 shell command examples in Russian and English, covering:
|
| 91 |
+
- File system navigation and management
|
| 92 |
+
- Process management
|
| 93 |
+
- Networking
|
| 94 |
+
- Archive and compression
|
| 95 |
+
- System monitoring
|
| 96 |
+
- Package management
|
| 97 |
+
|
| 98 |
+
---
|
| 99 |
+
|
| 100 |
+
## Training Code
|
| 101 |
+
|
| 102 |
+
```python
|
| 103 |
+
from unsloth import FastLanguageModel
|
| 104 |
+
from unsloth.chat_templates import get_chat_template
|
| 105 |
+
from datasets import load_dataset
|
| 106 |
+
from trl import SFTTrainer
|
| 107 |
+
from transformers import TrainingArguments
|
| 108 |
+
|
| 109 |
+
model, tok = FastLanguageModel.from_pretrained(
|
| 110 |
+
"unsloth/Qwen2.5-3B-Instruct-bnb-4bit",
|
| 111 |
+
max_seq_length=2048,
|
| 112 |
+
load_in_4bit=True
|
| 113 |
+
)
|
| 114 |
+
|
| 115 |
+
model = FastLanguageModel.get_peft_model(
|
| 116 |
+
model, r=16, lora_alpha=16,
|
| 117 |
+
target_modules=["q_proj","k_proj","v_proj","o_proj","gate_proj","up_proj","down_proj"]
|
| 118 |
+
)
|
| 119 |
+
|
| 120 |
+
tok = get_chat_template(tok, chat_template="qwen-2.5")
|
| 121 |
+
|
| 122 |
+
ds = load_dataset("NickIBrody/linux-commands-ru-en", split="train")
|
| 123 |
+
ds = ds.map(lambda x: {"text": tok.apply_chat_template(x["messages"], tokenize=False)})
|
| 124 |
+
|
| 125 |
+
SFTTrainer(
|
| 126 |
+
model=model,
|
| 127 |
+
tokenizer=tok,
|
| 128 |
+
train_dataset=ds,
|
| 129 |
+
dataset_text_field="text",
|
| 130 |
+
max_seq_length=2048,
|
| 131 |
+
args=TrainingArguments(
|
| 132 |
+
per_device_train_batch_size=2,
|
| 133 |
+
gradient_accumulation_steps=4,
|
| 134 |
+
num_train_epochs=3,
|
| 135 |
+
learning_rate=2e-4,
|
| 136 |
+
fp16=True,
|
| 137 |
+
logging_steps=10,
|
| 138 |
+
output_dir="out",
|
| 139 |
+
optim="adamw_8bit"
|
| 140 |
+
)
|
| 141 |
+
).train()
|
| 142 |
+
|
| 143 |
+
model.save_pretrained_gguf("qwen-linux", tok, quantization_method="q4_k_m")
|
| 144 |
+
```
|
| 145 |
+
|
| 146 |
+
---
|
| 147 |
+
|
| 148 |
+
## Limitations
|
| 149 |
+
|
| 150 |
+
- Designed for shell commands only, not general conversation
|
| 151 |
+
- May struggle with highly complex multi-step scripts
|
| 152 |
+
- Best results with clear, specific prompts
|
| 153 |
+
|
| 154 |
+
---
|
| 155 |
|
| 156 |
+
## License
|
| 157 |
|
| 158 |
+
Apache 2.0
|