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.26.15.14.tar.gz (11.0 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.26.15.14.tar.gz.

File metadata

File hashes

Hashes for lightning_trainer_utils-2025.5.26.15.14.tar.gz
Algorithm Hash digest
SHA256 c4763de2d5de157dcca9bc8d0aeaab19112f7547635bbd11d19b35e28d5051b4
MD5 b98f79d513af728aa18addc4546c641f
BLAKE2b-256 7a6d4314d0afde62527db27bac8d136da47f508dddfb45894aefca309546c2ea

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for lightning_trainer_utils-2025.5.26.15.14-py3-none-any.whl
Algorithm Hash digest
SHA256 81231e15d17472b53eb835c06f3a37db6ead078cd4796e5d9eaaaba6282de1f5
MD5 cbeb13cd6dc0f3e293b0606982a2ff9b
BLAKE2b-256 2b5daea6b79107f73128cf330db8ff77e29ed33ac801a56c9a31216fd324788c

See more details on using hashes here.

Provenance

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