pylandscape is a Pytorch library for loss landscape analysis of neural networks. The library enables computing the following metrics:
NOTE: All the functionalities relative to the computation of the Hessian metrics have been embedded via PyHessian. If your interested in learning more about how these metrics are computed have a look to their Repository.
You can install the library from pip:
pip install pylandscape
You can also compile the library from source
git clone https://github.com/balditommaso/PyLandscape.git
pip install -r requirements.txt
Hide for double blinded peer reviews.
Hide for double blinded peer reviews.
- Train full precision (FP32) version of the model:
. scripts/train.sh \
--config ./config/econ/baseline.yml \
--bs 1024 \
--lr 0.0015625 \
--device_id 0 \
--num_test 3 \
--full_precision
- Fine tune the models with QAT:
. scripts/train.sh \
--config ./config/large_econ/baseline_gaussian.yml \
--bs 1024 \
--lr 0.0015625 \
--device_id 0 \
--num_test 3 \
--pretrained
- Test the model both metrics and benchmarks
. scripts/test.sh \
--config ./config/econ/baseline.yml \
--bs 1024 \
--lr 0.0015625 \
--device_id 0 \
--max_processes 3 \
--num_models 3