vit-beatrix / README.md
AbstractPhil's picture
Update beatrix-4simplex-45d_20251007_231008 - Epoch 20 - Acc: 0.1859
eeb7eda verified
|
raw
history blame
5.13 kB
metadata
tags:
  - vision
  - image-classification
  - fractal-positional-encoding
  - geometric-deep-learning
  - devil-staircase
  - simplex-geometry
license: mit

ViT-Beatrix: Fractal PE + Geometric Simplex Vision Transformer

This repository contains Vision Transformers integrating Devil's Staircase positional encoding with geometric simplex features for vision tasks.

Key Features

  • Fractal Positional Encoding: Devil's Staircase multi-scale position embeddings
  • Geometric Simplex Features: k-simplex vertex computations from Cantor measure
  • Adaptive Augmentation: Progressive augmentation escalation to prevent overfitting
  • Beatrix Formula Suite: Flow alignment, hierarchical coherence, and multi-scale consistency losses

Adaptive Augmentation System

The trainer includes an intelligent augmentation system that monitors train/validation accuracy gap and progressively enables more augmentation:

  1. Baseline: RandomCrop + RandomHorizontalFlip
  2. Stage 1: + ColorJitter
  3. Stage 2: + RandomRotation
  4. Stage 3: + RandomAffine
  5. Stage 4: + RandomErasing
  6. Stage 5: + AutoAugment (CIFAR policy)
  7. Stage 6: Enable Mixup (α=0.2)
  8. Stage 7: Enable CutMix (α=1.0) - Final stage

When train accuracy exceeds validation accuracy by 2% or more, the system automatically escalates to the next augmentation stage.

Available Models (Best Checkpoints Only)

Model Name Training Session Accuracy Epoch Weights Path Logs Path
beatrix-cifar100 20251007_182851 0.5819 42 weights/beatrix-cifar100/20251007_182851 N/A
beatrix-cifar100 20251007_215344 0.5161 41 weights/beatrix-cifar100/20251007_215344 logs/beatrix-cifar100/20251007_215344
beatrix-cifar100 20251007_195812 0.4701 42 weights/beatrix-cifar100/20251007_195812 logs/beatrix-cifar100/20251007_195812
beatrix-cifar100 20251007_203741 0.4324 40 weights/beatrix-cifar100/20251007_203741 logs/beatrix-cifar100/20251007_203741
beatrix-cifar100 20251007_193112 0.2802 10 weights/beatrix-cifar100/20251007_193112 N/A
beatrix-4simplex-45d 20251007_231008 0.1859 20 weights/beatrix-4simplex-45d/20251007_231008 logs/beatrix-4simplex-45d/20251007_231008

Latest Updated Model: beatrix-4simplex-45d (Session: 20251007_231008)

Model Details

  • Architecture: Vision Transformer with fractal positional encoding
  • Dataset: CIFAR-100 (100 classes)
  • Embedding Dimension: 45
  • Depth: 22 layers
  • Patch Size: 4x4
  • PE Levels: 12
  • Simplex Dimension: 4-simplex

Training Details

  • Training Session: 20251007_231008
  • Best Accuracy: 0.1859
  • Epochs Trained: 20
  • Batch Size: 512
  • Learning Rate: 0.0001
  • Adaptive Augmentation: Enabled

Loss Configuration

  • Task Loss Weight: 1.0
  • Flow Alignment Weight: 0.4
  • Coherence Weight: 0.2
  • Multi-Scale Weight: 0.1

TensorBoard Logs

Training logs are available in the repository at:

logs/beatrix-4simplex-45d/20251007_231008

To view them locally:

# Clone the repo
git clone https://huggingface.co/AbstractPhil/vit-beatrix

# View logs in TensorBoard
tensorboard --logdir vit-beatrix/logs/beatrix-4simplex-45d/20251007_231008

Usage

Installation

For Google Colab:

# Install for Colab
try:
  !pip uninstall -qy geometricvocab
except:
  pass

!pip install -q git+https://github.com/AbstractEyes/lattice_vocabulary.git

For local environments:

# install the repo into your environment
pip install -q git+https://github.com/AbstractEyes/lattice_vocabulary.git

Loading Models

from geovocab2.train.model.vit_beatrix import SimplifiedGeometricClassifier
from safetensors.torch import load_file
from huggingface_hub import hf_hub_download
import json

# Download and view manifest to see all available models
manifest_path = hf_hub_download(
    repo_id="AbstractPhil/vit-beatrix",
    filename="manifest.json"
)

with open(manifest_path, 'r') as f:
    manifest = json.load(f)
    
# List all available models sorted by accuracy
for key, info in sorted(manifest.items(), key=lambda x: x[1]['accuracy'], reverse=True):
    print(f"{info['model_name']} ({info['timestamp']}): {info['accuracy']:.4f}")

# Download weights for the latest training session of beatrix-4simplex-45d
weights_path = hf_hub_download(
    repo_id="AbstractPhil/vit-beatrix",
    filename="weights/beatrix-4simplex-45d/20251007_231008/model.safetensors"
)

# Load model
model = SimplifiedGeometricClassifier(
    num_classes=100,
    img_size=32,
    embed_dim=45,
    depth=22
)

# Load weights
state_dict = load_file(weights_path)
model.load_state_dict(state_dict)
model.eval()

# Inference
output = model(images)

Citation

@misc{vit-beatrix,
  author = {AbstractPhil},
  title = {ViT-Beatrix: Fractal Positional Encoding with Geometric Simplices},
  year = {2025},
  url = {https://github.com/AbstractEyes/lattice_vocabulary}
}

License

MIT License