File size: 1,652 Bytes
3b02bea
1cbcbe6
3b02bea
1cbcbe6
3b02bea
1cbcbe6
3b02bea
1cbcbe6
3b02bea
 
 
 
1cbcbe6
3b02bea
1cbcbe6
3b02bea
1cbcbe6
3b02bea
 
 
 
 
 
1cbcbe6
3b02bea
1cbcbe6
3b02bea
1cbcbe6
3b02bea
 
 
 
 
1cbcbe6
3b02bea
 
 
 
1cbcbe6
3b02bea
1cbcbe6
3b02bea
1cbcbe6
3b02bea
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# Qwenmark2-0.5B Fine-Tuned Model Overview

This is a fine-tuned version of the Qwen2-0.5B model, a transformer-based language model developed by Alibaba Cloud. The model has been fine-tuned using **LoRA (Low-Rank Adaptation)** and **Unsupervised Parameter-Efficient Fine-Tuning (PFT)** to specialize in deep learning and machine learning educational tasks.

---

## ✅ Key Features

- 🎯 **Specialization**: Deep learning & machine learning Q&A  
- 📘 **Educational Utility**: Enhanced explanation performance  
- ⚙️ **Efficient Deployment**: Optional 4-bit quantization  
- 💡 **Contextual Understanding**: Supports RAG-style inference

---

## 🧠 Model Details

- **Base Model**: `Qwen/Qwen2-0.5B`
- **Architecture**: Transformer-based Causal Language Model
- **Parameters**: 0.5 Billion
- **Tokenizer**: Qwen2 tokenizer (`left padding`, `eos_token` as `pad_token` if unspecified)
- **Quantization**: Supports 4-bit via `BitsAndBytesConfig`
- **Devices Supported**: CUDA-enabled GPUs / CPU

---

## 🔧 Fine-Tuning Method

### 1. LoRA Distillation
- **Data**: DeepseekR1-generated answers to curated ML/DL questions
- **Config**: `r=16`, `lora_alpha=32`, `target_modules=["q_proj", "v_proj"]`
- **Training**: 3 epochs, batch size 2, grad_accum=4, lr=2e-4, FP16
- **Output**: `./lora_finetuned`

### 2. Unsupervised PFT
- **Data**: Extracted text from `course_slides_text.txt`
- **Training**: 1 epoch, batch size 2, grad_accum=4, lr=1e-5, FP16
- **Output**: `./LoRA&pft_finetuned`

---

## 🛠️ Installation

Install required packages:
```bash
pip install torch transformers peft datasets sentence-transformers pdf2image pytesseract