Views
No views yet
| Feature | Value |
|---|---|
| Architecture | Encoder-Decoder Transformer |
| Parameters | 51.26M |
| Framework | PyTorch |
| Task | English → French Translation |
| Dataset | OPUS-100 |
| Training Samples | ~1M sentences |
| Embedding Dimension | 256 |
| Attention Heads | 8 |
| Feed Forward Dimension | 1024 |
| Encoder Layers | 3 |
| Decoder Layers | 3 |
| Maximum Sequence Length | 64 tokens |
| Positional Encoding | RoPE |
| Metric | Result |
|---|---|
| Token Accuracy | 62.8% |
1git clone https://github.com/MehdiSkilll24/Alpha.git
2cd Alpha
3
4Install dependencies:
5
6pip install torch safetensors
7
8Usage
9
10Run inference:
11
12python inference.py
13
14Example:
15
16Input:
17> hello, how are you?
18
19Output:
20> bonjour, comment allez-vous ?
21
22
23
24Loading the Model Manually
25import torch
26import json
27from safetensors.torch import load_file
28from main import Transformer
29
30with open("config.json") as f:
31 config = json.load(f)
32
33weights = load_file("model.safetensors")
34
35model = Transformer(
36 src_vocab_size=config["src_vocab_size"],
37 tgt_vocab_size=config["tgt_vocab_size"],
38 d_model=config["d_model"],
39 num_heads=config["num_heads"],
40 d_ff=config["d_ff"]
41)
42
43model.load_state_dict(weights)
44model.eval()
45
46
47Training
48
49The model was trained using:
50
51AdamW optimizer
52Mixed precision training (FP16)
53ReduceLROnPlateau scheduler
54Custom PyTorch training loop
55
56Training configuration:
57
58Learning Rate: 3e-4
59Batch Size: 32
60Epochs: 18
61Dataset
62
63Training data:
64
65OPUS-100 English-French translation dataset.
66
67The dataset contains parallel English/French sentence pairs collected from various sources.
68
69Limitations
70
71This model is designed as an educational and experimental Transformer implementation.
72
73Limitations:
74
75Vocabulary is based on a custom word-level tokenizer
76Limited context length
77No pretrained initialization
78Smaller dataset compared to production translation systems
79Token accuracy does not directly represent BLEU score
80Future Improvements
81
82Possible improvements:
83
84Replace word tokenizer with BPE/SentencePiece
85Increase model depth
86Train on larger datasets
87Add beam search decoding
88Evaluate with BLEU / COMET
89Implement KV-cache for faster inference
90Motivation
91
92Alpha was built to understand and implement the Transformer architecture from first principles.
93
94Rather than using existing libraries, the project implements the core components manually:
95
96Attention calculations
97Positional embeddings
98Encoder/decoder blocks
99Training pipeline
100Model serialization
101
102The goal is to better understand how modern language models are built internally.
103
104Source Code
105
106GitHub:
107
108https://github.com/MehdiSkilll24/Alpha
109
110Model weights:
111
112https://huggingface.co/MehdiSkilll24/Alpha
113
114License
115
116MIT License
117
118
119One suggestion before you upload: add **3-5 real translation examples** from your model. That will make the HF page look 10x more alive. A model card with "62.8% accuracy" is okay; a model card with:
120
121
122English:
123"The weather is beautiful today."
124
125Alpha:
126"Le temps est magnifique aujourd'hui."