NickIBrody commited on
Commit
a5485ca
·
verified ·
1 Parent(s): 391d987

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +134 -15
README.md CHANGED
@@ -1,23 +1,142 @@
 
 
 
 
 
 
1
  ---
2
- tags:
3
- - gguf
4
- - llama.cpp
5
- - unsloth
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
 
7
  ---
8
 
9
- # qwen-linux-gguf : GGUF
10
 
11
- This model was finetuned and converted to GGUF format using [Unsloth](https://github.com/unslothai/unsloth).
12
 
13
- **Example usage**:
14
- - For text only LLMs: `llama-cli -hf NickIBrody/qwen-linux-gguf --jinja`
15
- - For multimodal models: `llama-mtmd-cli -hf NickIBrody/qwen-linux-gguf --jinja`
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
 
17
- ## Available Model files:
18
- - `Qwen2.5-3B-Instruct.Q4_K_M.gguf`
19
 
20
- ## Ollama
21
- An Ollama Modelfile is included for easy deployment.
22
- This was trained 2x faster with [Unsloth](https://github.com/unslothai/unsloth)
23
- [<img src="https://raw.githubusercontent.com/unslothai/unsloth/main/images/unsloth%20made%20with%20love.png" width="200"/>](https://github.com/unslothai/unsloth)
 
1
+ # Qwen2.5-3B Linux Assistant
2
+
3
+ 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.
4
+
5
+ Supports both **Russian** and **English** input.
6
+
7
  ---
8
+
9
+ ## Model Details
10
+
11
+ | Property | Value |
12
+ |---|---|
13
+ | Base model | Qwen2.5-3B-Instruct |
14
+ | Fine-tuning method | QLoRA (LoRA r=16, alpha=16) |
15
+ | Training steps | ~1700 |
16
+ | Epochs | 3 |
17
+ | Final loss | ~0.28 |
18
+ | Dataset size | ~4500 examples |
19
+ | Languages | Russian, English |
20
+ | Framework | Unsloth + TRL |
21
+
22
+ ---
23
+
24
+ ## Usage
25
+
26
+ ### Ollama (recommended)
27
+ ```bash
28
+ ollama run hf.co/NickIBrody/qwen-linux-gguf
29
+ ```
30
+
31
+ ### llama.cpp
32
+ ```bash
33
+ llama-cli -hf NickIBrody/qwen-linux-gguf --jinja
34
+ ```
35
+
36
+ ### Python (transformers)
37
+ ```python
38
+ from transformers import AutoModelForCausalLM, AutoTokenizer
39
+ import torch
40
+
41
+ model_id = "NickIBrody/qwen-linux"
42
+ tok = AutoTokenizer.from_pretrained(model_id)
43
+ model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype=torch.float16, device_map="auto")
44
+
45
+ messages = [
46
+ {"role": "system", "content": "You are a Linux assistant. Reply only with the shell command, no explanations."},
47
+ {"role": "user", "content": "show top 5 processes by memory usage"},
48
+ ]
49
+ inp = tok.apply_chat_template(messages, tokenize=True, add_generation_prompt=True, return_tensors="pt").to(model.device)
50
+ out = model.generate(inp, max_new_tokens=128, temperature=0.3)
51
+ print(tok.decode(out[0][inp.shape[1]:], skip_special_tokens=True))
52
+ ```
53
+
54
+ ---
55
+
56
+ ## Examples
57
+
58
+ | Input | Output |
59
+ |---|---|
60
+ | показажи топ 5 процессов по памяти | `ps aux --sort=-%mem \| head -n 5` |
61
+ | где я нахожусь в терминале | `pwd` |
62
+ | compress file data.txt with bzip2 | `bzip2 data.txt` |
63
+ | show disk usage in human readable format | `df -h` |
64
+ | find all .log files modified in last 7 days | `find / -name "*.log" -mtime -7` |
65
+ | kill process by name nginx | `pkill nginx` |
66
+ | show open ports | `ss -tulnp` |
67
 
68
  ---
69
 
70
+ ## Dataset
71
 
72
+ Training data: [NickIBrody/linux-commands-ru-en](https://huggingface.co/datasets/NickIBrody/linux-commands-ru-en)
73
 
74
+ ~4500 shell command examples in Russian and English, covering:
75
+ - File system navigation and management
76
+ - Process management
77
+ - Networking
78
+ - Archive and compression
79
+ - System monitoring
80
+ - Package management
81
+
82
+ ---
83
+
84
+ ## Training Code
85
+
86
+ ```python
87
+ from unsloth import FastLanguageModel
88
+ from unsloth.chat_templates import get_chat_template
89
+ from datasets import load_dataset
90
+ from trl import SFTTrainer
91
+ from transformers import TrainingArguments
92
+
93
+ model, tok = FastLanguageModel.from_pretrained(
94
+ "unsloth/Qwen2.5-3B-Instruct-bnb-4bit",
95
+ max_seq_length=2048,
96
+ load_in_4bit=True
97
+ )
98
+
99
+ model = FastLanguageModel.get_peft_model(
100
+ model, r=16, lora_alpha=16,
101
+ target_modules=["q_proj","k_proj","v_proj","o_proj","gate_proj","up_proj","down_proj"]
102
+ )
103
+
104
+ tok = get_chat_template(tok, chat_template="qwen-2.5")
105
+
106
+ ds = load_dataset("NickIBrody/linux-commands-ru-en", split="train")
107
+ ds = ds.map(lambda x: {"text": tok.apply_chat_template(x["messages"], tokenize=False)})
108
+
109
+ SFTTrainer(
110
+ model=model,
111
+ tokenizer=tok,
112
+ train_dataset=ds,
113
+ dataset_text_field="text",
114
+ max_seq_length=2048,
115
+ args=TrainingArguments(
116
+ per_device_train_batch_size=2,
117
+ gradient_accumulation_steps=4,
118
+ num_train_epochs=3,
119
+ learning_rate=2e-4,
120
+ fp16=True,
121
+ logging_steps=10,
122
+ output_dir="out",
123
+ optim="adamw_8bit"
124
+ )
125
+ ).train()
126
+
127
+ model.save_pretrained_gguf("qwen-linux", tok, quantization_method="q4_k_m")
128
+ ```
129
+
130
+ ---
131
+
132
+ ## Limitations
133
+
134
+ - Designed for shell commands only, not general conversation
135
+ - May struggle with highly complex multi-step scripts
136
+ - Best results with clear, specific prompts
137
+
138
+ ---
139
 
140
+ ## License
 
141
 
142
+ Apache 2.0