Views
No views yet
I - pronounmove - movement stateeast, west, north, south - directionsbump, into - collision indicatorsthen - connector for chaining actionsred, blue, green, yellow, purple, orange, pink, black, white, gray, brown, cyan - marble colorstop, bottom, left, right - named wallsmarble - object identifierv2/
├── MarbleLanguageDataset.py # Legacy dataset generation script
├── MarbleSentenceGenerator.py # Legacy sentence generator
├── marble_transformer_pretraining.py # Main training script with transformer model
├── training_plotter.py # Training visualization and analysis
├── marble_language/ # Main package (organized code)
│ ├── __init__.py # Package exports
│ ├── core/ # Core language modules
│ │ ├── config.py # Enhanced rules & configuration
│ │ └── generator.py # Enhanced sentence generator
│ ├── training/ # Model training modules
│ │ ├── model.py # Enhanced transformer model
│ │ └── trainer.py # Training utilities
│ └── utils/ # Utility modules
│ └── validation.py # Comprehensive validation system
├── datasets/ # Generated training data files
│ ├── dataset-1000_*.txt # Large datasets
│ ├── dataset-200.txt # Medium datasets
│ └── enhanced_dataset-*.txt # Enhanced format datasets
└── marble_model/ # Trained model artifacts
├── best_model.pt # Best trained model weights
└── training_results.json # Training metrics and results1# Legacy generator
2python3 MarbleSentenceGenerator.py 1000
3
4# Enhanced generator with collision rules
5python3 -m marble_language.core.generator 1000datasets/ directory with unique marble language sentences.1# Auto-select latest dataset (recommended)
2python3 marble_transformer_pretraining.py --epochs 50 --batch_size 32
3
4# Or specify specific dataset files
5python3 marble_transformer_pretraining.py datasets/dataset-1000_*.txt --epochs 50
6
7# Or use filenames directly (will look in datasets/)
8python3 marble_transformer_pretraining.py dataset-1000_*.txt --epochs 50python3 training_plotter.py marble_model/training_results.json1# Legacy generator - saves to datasets/
2python3 MarbleSentenceGenerator.py 500 my_dataset.txt
3
4# Enhanced generator - saves to datasets/
5python3 -m marble_language.core.generator 500 my_enhanced_dataset.txt1# Train with larger model and more epochs
2python3 marble_transformer_pretraining.py datasets/data.txt \
3 --epochs 100 \
4 --batch_size 64 \
5 --output_dir my_model \
6 --device cuda1# Train on multiple data files from datasets directory
2python3 marble_transformer_pretraining.py \
3 dataset-1000_*.txt dataset-500_*.txt \
4 --datasets_dir ./datasetspip install -r requirements.txt1# Core dependencies for training
2pip install torch>=2.0.0 numpy>=1.21.0
3
4# Additional dependencies for full functionality
5pip install matplotlib>=3.3.0 tqdm>=4.60.0
6
7# All at once
8pip install torch numpy matplotlib tqdm✓ matplotlib available - real-time plotting enabled
✓ Enhanced real-time plotter available
✓ Training database available
✓ Progress bars available (tqdm)❌ matplotlib not installed - no real-time plotting available
Install with: pip3 install matplotlib numpy
For full functionality: pip3 install torch matplotlib numpy tqdmdatasets/ directory:datasets/
├── dataset-1000_20250530_210522.txt # Large legacy dataset
├── dataset-200.txt # Medium legacy dataset
├── dataset-500_20250530_210213.txt # Medium legacy dataset
├── enhanced_dataset-100_*.txt # Enhanced format datasets
└── custom_dataset.txt # User-generated datasetsEnhanced Marble Language Dataset - Generated on 2025-05-30 21:05:22
================================================================================
Dataset Statistics:
Total sentences: 100
Unique colors used: 8
Wall collisions: 23
Marble collisions: 31
Average sentence length: 12.4 tokens
Sentences:
----------------------------------------
1. "I red marble move east bump into blue marble"
2. "I green marble move north bump into top"
3. "I yellow marble move west bump into purple marble move south"
...best_model.pt - PyTorch model checkpoint with weights and metadatatraining_results.json - Training metrics and final test resultsI red marble move east (basic movement)I blue marble move north bump into green marble (marble collision)I yellow marble move west bump into top (wall collision)I purple marble move south bump into left then orange marble move north (sequence)I red marble move east bump into red marble (self-collision)I red marble move east then red marble move west (duplicate colors)I marble move east (missing color)I red marble bump into something (invalid target)1from marble_language.core.config import MARBLE_CONFIG
2from marble_language.utils.validation import MarbleLanguageValidator
3
4# Access vocabulary
5colors = MARBLE_CONFIG.vocabulary['colors']
6walls = MARBLE_CONFIG.vocabulary['walls']
7
8# Modify rules
9MARBLE_CONFIG.marble_rules['unique_colors'] = True
10MARBLE_CONFIG.wall_rules['wall_collision_probability'] = 0.4
11
12# Validate sentences
13validator = MarbleLanguageValidator()
14result = validator.validate_sentence("I red marble move east bump into blue marble")1from marble_language.core.config import MARBLE_CONFIG
2
3# Add new color
4MARBLE_CONFIG.vocabulary['colors'].append('silver')
5
6# Generate with enhanced generator
7from marble_language.core.generator import EnhancedMarbleSentenceGenerator
8generator = EnhancedMarbleSentenceGenerator()
9sentences = generator.generate_sentences(100)MarbleTransformer class:embed_dim - embedding sizenum_heads - attention headsnum_layers - transformer layersff_dim - feed-forward dimensionReal-Time Training Progress: MarbleTransformer
Epoch 15 | Train Loss: 1.234 | Val Loss: 1.456 | Val Acc: 0.78
┌─────────────────┬─────────────────┬─────────────────┐
│ Loss/Iteration │ Learning Rate │ Batch Accuracy │
│ (with moving │ (log scale) │ (real-time) │
│ average) │ │ │
└─────────────────┴─────────────────┴─────────────────┘
┌─────────────────┬─────────────────┬─────────────────┐
│ Train/Val Loss │ Val Accuracy │ Val Perplexity │
│ (epoch level) │ (trending up) │ (trending down) │
└─────────────────┴─────────────────┴─────────────────┘1# Each run captures:
2- Model configuration (vocab size, parameters, architecture)
3- Dataset information (files used, sentence count)
4- Training hyperparameters (batch size, learning rate, epochs)
5- Performance metrics (loss, accuracy, perplexity over time)
6- Final results and model paths1# Evolution tracking captures:
2- Vocabulary additions/removals (new colors, walls, etc.)
3- Rule modifications (collision rules, wall probabilities)
4- Version snapshots of language configuration
5- Performance impact of language changes1# View recent training runs
2python3 -c "
3from marble_language.utils.training_database import TrainingRunDatabase
4db = TrainingRunDatabase()
5runs = db.get_training_runs(10)
6for run in runs:
7 print(f'{run[\"run_id\"]}: Acc={run[\"best_val_accuracy\"]:.3f}')
8"
9
10# Get best performing models
11python3 -c "
12db = TrainingRunDatabase()
13best = db.get_best_runs('best_val_accuracy', 5)
14print('Top 5 models by accuracy:')
15for run in best:
16 print(f' {run[\"timestamp\"]}: {run[\"best_val_accuracy\"]:.4f}')
17"1# Demo the terminal plotting system
2python3 demo_terminal_plotting.py
3
4# Run actual training - plots will show in terminal
5python3 marble_transformer_pretraining.py✓ Terminal ASCII plotting enabled
Loss plots will be displayed in terminal every 25 iterations
(More frequent for shorter training runs)
================================================================================
TRAINING PROGRESS
================================================================================
Training Statistics:
Current Loss: 1.234
Min Loss: 0.856
Trend: ↓ decreasing
Loss Plot (iterations 0-500)
┌────────────────────────────────────────────────────────────────────────────────┐
│* │ 2.000
│ * │ 1.800
│ ** │ 1.600
│ *** │ 1.400
│ **** │ 1.200
│ ****** │ 1.000
│ ******** │ 0.800
└────────────────────────────────────────────────────────────────────────────────┘
================================================================================1# Install plotting dependencies
2python3 install_dependencies.py
3
4# Or manually:
5pip3 install matplotlib numpy--break-system-packages or create virtual environmentpython3-tk package: sudo apt-get install python3-tk1# Create enhanced dataset with wall collisions
2python3 -m marble_language.core.generator 1000
3
4# Or use legacy generator
5python3 MarbleSentenceGenerator.py 1000python3 install_dependencies.py1python3 -c "
2import sys
3missing = []
4for pkg in ['torch', 'numpy', 'matplotlib']:
5 try:
6 __import__(pkg)
7 print(f'✓ {pkg}')
8 except ImportError:
9 print(f'❌ {pkg}')
10 missing.append(pkg)
11if missing:
12 print(f'Install: pip3 install {\" \".join(missing)}')
13"