Skip to main content

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/Elegun-20241029T091808Z-001.zip
unzip Elegun-20241029T091808Z-001.zip -d ./data/ECON

Download the Fusion dataset

Soon available!

Train the models

  1. 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
  1. 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
  1. 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pylandscape-0.0.18.tar.gz (16.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pylandscape-0.0.18-py3-none-any.whl (20.8 kB view details)

Uploaded Python 3

File details

Details for the file pylandscape-0.0.18.tar.gz.

File metadata

  • Download URL: pylandscape-0.0.18.tar.gz
  • Upload date:
  • Size: 16.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for pylandscape-0.0.18.tar.gz
Algorithm Hash digest
SHA256 3be9bf208f5c0648ad8161019ecaaea10522d0a60c58d4d3a17ac1d6800234f0
MD5 f8320c8988a401f9a017ac083554e2d2
BLAKE2b-256 0871196fbc7007d1ff2a57116ece05eb803be0f4fdd072ede4d2b89d09550b2b

See more details on using hashes here.

Provenance

The following attestation bundles were made for pylandscape-0.0.18.tar.gz:

Publisher: release.yml on balditommaso/PyLandscape

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pylandscape-0.0.18-py3-none-any.whl.

File metadata

  • Download URL: pylandscape-0.0.18-py3-none-any.whl
  • Upload date:
  • Size: 20.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for pylandscape-0.0.18-py3-none-any.whl
Algorithm Hash digest
SHA256 41fa9f7701168316072c0b1ec4326a0fa9cfa9562f2b4fadc1760f7392ae1eb7
MD5 63de7d1f4df887d6b8d2737f48e19025
BLAKE2b-256 fb0b4d9d244726d80319c0abab29b6578868a3d2c4b9feedbf8e7bc09bf9f5e3

See more details on using hashes here.

Provenance

The following attestation bundles were made for pylandscape-0.0.18-py3-none-any.whl:

Publisher: release.yml on balditommaso/PyLandscape

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page