run_vast
A command-line tool. Lets you put bash commands in markdown files, and runs them in parallel on many vast.ai instances.
Uses a waiting/running/fail/succeed state machine to represent every command. All state is contained in the markdown file, in human-readable and human-editable form.
I like to provision 10-20 Vast instances, usually with 4x4090s each, at the beginning of the day, with the same custom Dockerfile.
Vast lets me keep these nodes idle for very cheap. So by default, all instances are idle.
Then later, I will add a new ML experiment to my journal.md file. Every training run in the experiment is a bash command in a triple-backtick ```vast code block.
Then I run rv journal.md to run them all in parallel. Each Vast instance will go idle when its command succeeds.
If a run fails, the code block will be marked as ```vast:fail/012345, where 012345 is the instance ID of the machine it ran on. I can then ssh into the instance and debug my training run.
If a run starts up successfully, the code block will be marked as ```vast:running/012345.
Installation
pip install run_vast
rv journal.md
Usage
Make a list of commands you want to run
You should put these in a markdown file. Each command gets its own triple-backtick code block, annotated with vast.
For example, to train nanogpt with two different lrs:
# Train nanogpt with different lrs
lr=0.5 and lr=1.5:
```vast
git clone https://github.com/karpathy/nanogpt && \
cd nanogpt && \
pip install torch numpy transformers datasets tiktoken wandb tqdm && \
python data/shakespeare_char/prepare.py &&
python train.py config/train_shakespeare_char.py --min_lr=0.5e-4
```
```vast
git clone https://github.com/karpathy/nanogpt && \
cd nanogpt && \
pip install torch numpy transformers datasets tiktoken wandb tqdm && \
python data/shakespeare_char/prepare.py &&
python train.py config/train_shakespeare_char.py --min_lr=1.5e-4
```
Set up your Vast account
You need to make an SSH key to connect to Vast instances.
Register your SSH key on the vast website, then put the private key in ~/.ssh/id_vast.
Run rv my_training_runs.md
rv will prompt you to provision two Vast instances, so it can run both commands in parallel.
Important: in the vast.ai web UI, before provisioning Vast instances, you must edit the instance template to set the environment variable IS_FOR_AUTORUNNING=1.
Remember to press the "+" button to save the environment variable.
Go to the Vast dashboard and wait for your instances to be "Connected"
This should take a minute or so.
Then, return to the rv prompt and press Enter to continue.
Wait for your commands to finish
You should track your runs via i.e. wandb. rv doesn't handle any logging for you.
Once your commands have finished, run rv journal.md.
It will move them from the vast:running/0123456 state to the vast:finished state.
License
MIT License
Metadata
Release files for run-vast 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| run_vast-0.3.0.tar.gz | 11.3 kB | Without provenance | Details for run_vast-0.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| run_vast-0.3.0-py3-none-any.whl | Python 3 | none | any | Details for run_vast-0.3.0-py3-none-any.whl |
Total release size: 21.5 kB
Release files / run_vast-0.3.0.tar.gz
| Download URL | run_vast-0.3.0.tar.gz |
|---|---|
| Size | 11.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7e3ac5e934c0a02a22d77ea9813e34ffd60b2b500618665cafa731b65631418b
|
|
BLAKE2b-256 checksum How to use checksums |
2f29843d3e679082c6473d3b46f1da3a89be3255c13ade2b271caf993061bc42
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.7
|
Release files / run_vast-0.3.0-py3-none-any.whl
| Download URL | run_vast-0.3.0-py3-none-any.whl |
|---|---|
| Size | 10.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e9b4bb693d5427711ce6c3eee331f5f40a0920d5596cccd5cf9ba0f649d6524d
|
|
BLAKE2b-256 checksum How to use checksums |
869040ce7dc38e1f3f008cf78d86302e21165a5c616a12defa502d04593a4547
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.7
|
Security for run-vast 0.3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.