Lightning-AI / pytorch-lightning

Pretrain, finetune ANY AI model of ANY size on multiple GPUs, TPUs with zero code changes.
https://lightning.ai
Apache License 2.0
28.32k stars 3.38k forks source link

Email Callback on training done #20133

Open loucaspapalazarou opened 3 months ago

loucaspapalazarou commented 3 months ago

Description & Motivation

A simple callback that accepts a user's email and an app account password to notify the user that their training is complete by email. Inspired by wandb

The call back will use the user's email as both sender and receiver so no need for an external SMTP.

email = johndoe@gmail.com
password = os.getenv("EMAIL_PASSWORD")
email_callback = EmailCallback(email, password)

trainer = Trainer(
        ...
        callbacks=[email_callback],
    )

Screenshot 2024-07-28 124011

Could also add details on how the training went, like test or validation measures. We could also add graphs and make it an entire report. It can get as detailed as we want. It's also possible to notify the used of any potential crashes.

Would love to work on this if approved!

Pitch

A lot of the time, training takes up a number of hours and users keep checking up on their models manually. An automatic notification on a user's phone where they can't miss it will speed up the development process.

Alternatives

Users manually create the callback.

Additional context

No response

cc @borda

Sar2580P commented 3 months ago

The callback for training notification would be really helpful...

I would like to make contribution for this... Please assign me the issue. Thanks...

loucaspapalazarou commented 3 months ago

@Sar2580P I opened it because I really wanted to work on it so I would love to make the PR myself but thanks for reaching out <3

Sar2580P commented 3 months ago

No problem bro, go ahead with it.... Best of Luck

loucaspapalazarou commented 3 months ago

@Sar2580P Thank you bro, I will as soon as the mods feel approve it

awaelchli commented 2 months ago

Hey @loucaspapalazarou The callback looks great but could we first gather some feedback from the community to make sure enough users want/can use this so it's justified to maintain it within the package?

loucaspapalazarou commented 2 months ago

Hey @awaelchli, yup that sounds great!