Views
No views yet
ti)1from transformers import AutoTokenizer, AutoModelForCausalLM, pipeline
2
3model_id = "abrhaley/gpt2-tigrinya-lora"
4
5tokenizer = AutoTokenizer.from_pretrained(model_id)
6model = AutoModelForCausalLM.from_pretrained(model_id)
7
8generator = pipeline("text-generation", model=model, tokenizer=tokenizer)
9
10prompt = "ኣብ ኣዲስ ኣበባ"
11print(generator(prompt, max_length=100, do_sample=True))
12
13## Training Details
14
15### Training Data
16- **Source**: Custom Tigrinya text corpus (news + literature + web text)
17- **Split**: Train/validation prepared manually
18
19### Training Procedure
20- **Base model**: GPT-2 small (124M parameters)
21- **Fine-tuning method**: LoRA (PEFT) applied on attention layers
22- **LoRA config**: r=8, alpha=32, dropout=0.05
23
24### Hyperparameters
25- **Batch size (effective)**: 8
26- **Learning rate**: 2e-4
27- **Optimizer**: AdamW
28- **Epochs**: 1 (demo training; extendable)
29- **Precision**: FP16 (when GPU available)
30
31---
32
33## Evaluation
34
35### Results
36- **Training Loss**: 1.67
37- **Validation Loss**: 1.61
38- **Perplexity (PPL)**: ≈ 5.0
39
40### Metrics
41- **Primary metric**: Perplexity (lower is better → more fluent text)
42- **Summary**: The model achieves ~5.0 PPL on validation and produces fluent/natural Tigrinya completions.
43
44---
45
46## Environmental Impact
47- **Hardware**: NVIDIA T4 (Google Colab)
48- **Training time**: ~5.5 hours
49- **Cloud Provider**: Google Cloud (via Colab)
50- **Carbon estimate**: <1kg CO₂eq (low emissions, small-scale run).
51
52---
53
54## Technical Specifications
55- **Architecture**: GPT-2 small (decoder-only Transformer)
56- **LoRA applied to**: attention layers (`c_attn`, `c_proj`)
57- **Framework**: Hugging Face Transformers + PEFT
58- **Precision**: FP16 mixed-precision (on GPU)
59
60## Citation
61
62If you use this model, please cite it as:
63
64**BibTeX:**
65```bibtex
66@misc{abrhaley2025gpt2tigrinya,
67 title = {GPT-2 Tigrinya LoRA Fine-Tuned},
68 author = {Abrhaley},
69 year = {2025},
70 url = {https://huggingface.co/abrhaley/gpt2-tigrinya-lora}
71}
72