SwiftTransformer V1 is a lightweight and efficient Transformer-based model designed for rapid experimentation, learning, and prototyping. Built with simplicity and scalability in mind, it provides a clean implementation of core attention mechanisms without unnecessary complexity.
- ⚡ Lightweight and fast Transformer architecture
- 🧠 Core components: Embedding, Positional Encoding, Multi-Head Attention
- 🔧 Easy to understand and modify
- 📈 Scalable for future improvements (GPT-style, large datasets)
- 🧪 Ideal for learning and experimentation
SwiftTransformer V1 includes:
- Token Embedding
- Learnable Positional Encoding
- Transformer Encoder (Multi-Head Attention + Feed Forward)
- Linear Output Layer
SwiftTransformer/
│
├── data/ # Training data
│ └── sample.txt
│
├── model/ # Core model
│ └── swift_transformer.py
│
├── train/ # Training scripts
│ └── train.py
│
├── utils/ # Utilities
│ └── tokenizer.py
│
├── config.py # Configuration
├── requirements.txt # Dependencies
└── README.md # Project documentation
git clone https://github.com/your-username/SwiftTransformer.git
cd SwiftTransformer
pip install -r requirements.txtEdit:
data/sample.txt
Example:
hello swift transformer this is version one
python train/train.pyEpoch 0, Loss: 6.12
Epoch 1, Loss: 5.87
...
from model.swift_transformer import SwiftTransformer
import torch
model = SwiftTransformer(vocab_size=1000)
x = torch.randint(0, 1000, (2, 20))
output = model(x)
print(output.shape)- Basic Transformer architecture
- Simple tokenizer
- Training pipeline
- Causal Mask (GPT-style)
- Text generation
- Save & load model
- Large-scale dataset
- Fine-tuning
- Web demo (interactive UI)
- NLP experiments
- Sequence prediction
- Educational purposes
- Rapid prototyping of AI models
Thunders Foundation Aspiring AI Engineer focused on building future-ready intelligent systems.
Contributions are welcome! Feel free to fork this repository and submit pull requests.
MIT License
SwiftTransformer V1 is not just a model — it's a starting point. Build fast, iterate faster, and evolve it into something powerful.