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.22.8.11.tar.gz (8.3 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.22.8.11.tar.gz.

File metadata

File hashes

Hashes for lightning_trainer_utils-2025.5.22.8.11.tar.gz
Algorithm Hash digest
SHA256 9171c44b12f46bf41e4452cca6be979273373b2160ee9db3143d708d70227e84
MD5 94ad218f95c35ef4049422171553c289
BLAKE2b-256 114c997c6188bc6ebc0eb91b9de1cc339a77d0a7cc635e9f98867cd96dd029be

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for lightning_trainer_utils-2025.5.22.8.11-py3-none-any.whl
Algorithm Hash digest
SHA256 add4733fc36f098487cc45a37f5e647618bf26184fd849156b02bcbdf540a92f
MD5 fa6e7e6dffda18ae01242a46e281aeb8
BLAKE2b-256 9745aaa651268b347dfb6417a4285d5e491431ee4a7bf14a6a8d655dbf59ecd7

See more details on using hashes here.

Provenance

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