Update README.md
Browse files
README.md
CHANGED
|
@@ -1,171 +1,231 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
## Veri ve Modellerin konumları
|
| 10 |
-
|
| 11 |
-
/scratch/project/dd-24-118/
|
| 12 |
-
Burada 3 ay limitli veriler saklanmakta. Şuanki projeler bu konumda. Süre içerisinde bu konumdaki bilgiler alınmalı.
|
| 13 |
-
|
| 14 |
-
/home/
|
| 15 |
-
home altında bellek sınırı mevcut 40 gb
|
| 16 |
-
|
| 17 |
-
/mnt/proj3/dd-24-118
|
| 18 |
-
verileri saklamak için bu konum kullanılabilir. Süre sınırı yok.
|
| 19 |
-
|
| 20 |
-
### Salloc
|
| 21 |
-
Bu komut ekran kartına bağlanmanı ve kısa süreli kullanmanı sağlar.
|
| 22 |
-
-Max 1 saat
|
| 23 |
-
|
| 24 |
-
salloc --partition=qgpu_exp --account=dd-24-118 --nodes=1 --ntasks-per-node=1 --gpus-per-node=1 --time=1:00:00
|
| 25 |
-
|
| 26 |
-
### Ekran kartlarını
|
| 27 |
-
squeue --me
|
| 28 |
-
|
| 29 |
-
### Oluşturduğun bir ekran kartı işini scancel ile job_id ile durdurabilirsin.
|
| 30 |
-
scancel jobid
|
| 31 |
-
|
| 32 |
-
### SLURM Yönergeleri
|
| 33 |
-
Aşağıda betikte kullanılan SLURM komutları ve açıklamaları verilmiştir:
|
| 34 |
-
|
| 35 |
-
Ekran kartı için yer ayırarak belli bir projeyi çalıştırmak için bu komut dosyasını çalıştırınız.
|
| 36 |
-
|
| 37 |
|
| 38 |
-
##
|
| 39 |
-
```bash
|
| 40 |
-
#!/bin/bash
|
| 41 |
|
| 42 |
-
|
| 43 |
-
#SBATCH --account=dd-24-118
|
| 44 |
-
#SBATCH --partition=qgpu
|
| 45 |
-
#SBATCH --nodes=1
|
| 46 |
-
#SBATCH --ntasks-per-node=1
|
| 47 |
-
#SBATCH --gpus-per-node=1
|
| 48 |
-
#SBATCH --time=3:00:00
|
| 49 |
-
|
| 50 |
-
# Your job commands go here
|
| 51 |
|
| 52 |
-
|
| 53 |
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
|
|
|
|
|
|
|
|
|
| 57 |
|
| 58 |
-
|
| 59 |
-
```
|
| 60 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 61 |
|
| 62 |
-
|
| 63 |
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 67 |
|
| 68 |
-
|
| 69 |
|
| 70 |
-
|
| 71 |
-
#SBATCH --account=dd-24-118
|
| 72 |
-
```
|
| 73 |
|
| 74 |
-
|
| 75 |
|
| 76 |
-
```
|
| 77 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 78 |
```
|
| 79 |
|
| 80 |
-
|
| 81 |
|
| 82 |
-
|
| 83 |
-
#SBATCH --nodes=1
|
| 84 |
-
```
|
| 85 |
|
| 86 |
-
|
|
|
|
|
|
|
| 87 |
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
```bash
|
| 95 |
-
#SBATCH --gpus-per-node=1
|
| 96 |
-
```
|
| 97 |
|
| 98 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 99 |
|
| 100 |
-
|
| 101 |
-
|
|
|
|
|
|
|
|
|
|
| 102 |
```
|
| 103 |
|
| 104 |
-
|
| 105 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 106 |
---
|
| 107 |
|
| 108 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 109 |
|
| 110 |
-
|
| 111 |
-
echo "Starting my GPU job"
|
| 112 |
-
```
|
| 113 |
|
| 114 |
-
-
|
| 115 |
|
| 116 |
-
|
| 117 |
-
ml OpenMPI/4.1.6-GCC-12.2.0-CUDA-12.4.0
|
| 118 |
-
```
|
| 119 |
|
| 120 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 121 |
|
| 122 |
-
|
| 123 |
-
ml Python/3.11.2-GCCcore-12.2.0-bare
|
| 124 |
-
```
|
| 125 |
|
| 126 |
-
|
|
|
|
|
|
|
|
|
|
| 127 |
|
| 128 |
-
|
| 129 |
-
bash src/run_finetune.sh kvkk /scratch/project/dd-24-118/mcimen/finetune-newmind/new_format_eurohps/kişisel_verilerin_korunması_hukuku.json
|
| 130 |
-
```
|
| 131 |
-
|
| 132 |
-
- `run_finetune.sh` betiği çalıştırılır.
|
| 133 |
-
|
| 134 |
-
#### Argümanlar:
|
| 135 |
-
|
| 136 |
-
- `kvkk veri setinin ismi
|
| 137 |
-
- `/scratch/project/dd-24-118/mcimen/finetune-newmind/new_format_eurohps/kişisel_verilerin_korunması_hukuku.json veri setinin yolu
|
| 138 |
|
| 139 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 140 |
|
| 141 |
-
|
| 142 |
|
|
|
|
| 143 |
|
| 144 |
-
|
| 145 |
-
Bu veri kümesi `kvkk` verilerini içermektedir.
|
| 146 |
|
| 147 |
-
|
| 148 |
-
|
| 149 |
-
|
| 150 |
-
|
|
|
|
|
|
|
| 151 |
```
|
| 152 |
|
| 153 |
-
|
| 154 |
|
|
|
|
| 155 |
|
| 156 |
-
|
| 157 |
-
|
|
|
|
| 158 |
|
| 159 |
-
|
|
|
|
|
|
|
| 160 |
|
| 161 |
-
#
|
|
|
|
| 162 |
|
| 163 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 164 |
|
| 165 |
-
|
| 166 |
-
|
|
|
|
|
|
|
|
|
|
| 167 |
```
|
| 168 |
|
| 169 |
-
|
| 170 |
-
|
| 171 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: llama3.1
|
| 3 |
+
datasets:
|
| 4 |
+
- newmindai/Euro_HPC
|
| 5 |
+
language:
|
| 6 |
+
- tr
|
| 7 |
+
- en
|
| 8 |
+
base_model:
|
| 9 |
+
- meta-llama/Llama-3.1-8B-Instruct
|
| 10 |
+
tags:
|
| 11 |
+
- EuroHPC
|
| 12 |
+
- Karolina
|
| 13 |
+
- Axolotl
|
| 14 |
+
- Unsloth
|
| 15 |
+
---
|
| 16 |
|
| 17 |
+
<div style="display: flex; justify-content: center; flex-wrap: wrap; gap: 15px; align-items: flex-start;">
|
| 18 |
+
<img src="https://cdn-uploads.huggingface.co/production/uploads/683d4880e639f8d647355997/mqbOdFfrC7KjDZbQlLFFj.png"
|
| 19 |
+
style="width: 100%; max-width: 300px; height: auto;" />
|
| 20 |
+
<img src="https://cdn-uploads.huggingface.co/production/uploads/683d4880e639f8d647355997/VGnh14pYg-SXSaEt640qz.png"
|
| 21 |
+
style="width: 100%; max-width: 150px; height: auto;" />
|
| 22 |
+
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
|
| 24 |
+
## Model Card
|
|
|
|
|
|
|
| 25 |
|
| 26 |
+
This document describes a parameter-efficient fine-tuning setup using LoRA on the EuroHPC Karolina system. Axolotl provides flexible orchestration and Unsloth supplies optimized kernels for high-throughput training on the Euro_HPC dataset. This model is fine-tuned using Parameter-Efficient Fine-Tuning (PEFT) with LoRA (Low-Rank Adaptation) on the EuroHPC dataset, specifically the kvkk subset. The fine-tuning leverages the Axolotl framework for orchestration and Unsloth library for optimized training kernels.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
|
| 28 |
+
### Hyperparameters
|
| 29 |
|
| 30 |
+
* **LoRA Rank**: 16
|
| 31 |
+
* **LoRA Alpha**: 32
|
| 32 |
+
* **LoRA Dropout**: 0.05
|
| 33 |
+
* **Learning Rate**: 3×10⁻⁵ with cosine scheduling
|
| 34 |
+
* **Training Epochs**: 3 per domain
|
| 35 |
+
* **Batch Size**: Optimized for A100 memory capacity
|
| 36 |
|
| 37 |
+
### Architecture
|
|
|
|
| 38 |
|
| 39 |
+
* **Base Model**: Llama-3.1-8B-Instruct (Meta)
|
| 40 |
+
* **Fine-tuning Method**: LoRA (Low-Rank Adaptation)
|
| 41 |
+
* **Parameter Efficiency**: Only trainable LoRA parameters, frozen base model
|
| 42 |
+
* **Model Size**: 8B parameters (base) + LoRA adapters
|
| 43 |
|
| 44 |
+
## Hardware and Software
|
| 45 |
|
| 46 |
+
* **Orchestration**: [Axolotl framework](https://axolotl.ai/)
|
| 47 |
+
* **Acceleration**: [Unsloth library](https://unsloth.ai/)
|
| 48 |
+
* **Backend**: PyTorch with CUDA support
|
| 49 |
+
* **System**: EuroHPC Karolina supercomputer
|
| 50 |
+
* **GPUs**: NVIDIA A100 (8 × 40 GB per node, 320 GB HBM2 total)
|
| 51 |
+
* **Utilization**: 85–90% GPU and memory efficiency
|
| 52 |
+
* **Total Compute**: ~600 GPU hours
|
| 53 |
|
| 54 |
+
## Data
|
| 55 |
|
| 56 |
+
### Input Format
|
|
|
|
|
|
|
| 57 |
|
| 58 |
+
The dataset follows the **Alpaca format** with three key fields:
|
| 59 |
|
| 60 |
+
```json
|
| 61 |
+
{
|
| 62 |
+
"instruction": "Task description or question",
|
| 63 |
+
"input": "Additional context or input data",
|
| 64 |
+
"output": "Expected response or answer"
|
| 65 |
+
}
|
| 66 |
```
|
| 67 |
|
| 68 |
+
**Dataset**: `newmindai/Euro_HPC` (kvkk subset)
|
| 69 |
|
| 70 |
+
## How to Use
|
|
|
|
|
|
|
| 71 |
|
| 72 |
+
```python
|
| 73 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
| 74 |
+
from peft import PeftModel
|
| 75 |
|
| 76 |
+
# Load base model and tokenizer
|
| 77 |
+
base_model = AutoModelForCausalLM.from_pretrained("meta-llama/Llama-3.1-8B-Instruct")
|
| 78 |
+
tokenizer = AutoTokenizer.from_pretrained("meta-llama/Llama-3.1-8B-Instruct")
|
| 79 |
|
| 80 |
+
# Load LoRA adapter
|
| 81 |
+
model = PeftModel.from_pretrained(base_model, "newmindai/Llama-3.1-8B-Instruct-kvkk-alpaca")
|
|
|
|
|
|
|
|
|
|
| 82 |
|
| 83 |
+
# Format input according to Alpaca format
|
| 84 |
+
def format_prompt(instruction, input_text=""):
|
| 85 |
+
if input_text:
|
| 86 |
+
return f"### Instruction:\n{instruction}\n\n### Input:\n{input_text}\n\n### Response:\n"
|
| 87 |
+
else:
|
| 88 |
+
return f"### Instruction:\n{instruction}\n\n### Response:\n"
|
| 89 |
|
| 90 |
+
# Example usage
|
| 91 |
+
prompt = format_prompt("Explain the benefits of regular exercise")
|
| 92 |
+
inputs = tokenizer(prompt, return_tensors="pt")
|
| 93 |
+
outputs = model.generate(**inputs, max_new_tokens=256)
|
| 94 |
+
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
| 95 |
```
|
| 96 |
|
| 97 |
+
## Acknowledgments
|
| 98 |
+
|
| 99 |
+
This research was supported by the EuroHPC Joint Undertaking (EuroHPC JU) under the Benchmark Access
|
| 100 |
+
grant agreement No EHPC-BEN-2024B11-003. The authors gratefully acknowledge the computational resources
|
| 101 |
+
provided by the IT4Innovations National Supercomputing Center (Czech Republic) on the Karolina supercomputer,
|
| 102 |
+
made available through the EuroHPC JU.
|
| 103 |
+
|
| 104 |
+
## Citation
|
| 105 |
+
|
| 106 |
+
```bibtex
|
| 107 |
+
@article{newmind2025,
|
| 108 |
+
title={Tailoring AI for Turkish Law: Domain-Specific Fine-Tuning of Small Language Models for Legal Expertise},
|
| 109 |
+
author={New Mind AI Team},
|
| 110 |
+
journal={Procedia Computer Science},
|
| 111 |
+
year={2025},
|
| 112 |
+
volume={239},
|
| 113 |
+
doi={10.1016/j.procs.2025.08.239},
|
| 114 |
+
note={Available online 23 September 2025, Version of Record 23 September 2025}
|
| 115 |
+
}
|
| 116 |
+
```---
|
| 117 |
+
license: llama3.1
|
| 118 |
+
datasets:
|
| 119 |
+
- newmindai/Euro_HPC
|
| 120 |
+
language:
|
| 121 |
+
- tr
|
| 122 |
+
- en
|
| 123 |
+
base_model:
|
| 124 |
+
- meta-llama/Llama-3.1-8B-Instruct
|
| 125 |
+
tags:
|
| 126 |
+
- EuroHPC
|
| 127 |
+
- Karolina
|
| 128 |
+
- Axolotl
|
| 129 |
+
- Unsloth
|
| 130 |
---
|
| 131 |
|
| 132 |
+
<div style="display: flex; justify-content: center; flex-wrap: wrap; gap: 15px; align-items: flex-start;">
|
| 133 |
+
<img src="https://cdn-uploads.huggingface.co/production/uploads/683d4880e639f8d647355997/mqbOdFfrC7KjDZbQlLFFj.png"
|
| 134 |
+
style="width: 100%; max-width: 300px; height: auto;" />
|
| 135 |
+
<img src="https://cdn-uploads.huggingface.co/production/uploads/683d4880e639f8d647355997/VGnh14pYg-SXSaEt640qz.png"
|
| 136 |
+
style="width: 100%; max-width: 150px; height: auto;" />
|
| 137 |
+
</div>
|
| 138 |
|
| 139 |
+
## Model Card
|
|
|
|
|
|
|
| 140 |
|
| 141 |
+
This document describes a parameter-efficient fine-tuning setup using LoRA on the EuroHPC Karolina system. Axolotl provides flexible orchestration and Unsloth supplies optimized kernels for high-throughput training on the Euro_HPC dataset. This model is fine-tuned using Parameter-Efficient Fine-Tuning (PEFT) with LoRA (Low-Rank Adaptation) on the EuroHPC dataset, specifically the kvkk subset. The fine-tuning leverages the Axolotl framework for orchestration and Unsloth library for optimized training kernels.
|
| 142 |
|
| 143 |
+
### Hyperparameters
|
|
|
|
|
|
|
| 144 |
|
| 145 |
+
* **LoRA Rank**: 16
|
| 146 |
+
* **LoRA Alpha**: 32
|
| 147 |
+
* **LoRA Dropout**: 0.05
|
| 148 |
+
* **Learning Rate**: 3×10⁻⁵ with cosine scheduling
|
| 149 |
+
* **Training Epochs**: 3 per domain
|
| 150 |
+
* **Batch Size**: Optimized for A100 memory capacity
|
| 151 |
|
| 152 |
+
### Architecture
|
|
|
|
|
|
|
| 153 |
|
| 154 |
+
* **Base Model**: Llama-3.1-8B-Instruct (Meta)
|
| 155 |
+
* **Fine-tuning Method**: LoRA (Low-Rank Adaptation)
|
| 156 |
+
* **Parameter Efficiency**: Only trainable LoRA parameters, frozen base model
|
| 157 |
+
* **Model Size**: 8B parameters (base) + LoRA adapters
|
| 158 |
|
| 159 |
+
## Hardware and Software
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 160 |
|
| 161 |
+
* **Orchestration**: [Axolotl framework](https://axolotl.ai/)
|
| 162 |
+
* **Acceleration**: [Unsloth library](https://unsloth.ai/)
|
| 163 |
+
* **Backend**: PyTorch with CUDA support
|
| 164 |
+
* **System**: EuroHPC Karolina supercomputer
|
| 165 |
+
* **GPUs**: NVIDIA A100 (8 × 40 GB per node, 320 GB HBM2 total)
|
| 166 |
+
* **Utilization**: 85–90% GPU and memory efficiency
|
| 167 |
+
* **Total Compute**: ~600 GPU hours
|
| 168 |
|
| 169 |
+
## Data
|
| 170 |
|
| 171 |
+
### Input Format
|
| 172 |
|
| 173 |
+
The dataset follows the **Alpaca format** with three key fields:
|
|
|
|
| 174 |
|
| 175 |
+
```json
|
| 176 |
+
{
|
| 177 |
+
"instruction": "Task description or question",
|
| 178 |
+
"input": "Additional context or input data",
|
| 179 |
+
"output": "Expected response or answer"
|
| 180 |
+
}
|
| 181 |
```
|
| 182 |
|
| 183 |
+
**Dataset**: `newmindai/Euro_HPC` (kvkk subset)
|
| 184 |
|
| 185 |
+
## How to Use
|
| 186 |
|
| 187 |
+
```python
|
| 188 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
| 189 |
+
from peft import PeftModel
|
| 190 |
|
| 191 |
+
# Load base model and tokenizer
|
| 192 |
+
base_model = AutoModelForCausalLM.from_pretrained("meta-llama/Llama-3.1-8B-Instruct")
|
| 193 |
+
tokenizer = AutoTokenizer.from_pretrained("meta-llama/Llama-3.1-8B-Instruct")
|
| 194 |
|
| 195 |
+
# Load LoRA adapter
|
| 196 |
+
model = PeftModel.from_pretrained(base_model, "newmindai/Llama-3.1-8B-Instruct-kvkk-alpaca")
|
| 197 |
|
| 198 |
+
# Format input according to Alpaca format
|
| 199 |
+
def format_prompt(instruction, input_text=""):
|
| 200 |
+
if input_text:
|
| 201 |
+
return f"### Instruction:\n{instruction}\n\n### Input:\n{input_text}\n\n### Response:\n"
|
| 202 |
+
else:
|
| 203 |
+
return f"### Instruction:\n{instruction}\n\n### Response:\n"
|
| 204 |
|
| 205 |
+
# Example usage
|
| 206 |
+
prompt = format_prompt("Explain the benefits of regular exercise")
|
| 207 |
+
inputs = tokenizer(prompt, return_tensors="pt")
|
| 208 |
+
outputs = model.generate(**inputs, max_new_tokens=256)
|
| 209 |
+
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
| 210 |
```
|
| 211 |
|
| 212 |
+
## Acknowledgments
|
| 213 |
+
|
| 214 |
+
This research was supported by the EuroHPC Joint Undertaking (EuroHPC JU) under the Benchmark Access
|
| 215 |
+
grant agreement No EHPC-BEN-2024B11-003. The authors gratefully acknowledge the computational resources
|
| 216 |
+
provided by the IT4Innovations National Supercomputing Center (Czech Republic) on the Karolina supercomputer,
|
| 217 |
+
made available through the EuroHPC JU.
|
| 218 |
+
|
| 219 |
+
## Citation
|
| 220 |
+
|
| 221 |
+
```bibtex
|
| 222 |
+
@article{newmind2025,
|
| 223 |
+
title={Tailoring AI for Turkish Law: Domain-Specific Fine-Tuning of Small Language Models for Legal Expertise},
|
| 224 |
+
author={New Mind AI Team},
|
| 225 |
+
journal={Procedia Computer Science},
|
| 226 |
+
year={2025},
|
| 227 |
+
volume={239},
|
| 228 |
+
doi={10.1016/j.procs.2025.08.239},
|
| 229 |
+
note={Available online 23 September 2025, Version of Record 23 September 2025}
|
| 230 |
+
}
|
| 231 |
+
```
|