Views
No views yet
Qwen/Qwen2.5-0.5B-Instruct base model, utilizing QLoRA (4-bit quantization + PEFT) for resource-friendly and fast execution.| Split | Percentage | Records Count | Purpose |
|---|---|---|---|
| Train | 80% | 85,990 | Model gradient updates |
| Validation | 10% | 10,748 | Early stopping & hyperparameter tuning |
| Test | 10% | 10,750 | Final evaluation |
| Parameter | Configuration / Specification |
|---|---|
| Base Model | Qwen/Qwen2.5-0.5B-Instruct |
| Training Method | QLoRA (4-bit Quantization + LoRA) |
| Quantization Scheme | NormalFloat4 (nf4), Double Quantization, float16 compute type |
| LoRA Rank ($r$) | 16 |
| LoRA Alpha ($\alpha$) | 32 |
| LoRA Dropout | 0.05 |
| Target Modules | All linear layers (q_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_proj) |
| Trainable Parameters | 8,798,208 (1.75% of total 502,830,976) |
| Optimizer | adamw_torch |
| Learning Rate (LR) | 2e-4 with Cosine Decay (ending at 0.0) |
| Effective Batch Size | 8 |
| Hardware | NVIDIA GeForce RTX 4060 Laptop GPU |
transformers and peft libraries:1import torch
2from transformers import AutoModelForCausalLM, AutoTokenizer
3from peft import PeftModel
4
5base_model_name = "Qwen/Qwen2.5-0.5B-Instruct"
6adapter_id = "rudrakshrakeshzodage/CustomerGPT-0.5B-LoRA"
7
8# Load Tokenizer
9tokenizer = AutoTokenizer.from_pretrained(base_model_name)
10
11# Load Base Model
12base_model = AutoModelForCausalLM.from_pretrained(
13 base_model_name,
14 torch_dtype=torch.float16,
15 device_map="auto"
16)
17
18# Attach LoRA Adapter
19model = PeftModel.from_pretrained(base_model, adapter_id)
20model.eval()
21
22# Chat Format Example
23system_prompt = "You are CustomerGPT, a helpful and professional customer support assistant."
24messages = [
25 {"role": "system", "content": system_prompt},
26 {"role": "user", "content": "How to newsletter subscription"}
27]
28
29formatted_prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
30inputs = tokenizer(formatted_prompt, return_tensors="pt").to("cuda")
31
32with torch.no_grad():
33 outputs = model.generate(
34 **inputs,
35 max_new_tokens=256,
36 temperature=0.7,
37 top_p=0.9,
38 repetition_penalty=1.1,
39 pad_token_id=tokenizer.pad_token_id,
40 eos_token_id=tokenizer.eos_token_id
41 )
42
43response = tokenizer.decode(outputs[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True)
44print(response)