8000 GitHub - tom-doerr/mnist_dspy
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
8000

tom-doerr/mnist_dspy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🔢 MNIST Classification with DSPy

Repository's starts Issues License
Latest commit GitHub repository size

MNIST digit classification using DSPy framework with support for various LLM backends. Configure optimizers and training iterations for optimal performance.

output.mp4

🚀 Features

  • DSPy-powered MNIST classification with support for multiple LLM backends
  • Flexible optimizer selection (MIPROv2, BootstrapFewShot)
  • Configurable training iterations and worker threads
  • Model selection (supports any LLM compatible with DSPy)
  • Response caching for faster iterations

📦 Installation

git clone https://github.com/tom-doerr/mnist_dspy.git
cd mnist_dspy
pip install -r requirements.txt

🧠 Project Structure

mnist_dspy/
├── mnist_trainer.py    # Main training script with optimizer selection
├── mnist_data.py       # MNIST data loading and preprocessing
└── mnist_dspy.py       # DSPy model definitions

🏁 Basic Usage

Train a model with specific optimizer and iterations:

# Use MIPROv2 optimizer with light optimization
python mnist_trainer.py --optimizer MIPROv2 --iterations 1 --model your-llm-model --auto light

# Use MIPROv2 with medium optimization and caching disabled
python mnist_trainer.py --optimizer MIPROv2 --iterations 1 --model your-llm-model --auto medium --no-cache

# Use BootstrapFewShot optimizer with custom number of workers
python mnist_trainer.py --optimizer BootstrapFewShot --iterations 1 --model your-llm-model --num-workers 50

🔧 Configuration Options

  • --optimizer: Choose between 'MIPROv2' or 'BootstrapFewShot' (default: MIPROv2)
  • --iterations: Number of optimization iterations (default: 1)
  • --model: Model identifier for your LLM
  • --auto: Optimization intensity for MIPROv2 ['light', 'medium', 'heavy'] (default: light)
  • --num-workers: Number of worker threads (default: 100)
  • --no-cache: Disable LLM response caching

📊 Data Processing

The trainer:

  • Uses a subset of MNIST data for faster experimentation
  • Processes 10,000 training examples
  • Evaluates on 200 test examples
  • Supports multi-threaded evaluation

📄 License

Distributed under the MIT License. See LICENSE for more information.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
0