Example with pytorch-cifar¶
Note
If Oríon not installed: pip install orion
If the database is not setup, you can follow the instructions here: Setup Database.
Alternatively, you can test the example without setting up a database by using the option –debug, but note that all data gathered during an execution will be lost at the end of it.
pip3 install torch torchvision
git clone git@github.com:kuangliu/pytorch-cifar.git
cd pytorch-cifar
sed -i '1 i\#!/usr/bin/env python' main.py
Add to last line of test()
return 1 - (correct / len(test_loader.dataset))
Last line of the main() function
test_error_rate = test(epoch)
report_results([dict(
name='test_error_rate',
type='objective',
value=test_error_rate)])
orion -v hunt -n resnet18-cifar10 python main.py --lr~'loguniform(1e-5, 1.0)'
Note
If you are using python3, the script will fail with message
ImportError: No module named 'vgg'
You can fix this with the following command from the repository’s root.
sed -i 's/from /from ./g' models/__init__.py