Views
No views yet
| Property | Value |
|---|---|
| Base model | Qwen2.5-3B-Instruct |
| Fine-tuning method | QLoRA (LoRA r=16, alpha=16) |
| Training steps | ~1700 |
| Epochs | 3 |
| Final loss | ~0.28 |
| Dataset size | ~4500 examples |
| Languages | Russian, English |
| Framework | Unsloth + TRL |
ollama run hf.co/NickIBrody/qwen-linux-ggufllama-cli -hf NickIBrody/qwen-linux-gguf --jinja1from transformers import AutoModelForCausalLM, AutoTokenizer
2import torch
3
4model_id = "NickIBrody/qwen-linux"
5tok = AutoTokenizer.from_pretrained(model_id)
6model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype=torch.float16, device_map="auto")
7
8messages = [
9 {"role": "system", "content": "You are a Linux assistant. Reply only with the shell command, no explanations."},
10 {"role": "user", "content": "show top 5 processes by memory usage"},
11]
12inp = tok.apply_chat_template(messages, tokenize=True, add_generation_prompt=True, return_tensors="pt").to(model.device)
13out = model.generate(inp, max_new_tokens=128, temperature=0.3)
14print(tok.decode(out[0][inp.shape[1]:], skip_special_tokens=True))| Input | Output |
|---|---|
| показажи топ 5 процессов по памяти | ps aux --sort=-%mem | head -n 5 |
| где я нахожусь в терминале | pwd |
| compress file data.txt with bzip2 | bzip2 data.txt |
| show disk usage in human readable format | df -h |
| find all .log files modified in last 7 days | find / -name "*.log" -mtime -7 |
| kill process by name nginx | pkill nginx |
| show open ports | ss -tulnp |
1from unsloth import FastLanguageModel
2from unsloth.chat_templates import get_chat_template
3from datasets import load_dataset
4from trl import SFTTrainer
5from transformers import TrainingArguments
6
7model, tok = FastLanguageModel.from_pretrained(
8 "unsloth/Qwen2.5-3B-Instruct-bnb-4bit",
9 max_seq_length=2048,
10 load_in_4bit=True
11)
12
13model = FastLanguageModel.get_peft_model(
14 model, r=16, lora_alpha=16,
15 target_modules=["q_proj","k_proj","v_proj","o_proj","gate_proj","up_proj","down_proj"]
16)
17
18tok = get_chat_template(tok, chat_template="qwen-2.5")
19
20ds = load_dataset("NickIBrody/linux-commands-ru-en", split="train")
21ds = ds.map(lambda x: {"text": tok.apply_chat_template(x["messages"], tokenize=False)})
22
23SFTTrainer(
24 model=model,
25 tokenizer=tok,
26 train_dataset=ds,
27 dataset_text_field="text",
28 max_seq_length=2048,
29 args=TrainingArguments(
30 per_device_train_batch_size=2,
31 gradient_accumulation_steps=4,
32 num_train_epochs=3,
33 learning_rate=2e-4,
34 fp16=True,
35 logging_steps=10,
36 output_dir="out",
37 optim="adamw_8bit"
38 )
39).train()
40
41model.save_pretrained_gguf("qwen-linux", tok, quantization_method="q4_k_m")