Python package to explore the loss landscape of Machine Learning models
Project description
PyLandscape
Introduction
pylandscape is a pytorch library for Hessian based analysis of neural network models. 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.
Usage
Install from Pip
You can install the library from pip:
pip install pylandscape
Install from source
You can also compile the library from source
git clone https://github.com/balditommaso/PyLandscape.git
pip install -r requirements.txt
Download the HGCAL dataset
You can download the dataset for the ECON-T model
wget -P ./data/ECON/ https://retis.santannapisa.it/~tbaldi/hgcal_dataset/hgcal22data_signal_driven_ttbar_v11.tar.gz
tar -xvf ./data/ECON/hgcal22data_signal_driven_ttbar_v11.tar.gz -C ./data/ECON
mv ./data/ECON/hgcal22data_signal_driven_ttbar_v11/nElinks_5/*.csv ./data/ECON/
Download the Fusion dataset
Soon available!
Train the models
- 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/econ/baseline.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
Citation
PyLandscape has been developed as part of the following paper. We appreciate it if you would please cite the following paper if you found the library useful for your work:
- T. Baldi, J. Campos, O. Weng, C. Geniesse, N. Tran, R. Kastner, A. Biondi. Loss Landscape Analysis for Reliable Quantized ML Models for Scientific Sensing, 2025, PDF.
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 pylandscape-0.0.16.tar.gz.
File metadata
- Download URL: pylandscape-0.0.16.tar.gz
- Upload date:
- Size: 14.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2d8ac41cf4b8c8f91e2439d6d16f709912e5a39db305c08c072aef0721b93af2
|
|
| MD5 |
7b153b17b9c804b0f14b15530ffcf279
|
|
| BLAKE2b-256 |
ac3e0faeb97c21d05f5fe91ccc61571a8d904c5a5700c087ca43ed63e457c741
|
Provenance
The following attestation bundles were made for pylandscape-0.0.16.tar.gz:
Publisher:
release.yml on balditommaso/PyLandscape
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pylandscape-0.0.16.tar.gz -
Subject digest:
2d8ac41cf4b8c8f91e2439d6d16f709912e5a39db305c08c072aef0721b93af2 - Sigstore transparency entry: 172952420
- Sigstore integration time:
-
Permalink:
balditommaso/PyLandscape@5ed18574bf11abedf50339f871050bdb5bf8cbac -
Branch / Tag:
refs/tags/0.0.16 - Owner: https://github.com/balditommaso
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@5ed18574bf11abedf50339f871050bdb5bf8cbac -
Trigger Event:
push
-
Statement type:
File details
Details for the file pylandscape-0.0.16-py3-none-any.whl.
File metadata
- Download URL: pylandscape-0.0.16-py3-none-any.whl
- Upload date:
- Size: 18.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
69e5c8b8de7c19af3357762cf811a9b38d38371e5992eb7acaa1c32611e3859d
|
|
| MD5 |
893825bb559fe3950c235d3ae2870a6e
|
|
| BLAKE2b-256 |
85042d40ab9a33044c290b6d252d1631d2b3d21feef2f489793a20c031d3a805
|
Provenance
The following attestation bundles were made for pylandscape-0.0.16-py3-none-any.whl:
Publisher:
release.yml on balditommaso/PyLandscape
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pylandscape-0.0.16-py3-none-any.whl -
Subject digest:
69e5c8b8de7c19af3357762cf811a9b38d38371e5992eb7acaa1c32611e3859d - Sigstore transparency entry: 172952422
- Sigstore integration time:
-
Permalink:
balditommaso/PyLandscape@5ed18574bf11abedf50339f871050bdb5bf8cbac -
Branch / Tag:
refs/tags/0.0.16 - Owner: https://github.com/balditommaso
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@5ed18574bf11abedf50339f871050bdb5bf8cbac -
Trigger Event:
push
-
Statement type: