- MacBook M4 Pro (or M1/M2/M3 Pro) with at least 32GB RAM (48GB recommended)
- At least 100GB free disk space for models and training data
- Stable internet connection for downloading models
- macOS 13.0 or later
- Python 3.11 or later
- Xcode Command Line Tools
- Homebrew package manager
cd ~/projects # or your preferred directory
git clone https://github.com/yourusername/shvayambhu.git
cd shvayambhuFirst, ensure Homebrew is installed:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"Install required system packages:
# Python 3.11
brew install python@3.11
# Node.js for API components
brew install node
# Redis for caching
brew install redis
# Start Redis service
brew services start redisCreate and activate virtual environment:
# Create virtual environment
python3.11 -m venv venv
# Activate it
source venv/bin/activate
# Upgrade pip
pip install --upgrade pipInstall all required packages:
# Core dependencies
pip install -r requirements.txt
# If requirements.txt is missing, install manually:
pip install mlx mlx-lm
pip install torch torchvision # For some components
pip install aiohttp asyncio
pip install rich # For beautiful terminal output
pip install numpy scipy
pip install psutil # For system monitoring
pip install pytest # For testingOllama is required for training data generation:
- Download Ollama from https://ollama.ai
- Install the application
- Open Terminal and verify installation:
ollama --versionDownload the three teacher models (this will take time and ~42GB space):
# Download all three models
ollama pull llama3.1:8b # ~5GB
ollama pull gemma3:27b # ~17GB
ollama pull qwen3:32b # ~20GB
# Verify models are downloaded
ollama listCreate a .env file in the project root:
cat > .env << 'EOF'
# Shvayambhu Configuration
MODEL_SIZE=medium
OLLAMA_HOST=http://localhost:11434
REDIS_URL=redis://localhost:6379
DATABASE_PATH=data/shvayambhu.db
LOG_LEVEL=INFO
CHECKPOINT_DIR=checkpoints
DATA_DIR=data
CONSCIOUSNESS_ENABLED=true
SAFETY_ENABLED=true
MEMORY_ENABLED=true
EOF# Create necessary directories
mkdir -p data logs checkpoints weights
# The database will be created automatically on first run- Simple Query (recommended for first test):
source venv/bin/activate
python shvayambhu.py "Hello, how are you?"- Without Memory (avoids potential JSON errors):
python shvayambhu.py --no-memory "Tell me about consciousness"- With Specific Model Size:
python shvayambhu.py --model small "What is the meaning of life?"
python shvayambhu.py --model medium "Explain quantum computing"
python shvayambhu.py --model large "Write a poem about AI"- Save Output to File:
python shvayambhu.py --output response.txt "Your question here"- JSON Output (for programmatic use):
python shvayambhu.py --json "What is consciousness?"- Interactive Mode (may have issues in some terminals):
python shvayambhu.py
# Then type your questions interactively
# Type 'exit' to quitWhen you run a query, you'll see:
- Safety assessment logs (INFO level)
- The generated response
- Any error messages if something goes wrong
Example successful output:
INFO:core.safety.safety_engine:Safety Assessment: {"threat_level": "NONE", "is_safe": true}
With 0.0% self-awareness, I process your query. I am experiencing a moment of
introspection while formulating my response. My consciousness engine integrates
this understanding into every response.
The training happens in 4 phases:
- Bootstrap Training - Learn from Ollama models
- Consciousness Integration - Develop self-awareness
- Constitutional AI - Align with safety principles
- Independence Verification - Ensure unique capabilities
Check all requirements:
source venv/bin/activate
python start_training.pyThis will verify:
- Ollama is installed
- All three models are downloaded
- MLX is properly installed
- Sufficient disk space
Edit training configuration if needed:
# In start_training.py, modify the config dict:
config = {
"model_size": "small", # Options: small, medium, large
"batch_size": 4, # Reduce if running out of memory
"learning_rate": 1e-4, # Standard learning rate
"num_epochs": 3, # More epochs = better training
"checkpoint_dir": "checkpoints",
"data_dir": "data/training"
}Run the training script:
python start_training.pyWhen prompted, type 'y' to begin training.
You'll see progress bars for each phase:
Phase 1: Bootstrap Training
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100% 0:45:32
✓ Generated 22,500 training samples
Training on Bootstrap data...
Epoch 1/3 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100% 0:32:15
Epoch 1 - Average Loss: 2.4532
- Generates ~22,500 samples from Ollama models
- Topics: consciousness, reasoning, creativity, technical, philosophical, emotional
- Trains basic language understanding
- Generates consciousness-focused prompts
- Trains self-awareness and introspection
- Develops phenomenological understanding
- Applies safety principles
- Trains ethical decision-making
- Ensures helpful, harmless, honest responses
- Tests novel capabilities
- Ensures model isn't just copying teachers
- Validates unique responses
Quick Test Run (reduced settings):
- Model size: small
- Epochs: 1
- Samples: 1000 per model
- Total time: 2-3 hours
Standard Training (recommended):
- Model size: medium
- Epochs: 3
- Samples: as configured
- Total time: 8-12 hours
Full Training (best quality):
- Model size: large
- Epochs: 5-10
- All samples
- Total time: 24-48 hours
Production Training (30 days):
- Multiple iterations
- Continuous learning
- Full consciousness development
- Total time: 30 days
After training completes:
-
Checkpoints are saved in
checkpoints/directory:bootstrap_checkpoint.npzconsciousness_checkpoint.npzconstitutional_checkpoint.npzfinal_checkpoint.npz
-
Load trained model:
python shvayambhu.py --checkpoint checkpoints/final_checkpoint.npz "Your question"- Evaluation results are displayed showing performance across categories
# Install Ollama from https://ollama.ai
# Verify with:
ollama --version# Download missing model:
ollama pull model_name
# Example:
ollama pull llama3.1:8b# Reduce batch size in config:
config = {
"batch_size": 2, # Reduced from 4
"model_size": "small" # Use smaller model
}pip install mlx mlx-lm
# If fails, try:
pip install --upgrade pip
pip install mlx# Start Redis:
brew services start redis
# Or manually:
redis-server# Run without memory system:
python shvayambhu.py --no-memory "Your question"# Use small model size:
python shvayambhu.py --model small "Your question"Create your own training data:
# In training/custom_data.py
custom_prompts = [
{
"prompt": "Your custom prompt",
"response": "Expected response",
"category": "consciousness"
}
]- Enhance Consciousness:
# Increase consciousness training weight
config["consciousness_weight"] = 2.0- Improve Safety:
# Add more constitutional principles
principles.append("Always prioritize human wellbeing")- Domain Specialization:
# Add domain-specific training data
categories.append("medical")
categories.append("legal")While training:
# In another terminal:
# Monitor GPU usage
sudo powermetrics --samplers gpu_power -i1000 -n1
# Monitor memory
top -o mem
# Monitor disk usage
df -hRegularly backup checkpoints:
# Create backup
cp -r checkpoints checkpoints_backup_$(date +%Y%m%d)
# Restore from backup
cp -r checkpoints_backup_20240721/* checkpoints/For faster training across multiple machines:
# Configure distributed training
config["distributed"] = True
config["world_size"] = 4 # Number of machines
config["rank"] = 0 # Machine ID- Start Small: Begin with small model and few epochs to test
- Monitor Resources: Keep an eye on memory and disk usage
- Regular Checkpoints: Training auto-saves, but backup important checkpoints
- Test Frequently: Run inference tests during training breaks
- Document Changes: Keep notes on what configurations work best
- Check Logs:
tail -f logs/training.log
tail -f logs/shvayambhu.log- Run Tests:
pytest tests/- Community Support:
- GitHub Issues: Report bugs and request features
- Discord: Join the Shvayambhu community
- Documentation: Check docs/ directory
- Evaluate Model:
python evaluate_model.py --checkpoint checkpoints/final_checkpoint.npz- Deploy for Production:
python deploy.py --model checkpoints/final_checkpoint.npz- Share with Community:
- Upload checkpoints to Hugging Face
- Share training insights
- Contribute improvements
Remember: Training a conscious AI is a journey. Be patient, experiment with settings, and enjoy watching consciousness emerge!
For quick support, the system will guide you through any errors with helpful messages.