Skip to main content

A Python package for using PyTorch Lightning with custom callbacks and model wrappers.

Project description

PyPI version

PyTorch Lightning Trainer Utilities

Installation

pip install lightning-trainer-utils

ML Model Assumptions

forward

  • The model wrapper uses the forward function as follows:
    output = self.model(**x, **self.forward_kwargs)
    return ModelOuput(**output)

It expects batch as dict and returns a dict with keys [loss, report, output].

return

  • ML model should return a dict with the following keys:
    • loss
    • report
    • output [optional]

Trainer

Global Step

batch_step = num_samples / (batch_size * num_devices) trainer_global_step = num_samples / (batch_size * num_devices * grad_accumulation) SaveCheckpoint also use trainer_global_step.

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

lightning_trainer_utils-2025.5.20.14.0.tar.gz (8.7 kB view details)

Uploaded Source

Built Distribution

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

File details

Details for the file lightning_trainer_utils-2025.5.20.14.0.tar.gz.

File metadata

File hashes

Hashes for lightning_trainer_utils-2025.5.20.14.0.tar.gz
Algorithm Hash digest
SHA256 6fdb217459a3bab14a2653ccacec01e5c9d8afc270d78a1b605e4a9c1d66d62b
MD5 8e2161ec0d201547107aec4f405b6a3a
BLAKE2b-256 854c4335853f26a697c5a4bf06809342cfdae67aa11f7dbd1c428d22425cadcb

See more details on using hashes here.

Provenance

The following attestation bundles were made for lightning_trainer_utils-2025.5.20.14.0.tar.gz:

Publisher: workflow.yaml on manavmahan/lightning-trainer-utils

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

File details

Details for the file lightning_trainer_utils-2025.5.20.14.0-py3-none-any.whl.

File metadata

File hashes

Hashes for lightning_trainer_utils-2025.5.20.14.0-py3-none-any.whl
Algorithm Hash digest
SHA256 971d9516ec19d81a0921a582286ca844e17c34ee12367013bbf63c997817bd28
MD5 8ae73df57a2ce225cfde599af83649d9
BLAKE2b-256 90a1d1405182ce9863f033888cce74ee9eb13e569b7531ca17a26c69ad95a35f

See more details on using hashes here.

Provenance

The following attestation bundles were made for lightning_trainer_utils-2025.5.20.14.0-py3-none-any.whl:

Publisher: workflow.yaml on manavmahan/lightning-trainer-utils

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