How glenrunc/slopformer works
Slopformer is a Vision Transformer reference implementation with modified attention, positional encodings, residual layers, and ImageNet-BR label handling. Its user-facing paths are image classification with a retrofitted pretrained ViT, training from an ImageFolder-style dataset, and attention-rollout visualization. The graph also shows the model’s internal embedding, encoder, and attention layers. Relationships are supported by the README and excerpted sources; rollout details are limited to the README and SOURCE INDEX references.
Main entry points: model.py Slopformer Model · train.py Training Loop · classify.py Image Classifier · data.py Dataset & Augmentation
Components 15
Model Core
- Slopformer Model
slopformer/model.py - Patch & Position
slopformer/embeddings.py - Encoder Layers
slopformer/layers.py - Cringe Attention
slopformer/attention.py
Data & Labels
- Dataset & Augmentation
slopformer/data.py - Label Resolution
slopformer/labels.py
User Workflows
- Image Classifier
scripts/classify.py - Attention Rollout
scripts/rollout.py
Training
- Training Loop
scripts/train.py - Yapping Loss
slopformer/losses.py - SMGO Optimizer
slopformer/optim.py
Other components
- Image User
- Image Input
- timm Hub
- ImageFolder Dataset
Connections 19
- Image User → Image Classifier: classifies with
README.md - Image User → Attention Rollout: requests rollout
README.md - Image User → Training Loop: starts training
README.md - Image User → Image Input: provides
README.md - Image Input → Image Classifier: supplies image
scripts/classify.py - Image Classifier → Slopformer Model: loads and runs
scripts/classify.py - Slopformer Model → timm Hub: loads checkpoint
slopformer/model.py - Slopformer Model → Cringe Attention: patches attention
slopformer/model.py - Image Classifier → Label Resolution: resolves prediction
scripts/classify.py - Slopformer Model → Patch & Position: embeds image
slopformer/model.py - Slopformer Model → Encoder Layers: runs blocks
slopformer/model.py - Encoder Layers → Cringe Attention: uses attention
slopformer/layers.py - Attention Rollout → Slopformer Model: reads attention
README.md - ImageFolder Dataset → Dataset & Augmentation: provides samples
slopformer/data.py - Training Loop → Dataset & Augmentation: loads batches
scripts/train.py - Dataset & Augmentation → Label Resolution: uses class set
slopformer/data.py - Training Loop → Slopformer Model: trains model
scripts/train.py - Training Loop → Yapping Loss: computes objective
scripts/train.py - Training Loop → SMGO Optimizer: updates parameters
scripts/train.py