This directory contains comprehensive examples demonstrating various features and use cases of the Zeta library. The examples are organized by category to help you quickly find relevant implementations.
Examples demonstrating different model architectures and implementations.
-
simple_transformer.py- A basic transformer implementation showcasing the fundamental components including shaped attention, feedforward layers, and residual connections. Demonstrates how to build a simple transformer from scratch using Zeta's building blocks. -
gpt4.py- Implementation of a GPT-4 style language model using Zeta's transformer components. -
gpt4_multimodal.py- Multimodal extension of GPT-4 that can process both text and visual inputs. -
cobra.py- Implementation of the Cobra model architecture. -
nirvana.py- Nirvana model implementation demonstrating advanced transformer architectures. -
toka_master_gpt.py- Toka Master GPT model implementation.
-
agi/model.py- Artificial General Intelligence model implementation exploring advanced architectures. -
videos/spectra.py- Video processing model using spectral analysis techniques. -
transformer_real_time_learning/transformer_moe_liquid_real_time.py- Real-time learning transformer with Mixture of Experts (MoE) architecture and liquid neural network concepts. -
evo_transformer_mutate/- Evolutionary transformer model that simulates reproduction and evolution using evolutionary algorithms. Features Multi-Query Attention (MQA) and Mixture of Experts (MoE) architecture. Includes detailed documentation in the README.md file.
Examples of individual neural network modules and components.
-
flash_attention.py- Demonstration of Flash Attention implementation, showing how to use the optimized attention mechanism for improved performance and memory efficiency. -
cross_attend.py- Cross-attention module example for processing relationships between different input sequences. -
sigmoid_attn.py- Sigmoid-based attention mechanism implementation. -
fractoral_norm.py- Fractal normalization technique example. -
viusal_expert_example.py- Visual expert module demonstrating specialized processing for visual inputs. -
flow_matching_modules/- Flow matching implementations:flow_matching.py- Basic flow matching moduleflow_moe.py- Flow matching with Mixture of Experts architecture
Comprehensive training examples covering various domains and techniques.
-
fsdp.py- Fully Sharded Data Parallel (FSDP) training example for distributed training across multiple GPUs. -
muon.py- Example demonstrating the Muon optimizer usage, showing how to combine different optimizers for different parameter groups. -
new_optimizer/fa_optimizer.py- Example of a custom optimizer implementation.
-
face_recog/- Face recognition training examples:face_vit.py- Vision Transformer for face recognitionfrt.py- Face recognition transformerrf_prediction.py- Random forest prediction for face recognition
-
food/food_detect.py- Food detection model training example. -
stock_prediction/- Stock market prediction examples:ts.py- Time series stock predictionts_real_time.py- Real-time stock predictionts_stock_model_realtime.py- Real-time stock model implementation- Includes data files:
energy_stocks_analysis.xlsx,energy_stocks_predictions.csv,scaler.joblib
-
weather_training/v_w_transformer.py- Weather prediction using Vision-Weather transformer architecture. -
earth_quake/tea.py- Earthquake prediction model training. -
protein_g/protein_gen_transformer.py- Protein generation using transformer models. -
radio_frequency/- Radio frequency signal processing:rf_model.py- RF model implementationrf_model.joblib- Trained model checkpoint
-
visual_reasoning/vit_siglip.py- Visual reasoning using Vision Transformer with SigLIP architecture. -
yolo_alt/model.py- Alternative YOLO object detection model implementation.
-
gan/- Generative Adversarial Network examples:gan.py- Basic GAN implementationnew_gan.py- Enhanced GAN with improved architecture
-
mo/- Mamba Omega training:mamba_omega.py- Mamba Omega model implementationtrain.py- Training scriptrequirements.txt- Dependencies
-
evo_t/- Evolutionary transformer training:transformers_evolutionary_train.py- Main training script for evolutionary transformer models- Contains training logs and evolved model checkpoints
-
vis/- Vision model training examples:transformer.py- Vision transformermodel.py- General vision modelt2.py,t3.py,t4.py,t5.py- Various vision model variants
Low-level operations and utilities.
laplace.py- Laplace transform operations example.
High-level model structures and architectures.
transformer.py- Complete transformer structure example demonstrating how to use Zeta's Transformer and Decoder components to build a full model.
Tokenization examples and implementations.
token_monster.py- Token Monster tokenizer implementation example, demonstrating advanced tokenization techniques.
Cython extension examples for performance-critical operations.
mqa.pyx- Multi-Query Attention Cython implementationmqa_test.py- Tests for the MQA Cython extensionnew_c_example.py- C extension exampletorch_extension.pyx- PyTorch Cython extension examplesetup.py- Setup script for building Cython extensions
Experimental or work-in-progress implementations.
dit_block.py- Diffusion Transformer block implementation (work in progress)hyper_attention.py- Hyper attention mechanism (experimental)multi_head_latent_attention.py- Multi-head latent attention implementation (experimental)
To run any example, navigate to the specific directory and execute the Python file:
cd examples/models
python simple_transformer.pyMost examples are self-contained and can be run directly. Some training examples may require additional data files or configuration. Refer to individual example files for specific requirements and usage instructions.
- Examples are provided for educational and reference purposes
- Some examples may require additional dependencies beyond the base Zeta installation
- Training examples may require significant computational resources
- Experimental examples in the
todo/directory are subject to change