Zeroth-order optimization training and experiments
Project description
ZOTitan
A codebase for Zeroth-Order Optimization (ZO) training and experiments.
Supported algorithms:
- MeZO
- MeZO with momentum from seed reconstruction
- MeZO-Adam
- SPSA
- Evolutionary Strategies
- EGGROLL
Plus some other experimental features. You can mix and match pieces of all the above algorithms. See ./train.py --help for more details.
Setup
Requires Python 3.11+ and a CUDA GPU.
python3 -m venv .venv
.venv/bin/pip install .
./train.py --help
Training
./train.py
First-order training requires a differentiable objective. Zeroth-order treats the loss as a black box, so any scalar works. We support both. If the loss your objective returns is differentiable, you can just do:
./train.py --optimizer zo # MeZO (implied by default)
./train.py --optimizer fo # Adam (with gradients)
Objectives
The --objective flag takes a +-joined mixture spec. Each component selects a
dataset by name, optionally with weights and per-objective keyword config:
# Combine and weight a data mix
./train.py --objective "(scijudge,.5,1)+(c4)"
This trains a model on the c4 and scijudge objectives, where the scijudge loss is weighted half as strongly as the c4 loss.
You can also pass kwargs to the constructor of an objective like so:
./train.py --objective "(c4,z_loss_weight=0.1,fused=True)"
Here is the full grammar for the spec.
spec := component ("+" component)*
component := NAME | "(" NAME ("," field)* ")"
field := VALUE | KEY "=" VALUE
KEY := identifier
VALUE := "'" CHARS "'" | '"' CHARS '"' | LITERAL
LITERAL := int | float | True | False | None
CHARS := ... # Whatever you can put in a python string
- A bare
NAMEand any omitted weight default to1.0, soscijudge==(scijudge,1,1)and(c4,.5)==(c4,.5,1). - Keyword fields (
KEY=VALUE) come after the positional weights and are forwarded to that objective's constructor. - Bare values must be numeric /
True/False/None(and keep their type —rank=64is an int).
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 zotitan-0.1.0.tar.gz.
File metadata
- Download URL: zotitan-0.1.0.tar.gz
- Upload date:
- Size: 47.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
635b3121a080fb5f43b2d025f408bb856396b59579e0382fde39819533e355d7
|
|
| MD5 |
51505105b708b45ae6bb1c694791fe95
|
|
| BLAKE2b-256 |
a2f8e24bba9443f64cd4c709c7d190edc82da7500bbb4ff90e9c786b7a98d95a
|
Provenance
The following attestation bundles were made for zotitan-0.1.0.tar.gz:
Publisher:
publish.yml on apaz-cli/ZOTitan
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
zotitan-0.1.0.tar.gz -
Subject digest:
635b3121a080fb5f43b2d025f408bb856396b59579e0382fde39819533e355d7 - Sigstore transparency entry: 2104299594
- Sigstore integration time:
-
Permalink:
apaz-cli/ZOTitan@bb6df99f357b042754f2f0378fe3f48a31989229 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/apaz-cli
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@bb6df99f357b042754f2f0378fe3f48a31989229 -
Trigger Event:
push
-
Statement type:
File details
Details for the file zotitan-0.1.0-py3-none-any.whl.
File metadata
- Download URL: zotitan-0.1.0-py3-none-any.whl
- Upload date:
- Size: 54.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5aa446e93945408b9b28c89b79e0bf5cb77b3a23968622a40f8e003b9b5afaa3
|
|
| MD5 |
07df2e7d94e134a501f8316104341507
|
|
| BLAKE2b-256 |
8a602adcf88777d6a2293349bb69b4485426c95a9a38dc87eee64bece1af876c
|
Provenance
The following attestation bundles were made for zotitan-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on apaz-cli/ZOTitan
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
zotitan-0.1.0-py3-none-any.whl -
Subject digest:
5aa446e93945408b9b28c89b79e0bf5cb77b3a23968622a40f8e003b9b5afaa3 - Sigstore transparency entry: 2104299835
- Sigstore integration time:
-
Permalink:
apaz-cli/ZOTitan@bb6df99f357b042754f2f0378fe3f48a31989229 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/apaz-cli
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@bb6df99f357b042754f2f0378fe3f48a31989229 -
Trigger Event:
push
-
Statement type: