No more excuses for bad models. >70 Optimizers. All explained. All pre-configured.
Project description
pyrodigy 🔥
pyrodigy is a Python wrapper around more than 70 optimizers from pytorch_optimizer, along with some additional custom optimizers. Designed for flexibility, pyrodigy offers easy configuration management, history tracking, and a CLI for convenience.
Features
- Access to 70+ Optimizers: Use a variety of optimizers, from well-known ones to niche algorithms.
- Config Management: View, add, set, or remove optimizer configurations directly from the CLI.
- History Tracking: Track optimizer instantiations with detailed history, including timestamps, parameters, and caller information.
- Customizable TTL: Automatically clear history entries older than a specified time-to-live (TTL).
- Rich CLI Interface: Manage configurations, view documentation, and explore history—all from the command line.
Installation
Install pyrodigy using Poetry:
poetry install
poetry shell
Usage
CLI Commands
The CLI commands allow you to list optimizers, manage configurations, and handle history entries.
List Available Optimizers
Displays a list of optimizers with both config and documentation:
pyrodigy list
Show Optimizer Documentation
Prints the Markdown documentation for the specified optimizer:
pyrodigy show <optimizer_name>
Configuration Management
Manage optimizer configurations using the config command with get, set, add, and rm actions.
- View Configuration:
pyrodigy config <optimizer_name> get
- Set Configuration: Update an existing configuration with new values (JSON format).
pyrodigy config <optimizer_name> set '{"default": {"lr": 0.01, "beta": 0.9}}'
- Add New Configuration: Add a new named configuration (JSON format).
pyrodigy config <optimizer_name> add <config_name> '{"lr": 0.02, "beta": 0.95}'
- Remove Configuration: Remove a named configuration.
pyrodigy config <optimizer_name> rm <config_name>
History Management
Each time an optimizer is instantiated, an entry is created in its history. You can review or clear history and apply a TTL to automatically remove old entries.
- Show History: View the history for an optimizer. Specify a TTL to filter entries within a certain timeframe.
pyrodigy history <optimizer_name> show --TTL 30d
Example with TTL:pyrodigy history a2grad show --TTL 60d
- Clear History: Remove all history entries for the optimizer.
pyrodigy history <optimizer_name> clear
Example: Using pyrodigy in Code
Instantiate an optimizer with pyrodigy’s Wrapper, which logs the creation details to the optimizer's history.
from pyrodigy.wrapper import Wrapper
# Define model parameters and optimizer configuration
params = model.parameters()
optimizer_name = "AdamP"
config_name = "default"
lr = 0.001
# Initialize the optimizer
optimizer = Wrapper(params, optimizer_name=optimizer_name, config_name=config_name, lr=lr)
History Entries
Every time you create an optimizer instance, the following details are saved:
- Optimizer Name: The name of the optimizer.
- Config Name: The configuration used, if provided.
- Parameters: Any additional parameters such as learning rate.
- Caller Information: File, line number, and function name where the optimizer was instantiated.
License
Licensed under the Apache License 2.0. See the LICENSE file for details.
Contributing
Contributions are welcome! If you find any issues or have suggestions, feel free to open an issue or submit a pull request.
Support
For questions or support, please open an issue on GitHub.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyrodigy-0.1.1.tar.gz.
File metadata
- Download URL: pyrodigy-0.1.1.tar.gz
- Upload date:
- Size: 7.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.10.10 Windows/10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ea588fd5182abe5bbc23ef65c75f71a623349b34ffc1397908b23528cce882c4
|
|
| MD5 |
665ec4a33449ad8a7fe284347b52be07
|
|
| BLAKE2b-256 |
9a4a0ff419974d571bbe41589557b2b010ecf181b3d4d86140a30d60ea85645e
|
File details
Details for the file pyrodigy-0.1.1-py3-none-any.whl.
File metadata
- Download URL: pyrodigy-0.1.1-py3-none-any.whl
- Upload date:
- Size: 8.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.10.10 Windows/10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
73b2b489154e89b6b4bb6180542a91bdebe0575b6a2e077a52cf8a57da9afb08
|
|
| MD5 |
b74e05da1c62344046c54b66006272f9
|
|
| BLAKE2b-256 |
86b989d06c20f573775eb85fc2cc2109176243b29af8de291197a149c59b530f
|