Views
No views yet
ssurface/qwen3-4b-cot-compress-eval.| metric | value |
|---|---|
| accuracy | 0.579985 |
| n_correct / n_total | 765 / 1319 |
| mean think tokens | 39.05 |
| median think tokens | 35.00 |
1from peft import PeftModel
2from transformers import AutoModelForCausalLM, AutoTokenizer
3import torch
4
5base = AutoModelForCausalLM.from_pretrained(
6 "Qwen/Qwen3-4B-Instruct-2507", torch_dtype=torch.float16, device_map="auto"
7)
8model = PeftModel.from_pretrained(base, "ssurface/qwen3-4b-cot-compress-l4")
9tok = AutoTokenizer.from_pretrained("Qwen/Qwen3-4B-Instruct-2507")
10
11prompt = tok.apply_chat_template(
12 [{"role": "user",
13 "content": "Solve this using Level 4 (Ultra-compact).\n"
14 "Problem: Natalia sold clips to 48 friends in April, "
15 "then half as many in May. How many in total?"}],
16 tokenize=False, add_generation_prompt=True,
17)
18inputs = tok(prompt, return_tensors="pt").to(model.device)
19out = model.generate(
20 **inputs, max_new_tokens=256,
21 eos_token_id=tok.convert_tokens_to_ids("<|im_end|>"),
22)
23print(tok.decode(out[0], skip_special_tokens=False))SFTTrainer