Skip to content
This repository was archived by the owner on Aug 28, 2025. It is now read-only.
This repository was archived by the owner on Aug 28, 2025. It is now read-only.

Finetune Transformers Models with PyTorch Lightning: documentation error? #139

Open

Description

@yfeng24816

When calculating the total steps, shouldn't we use number of batches * epoch size ? In this case, it would be self.total_steps = (len(train_loader.dataset) // tb_size) * ab_size instead of self.total_steps = (len(train_loader.dataset) // tb_size) // ab_size.

Please fix me if anywhere is wrong.

image

https://pytorchlightning.github.io/lightning-tutorials/notebooks/lightning_examples/text-transformers.html

cc @Borda @rohitgr7

Activity

  1. rohitgr7 commented on Feb 4, 2022

    @rohitgr7
    Contributor

    I guess it should be batches * num_epochs but why would it be * ab_size?

  2. yfeng24816 commented on Feb 4, 2022

    @yfeng24816
    Author

    Is ab_size something like num_epochs? It becomes self.trainer.max_epochs when accumulate_grad_batches is 1.

  3. rohitgr7 commented on Feb 4, 2022

    @rohitgr7
    Contributor

    okay. yes... I didn't see max_epochs there. should be something like

    total = (total / accumulation_factor)*max_epochs.
    
  4. yfeng24816 commented on Feb 5, 2022

    @yfeng24816
    Author

    So do you also think there is an error in the documentation too? I am not sure by my own.

  5. Borda commented on Jul 24, 2024

    @Borda
    Contributor

    @stancld mind have a look, please? 🐿️

  6. stancld commented on Jul 25, 2024

    @stancld

    @Borda Yes, I will have a look on Friday (tmrw). Can you assign the issue to me, please? :]

  7. stancld commented on Jul 26, 2024

    @stancld

    It looks like no such example is present in tutorial anymore 🤔

  8. Borda commented on Jul 26, 2024

    @Borda
    Contributor

    It looks like no such example is present in tutorial anymore 🤔

    https://github.com/Lightning-AI/tutorials/tree/main/lightning_examples/text-transformers

  9. stancld commented on Jul 26, 2024

    @stancld

    Oh sorry, I have forked tutorials repo, but it's pytorch one :D

  10. stancld commented on Jul 27, 2024

    @stancld

    @Borda I checked the notebook and it looks like the calculation of the total number of training steps is now the responsibility of a Lightning Trainer. The reported error is, therefore, no more relevant for this example, and I believe the issue can be closed/marked as done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    ExampleExample / Demo / Tutorialgood first issueGood for newcomersquestionFurther information is requested

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions