Views
No views yet
| Parameter | Value |
|---|---|
| Base model | Qwen/Qwen3-4B |
| Method | LoRA (r=32, α=16) |
| Learning rate | 1e-4 |
| Scheduler | Cosine with 3% warmup |
| Epochs | 2 |
| Effective batch size | 16 (4 × 4 accumulation) |
| Max sequence length | 2048 |
| Precision | bf16 |
| Target modules | q/k/v/o/gate/up/down_proj |
1from peft import AutoPeftModelForCausalLM
2from transformers import AutoTokenizer
3
4model = AutoPeftModelForCausalLM.from_pretrained("binga/style-mimic-qwen3-4b")
5tokenizer = AutoTokenizer.from_pretrained("binga/style-mimic-qwen3-4b")
6
7# Prepare style examples from the target person
8messages = [
9 {"role": "system", "content": "You are a writing style mimicry assistant. Given examples of a person's writing, generate new text in the same style. Attend to: tone, sentence structure, vocabulary, greetings/closings, punctuation, and common phrases."},
10 {"role": "user", "content": """Here are examples of this person's writing style:
11
12Example 1:
13\"\"\"
14Hey team! Quick update - wrapped up the dashboard redesign today. Looks slick if I do say so myself :) Let me know if you spot any bugs!
15\"\"\"
16
17Example 2:
18\"\"\"
19Just pushed the fix for that auth issue. Turned out to be a race condition in the token refresh logic. Classic Monday morning bug hunt lol
20\"\"\"
21
22Example 3:
23\"\"\"
24Heads up everyone - deploying to staging in 10 min. Should be smooth but keep an eye on the logs just in case. Coffee's on me if anything breaks!
25\"\"\"
26
27Now write in the same style for this task: Write a message about completing a code review"""},
28]
29
30text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
31inputs = tokenizer(text, return_tensors="pt").to(model.device)
32outputs = model.generate(**inputs, max_new_tokens=256, temperature=0.7, top_p=0.9)
33print(tokenizer.decode(outputs[0][inputs['input_ids'].shape[1]:], skip_special_tokens=True))