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.19.15.16.tar.gz (8.6 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.19.15.16.tar.gz.

File metadata

File hashes

Hashes for lightning_trainer_utils-2025.5.19.15.16.tar.gz
Algorithm Hash digest
SHA256 0f2ddac5bb60adb4b60cf6f5de2bcd70b9a481d122ce4e0c0309f6de99df9aed
MD5 9f857c2fcbf52c2e5836ab6ab109a7ac
BLAKE2b-256 edd9e8f3ae112184223ae0afe5282fab54817db17c490f871c9da6ad8224c672

See more details on using hashes here.

Provenance

The following attestation bundles were made for lightning_trainer_utils-2025.5.19.15.16.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.19.15.16-py3-none-any.whl.

File metadata

File hashes

Hashes for lightning_trainer_utils-2025.5.19.15.16-py3-none-any.whl
Algorithm Hash digest
SHA256 ac590eb23293b963123db8f46b06edb9fe875512208871c51d0710cf7a936cbe
MD5 ae90c6f11c5df8b04a9cbd2a287d1875
BLAKE2b-256 5df249d541c3d5c525e2ae02276f7b3b7d0627e92f241b00b1d86252fc6a86f5

See more details on using hashes here.

Provenance

The following attestation bundles were made for lightning_trainer_utils-2025.5.19.15.16-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