Views
No views yet
Qwen/Qwen3-4B-Instruct-2507.dahaludba/QSolver_Decoder_V16Qwen/Qwen3-4B-Instruct-2507dahaludba/QSolver_TrainFastLanguageModel)fold_1 to fold_5). Each fold was trained using process isolation across available GPUs with dynamic memory management.-100 so loss was calculated exclusively on completion target tokens.| Hyperparameter | Value |
|---|---|
| Base Model Quantization | 4-bit (BitsAndBytes / Unsloth) |
| LoRA Rank ($r$) | 32 |
| LoRA Alpha ($\alpha$) | 64 |
| LoRA Dropout | 0.05 |
| Target Modules | q_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_proj |
| Bias Term | none |
| Gradient Checkpointing | unsloth |
| Learning Rate | 1e-4 |
| Optimizer | AdamW |
| Learning Rate Schedule | Warmup Linear Decay |
| Warmup Ratio | 0.05 |
| Weight Decay | 0.01 |
| Per Device Train Batch Size | 4 |
| Per Device Eval Batch Size | 4 |
| Gradient Accumulation Steps | 4 (Effective Batch Size = 16) |
| Training Epochs | 4 per fold |
| Data Collator | DataCollatorForSeq2Seq (pad_to_multiple_of=8) |
| Evaluation Strategy | Epoch-based |
| Best Model Metric | MAP@3 (greater_is_better=True) |
| Seed | 42 |
1<|im_start|>system
2You are a scientific expert. Base your answer STRICTLY on the provided Context. Output ONLY the single letter corresponding to the correct option (A, B, C, D, or E).<|im_end|>
3<|im_start|>user
4Context: {context}
5Question: {question}
6A) {option_a}
7B) {option_b}
8C) {option_c}
9D) {option_d}
10E) {option_e}<|im_end|>
11<|im_start|>assistant
12{answer}<|im_end|>1import torch
2from unsloth import FastLanguageModel
3from peft import PeftModel
4
5MODEL_REPO = "dahaludba/QSolver_Decoder_V16"
6FOLD_SUBFOLDER = "fold_1"
7MAX_SEQ_LENGTH = 1024
8
9# Load Base Model & Tokenizer
10model, tokenizer = FastLanguageModel.from_pretrained(
11 model_name="Qwen/Qwen3-4B-Instruct-2507",
12 max_seq_length=MAX_SEQ_LENGTH,
13 dtype=None,
14 load_in_4bit=True,
15)
16
17# Load PEFT Fold Adapter
18model = PeftModel.from_pretrained(model, MODEL_REPO, subfolder=FOLD_SUBFOLDER)
19FastLanguageModel.for_inference(model)
20
21# Construct Input Prompt
22prompt = (
23 "<|im_start|>system\n"
24 "You are a scientific expert. Base your answer STRICTLY on the provided Context. "
25 "Output ONLY the single letter corresponding to the correct option (A, B, C, D, or E).<|im_end|>\n"
26 "<|im_start|>user\n"
27 "Context: Mitochondria generate most of the chemical energy needed to power the cell's biochemical reactions.\n"
28 "Question: What organelle produces most cellular energy?\n"
29 "A) Nucleus\nB) Mitochondria\nC) Ribosome\nD) Golgi Apparatus\nE) Endoplasmic Reticulum<|im_end|>\n"
30 "<|im_start|>assistant\n"
31)
32
33inputs = tokenizer(prompt, return_tensors="pt").to("cuda")
34outputs = model.generate(**inputs, max_new_tokens=2, use_cache=True)
35response = tokenizer.decode(outputs[0][inputs.input_ids.shape[1]:], skip_special_tokens=True)
36
37print("Predicted Option:", response.strip())