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.23.20.32.tar.gz (10.9 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.23.20.32.tar.gz.

File metadata

File hashes

Hashes for lightning_trainer_utils-2025.5.23.20.32.tar.gz
Algorithm Hash digest
SHA256 f43db6faa330a111c29c4b2221c9bebb5a3522f0e9ad00222102d8b07cb4f749
MD5 8ccea57860275fc3d594567ffa463737
BLAKE2b-256 ad37a754bcf7d096eb1241d11684e83946d86480aee9bcaf9c6a2eb971128f45

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for lightning_trainer_utils-2025.5.23.20.32-py3-none-any.whl
Algorithm Hash digest
SHA256 76e53b6870aac14ca4842a951cb3b3cd8ce9006ef5fca01072bf4c8564dfb7bf
MD5 8f53efb88e90a4414d34b3b48501ea18
BLAKE2b-256 51f0a1d0fa6bea56cbe23aba9988860e012c0378ffd605ca4b318a53a60a8042

See more details on using hashes here.

Provenance

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