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.12.25.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.12.25.tar.gz.

File metadata

File hashes

Hashes for lightning_trainer_utils-2025.5.26.12.25.tar.gz
Algorithm Hash digest
SHA256 9eba66e3c6658b7724b72353932da5a7ca446961ff538c74b3a4686cb14dd868
MD5 e019345b80325fc2536f33d180323338
BLAKE2b-256 9bf6f0884d148c2a019e61049cb205dd727b382ae77b933aa9f519f7e53e36bf

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for lightning_trainer_utils-2025.5.26.12.25-py3-none-any.whl
Algorithm Hash digest
SHA256 abaaa1b5007f5cea2b9fdd421cae7a30a26bcbec658ccf3875fc675dbc863019
MD5 35a4e435412576819cec898b73aacecf
BLAKE2b-256 0dff313fc84b91cb9d417731ed9dafc91cf03a824764a0ad31d821eeaf0e3f77

See more details on using hashes here.

Provenance

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