Demonstration of how to structure a project with Hydra for easy deployment with Ray.
python -m pip install -r requirements.txt
python main.py
The default behavior of the application is determined by config/main.yaml
It's easy to override the default behavior of your application from the command line.
python main.py module=type_b
Any overrides will be stored in outputs/<DATE>/<TIME>
, along with the program logs in case you come back later and
can't remember what command was run.
You can easily run configuration sweeps without any additional boilerplate using the -m
option.
By default the basic launcher will schedule and execute the configurations serially.
python main.py -m module=type_a,type_b
You can use Ray to execute configurations in parallel. Thanks to the Hydra Ray plugin, you don't need to write any additional code!
python main.py -m hydra/launcher=ray module=type_a,type_b
Note: You must use the -m
option when using anything other than the basic launcher.
Ray can also spin up new clusters for you on EC2 and run your jobs in parallel. Here's the setup you'll need to do.
- Install the AWS CLI
- Configure your AWS access credentials
- Raise your service quota (if necessary)
- Configure IAM roles for ray nodes
This part of the demo requires a docker image. Try running the demo first using
the image I've created, then worry about
making your own. Look at config/hydra/launcher/ray_aws.yaml
to see configuration details.
cd /path/to/hydra-ray-demo
cd ..
docker build . -f hydra-ray-demo/Dockerfile --tag <DOCKERHUB_USER>/<IMAGE_NAME>:<TAG>
docker push <DOCKERHUB_USER>/<IMAGE_NAME>:<TAG>
Note: Keep the contents of the parent directory to a minimum for fastest build times.
After using docker for a while your storage will be quickly filled with fragments of previous images.
Use docker system prune -f
to clean that up.
python main.py -m hydra/launcher=ray_aws module=type_a,type_b