Views
No views yet
| Item | Value |
|---|---|
| Base model | Qwen/Qwen3-1.7B |
| Method | LoRA (PEFT) |
| LoRA r / alpha / dropout | 16 / 32 / 0.05 |
| Target modules | q/k/v/o/gate/up/down proj |
| Max length | 2048 |
| Epochs | 1.0 |
| Learning rate | 2e-4 |
| Effective batch size | 2 per device x 2 GPUs x 8 grad accum = 32 |
| Train loss | 0.4021 |
| Eval loss | 0.3418 |
| Train data | cochrane-screening-sft train split |
| Task output | JSON {"label","reason"} with labels include/exclude/uncertain |
| File | Description |
|---|---|
adapter_model.safetensors | LoRA weights |
adapter_config.json | LoRA config |
| tokenizer files | Tokenizer / chat template from the training run |
run_args.json | Training hyperparameters |
all_results.json | Final train/eval metrics |
1import torch
2from peft import PeftModel
3from transformers import AutoModelForCausalLM, AutoTokenizer
4
5BASE_MODEL = "Qwen/Qwen3-1.7B"
6ADAPTER_ID = "deepcoder2024/Qwen3-1.7B-LoRA-Cochrane-Screening"
7
8tokenizer = AutoTokenizer.from_pretrained(ADAPTER_ID, trust_remote_code=True)
9base = AutoModelForCausalLM.from_pretrained(
10 BASE_MODEL,
11 torch_dtype=torch.bfloat16,
12 device_map="auto",
13 trust_remote_code=True,
14)
15model = PeftModel.from_pretrained(base, ADAPTER_ID)
16model.eval()
17
18messages = [
19 {
20 "role": "system",
21 "content": (
22 "You are an expert systematic reviewer performing title and abstract screening.\n"
23 "Given the review Selection_criteria, the study Title, and the Abstract, "
24 "decide whether the study should be included.\n\n"
25 "Labels:\n"
26 "- include: clearly meets selection criteria\n"
27 "- exclude: clearly does not meet selection criteria\n"
28 "- uncertain: insufficient information to decide\n\n"
29 "Respond with ONLY a JSON object in this exact format:\n"
30 '{"label": "include" | "exclude" | "uncertain", "reason": "<brief explanation>"}\n'
31 "Do not output any other text."
32 ),
33 },
34 {
35 "role": "user",
36 "content": (
37 "Selection_criteria:\n...\n\n"
38 "Title:\n...\n\n"
39 "Abstract:\n...\n\n"
40 "Decide the screening label and provide a brief reason."
41 ),
42 },
43]
44
45prompt = tokenizer.apply_chat_template(
46 messages,
47 tokenize=False,
48 add_generation_prompt=True,
49 enable_thinking=False,
50)
51inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
52output_ids = model.generate(**inputs, max_new_tokens=256, do_sample=False)
53print(tokenizer.decode(output_ids[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True))