Views
No views yet
| Base | Qwen/Qwen3.6-27B (dense) |
| LoRA rank / α | 32 / 64 |
| Targets | q/k/v/o_proj + MLP (gate/up/down_proj) |
| Eval loss | 1.769 (5 epochs; vs 1.869 for v0.3-9B, 2.802 for v0.2) |
[HH:MM]
stamps, in-character jailbreak deflection, natural sticker usage, ~3x more
concise than v0.3.<think>
{Chinese inner monologue — optional}
</think>
[19:05] 晚上好呀
[19:06] [[sticker:挠头]]
[19:06] 在忙吗?[HH:MM] stamps encode the reply
pacing (story-world clock — use deltas to drive typing delays, display
wall-clock time). Resolve [[sticker:ref]] against your sticker catalog.1import torch
2import transformers
3from peft import PeftModel
4from transformers import AutoTokenizer, AutoConfig
5
6BASE = "Qwen/Qwen3.6-27B"
7ADAPTER = "s-g-labs/linlu-lora-v0.4-qwen3.6-27b"
8
9# Use the exact architecture class — AutoModelForCausalLM resolves to a
10# mismatched module tree and PEFT silently attaches nothing.
11arch = AutoConfig.from_pretrained(BASE, trust_remote_code=True).architectures[0]
12cls = getattr(transformers, arch)
13tok = AutoTokenizer.from_pretrained(BASE, trust_remote_code=True)
14model = cls.from_pretrained(BASE, dtype=torch.bfloat16, device_map="auto",
15 trust_remote_code=True)
16model = PeftModel.from_pretrained(model, ADAPTER)
17model.eval()
18
19n = sum(1 for k, m in model.named_modules()
20 if k.endswith("lora_B.default") and m.weight.abs().max() > 0)
21assert n > 0, "adapter not loaded"
22
23system = """你将扮演「林路」,一个真实、有血有肉的角色,正在用中文和「对方」聊天。
24【消息格式】每条消息单独一行,以发送时刻开头,格式为「[HH:MM] 消息内容」。
25发表情包时整条消息写作「[HH:MM] [[sticker:表情名]]」。"""
26
27msgs = [{"role": "system", "content": system},
28 {"role": "user", "content": "[19:02] 林老师晚上好呀"}]
29prompt = "".join(f"<|im_start|>{m['role']}\n{m['content']}<|im_end|>\n"
30 for m in msgs) + "<|im_start|>assistant\n"
31ids = tok(prompt, return_tensors="pt").to(model.device)
32eos = [tok.eos_token_id, tok.convert_tokens_to_ids("<|im_end|>")]
33out = model.generate(**ids, max_new_tokens=512, do_sample=True,
34 temperature=0.7, top_p=0.95, top_k=20,
35 eos_token_id=eos, pad_token_id=tok.pad_token_id or eos[0])
36print(tok.decode(out[0][ids.input_ids.shape[1]:], skip_special_tokens=True))serve/ bundle from the
v0.3 repo —
identical protocol, just pass --base Qwen/Qwen3.6-27B --adapter <this repo>.no_repeat_ngram_size — the timed format legitimately repeats
[HH:MM] prefixes, and n-gram blocking forces the model into corrupted
stamps ([18:48h], stray ] lines). A moderate repetition_penalty is
fine and recommended: at 1.15 stamps stay 100% well-formed and the model
pushes back on repeated questions instead of template-looping.| Parameter | Value |
|---|---|
temperature | 0.7 |
top_p | 0.95 |
top_k | 20 |
repetition_penalty | 1.15 (keep ≤ 1.3) |
max_new_tokens | 512–1024 |
\n), and every assistant turn starts with
its <think>…</think> block (empty block if none). If your client appends
each bubble as a separate assistant entry and strips <think>, the model
drifts out of distribution and degenerates into one-word replies after
~30 turns.user: [19:02] 在吗\n[19:02] 林老师
assistant: <think>\n{monologue}\n</think>\n[19:05] 在的\n[19:05] 怎么了