A simple tool for executing and managing shell commands
Project description
GridRun
GridRun is a simple tool that helps you to execute and manage similar shell commands. Originally, it is designed to perform grid-search of hyper-parameter in deep learning experiments. However, it can be used for other purposes as well.
Installation
install via pip
pip install grid_run
Usage
When you want to execute similar shell commands on a multi-gpu machine, you can use GridRun to generate sh commands and run in parallel.
Consider a simple use case, you want to find the best learning rate, you can use the following command:
from grid_run.runner import Runner
runner = Runner(log_name="lr_search")
exp_name = ["1e-3","1e-2","1e-1","1","10","100"]
lr = [0.001, 0.01, 0.1, 1, 10, 100]
# Do not write & to the end of the command, it will be added automatically.
template = "nohup python -u train.py --exp {} --lr {}"
train_instructions = runner.gen_instruction(template,[exp_name,lr])
gpus = [0,1]
runner.run(train_instructions,gpus = gpus)
# if you have less gpu, you can calculate the running time per job (e.g., 10 min), and run in sequence.
runner.run(train_instructions,gpus = [0], interval_time = 10)
Grid runner will log the running status as well as hparams to log directory. For example:
.
└── example_run
├── exp_0_gpu4.out
├── exp_1_gpu5.out
├── main.txt
└── param
├── args_train.json
└── template_train.json
This allows you to easily analyze the running status for each of hte experiments, as well as reproducing the experiment.
Others
GridRun is written in a extremely simple way (~100 lines). It is originally a custom script that I write in a hour, after finding it is tedious to execute batches of jobs manually. I will add more features later. Also, if you find any bugs or have any suggestions, please open an issue.
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 grid_run-0.2.tar.gz.
File metadata
- Download URL: grid_run-0.2.tar.gz
- Upload date:
- Size: 5.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a44ca1a61af17b9a7feb003a097c0bed27094be659c7a1581c1062a5eeb90fb3
|
|
| MD5 |
045deda617eb40354dd0b20946958286
|
|
| BLAKE2b-256 |
952d9e3be9062aa24b0ad1714d28187def01b3330593b482e223c8e1d59687ae
|
File details
Details for the file grid_run-0.2-py3-none-any.whl.
File metadata
- Download URL: grid_run-0.2-py3-none-any.whl
- Upload date:
- Size: 5.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
edd1a21a749fe3b89dbd62799693e436bd8e713a452e176dbec488f8e8a615dc
|
|
| MD5 |
340475eafee8ba8603ddb046185e428a
|
|
| BLAKE2b-256 |
846908b74705f9cbae52a7373e4c19496065dabc1f8c28458576aaf78951edd7
|