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

Fix import bugs in text-transformers.py#103

Merged
Borda merged 8 commits intoLightning-AI:mainfrom
hankyul2:main
Dec 3, 2021
Merged

Fix import bugs in text-transformers.py#103
Borda merged 8 commits intoLightning-AI:mainfrom
hankyul2:main

Conversation

@hankyul2
Copy link
Copy Markdown
Contributor

@hankyul2 hankyul2 commented Oct 29, 2021

Add torchtext version in .meta.yaml

closes #97

Before submitting

  • Was this discussed/approved via a Github issue? (no need for typos and docs improvements)
  • Did you make sure to update the docs?
  • Did you write any new necessary tests?

What does this PR do?

Fixes #97.
In short, I try to fix import bugs in text-transformers.py by add torchtext>=0.9 as requirements.

PR review

Anyone in the community is free to review the PR once the tests have passed.
If we didn't discuss your PR in Github issues there's a high chance it will not be merged.

Did you have fun?

Of course, I do! 😁

- Add torchtext version in .meta.yaml

close Lightning-AI#97
@Borda Borda added the bug / fix Something isn't working label Nov 4, 2021
@Borda Borda enabled auto-merge (squash) November 29, 2021 20:48
@Borda
Copy link
Copy Markdown
Contributor

Borda commented Nov 29, 2021

@hankyul2 mind fixing the failing cells, I have tried, but you have lock PR so maintainers can't edit it...

@hankyul2
Copy link
Copy Markdown
Contributor Author

@Borda Ok. I will try to fix it.

@hankyul2
Copy link
Copy Markdown
Contributor Author

hankyul2 commented Nov 30, 2021

@Borda
I am so sorry, but what do failing cells mean?

@Borda
Copy link
Copy Markdown
Contributor

Borda commented Nov 30, 2021

I am so sorry, but what do failing cells mean?

you can see the full test here: https://dev.azure.com/PytorchLightning/Tutorials/_build/results?buildId=44840&view=logs&j=86bb8c30-297f-58f2-418d-1ad5be677653&t=16cfed9e-a41b-5b0e-892e-bf130fd21fce

the particular error is:

    738             self._fit_impl, model, train_dataloaders, val_dataloaders, datamodule, ckpt_path
    739         )

~/.local/lib/python3.9/site-packages/pytorch_lightning/trainer/trainer.py in _call_and_handle_interrupt(self, trainer_fn, *args, **kwargs)
    680         """
    681         try:
--> 682             return trainer_fn(*args, **kwargs)
    683         # TODO: treat KeyboardInterrupt as BaseException (delete the code below) in v1.7
    684         except KeyboardInterrupt as exception:

~/.local/lib/python3.9/site-packages/pytorch_lightning/trainer/trainer.py in _fit_impl(self, model, train_dataloaders, val_dataloaders, datamodule, ckpt_path)
    770         # TODO: ckpt_path only in v1.7
    771         ckpt_path = ckpt_path or self.resume_from_checkpoint
--> 772         self._run(model, ckpt_path=ckpt_path)
    773 
    774         assert self.state.stopped

~/.local/lib/python3.9/site-packages/pytorch_lightning/trainer/trainer.py in _run(self, model, ckpt_path)
   1132         self.call_hook("on_before_accelerator_backend_setup")
   1133         self.accelerator.setup_environment()
-> 1134         self._call_setup_hook()  # allow user to setup lightning_module in accelerator environment
   1135 
   1136         # check if we should delay restoring checkpoint till later

~/.local/lib/python3.9/site-packages/pytorch_lightning/trainer/trainer.py in _call_setup_hook(self)
   1432         if self.datamodule is not None:
   1433             self.datamodule.setup(stage=fn)
-> 1434         self.call_hook("setup", stage=fn)
   1435 
   1436         self.training_type_plugin.barrier("post_setup")

~/.local/lib/python3.9/site-packages/pytorch_lightning/trainer/trainer.py in call_hook(self, hook_name, pl_module, *args, **kwargs)
   1494             model_fx = getattr(pl_module, hook_name, None)
   1495             if callable(model_fx):
-> 1496                 output = model_fx(*args, **kwargs)
   1497 
   1498             # *Bad code alert*

/tmp/ipykernel_421/309689209.py in setup(self, stage)
     71             return
     72         # Get dataloader by calling it - train_dataloader() is called after setup() by default
---> 73         train_loader = self.train_dataloader()
     74 
     75         # Calculate total steps

~/.local/lib/python3.9/site-packages/pytorch_lightning/core/hooks.py in train_dataloader(self)
    475                 return {'mnist': mnist_loader, 'cifar': cifar_loader}
    476         """
--> 477         raise NotImplementedError("`train_dataloader` must be implemented to be used with the Lightning Trainer")
    478 
    479     def test_dataloader(self) -> EVAL_DATALOADERS:

NotImplementedError: `train_dataloader` must be implemented to be used with the Lightning Trainer

=============================== warnings summary ===============================
../../../usr/local/lib/python3.9/dist-packages/_pytest/config/__init__.py:1183
  /usr/local/lib/python3.9/dist-packages/_pytest/config/__init__.py:1183: PytestDeprecationWarning: The --strict option is deprecated, use --strict-markers instead.
    self.issue_config_time_warning(

-- Docs: https://docs.pytest.org/en/stable/warnings.html
=========================== short test summary info ============================
FAILED lightning_examples/text-transformers/text-transformers.ipynb::Cell 5
FAILED lightning_examples/text-transformers/text-transformers.ipynb::Cell 6

auto-merge was automatically disabled December 2, 2021 00:03

Head branch was pushed to by a user without write access

@hankyul2
Copy link
Copy Markdown
Contributor Author

hankyul2 commented Dec 2, 2021

@Borda I changed code and the failing cells seem to be fixed now.

@Borda Borda enabled auto-merge (squash) December 2, 2021 10:33
@Borda
Copy link
Copy Markdown
Contributor

Borda commented Dec 2, 2021

I changed code and the failing cells seem to be fixed now.

cool, could you please also update the update date in meta file to be today and reset nb build :]

auto-merge was automatically disabled December 2, 2021 11:14

Head branch was pushed to by a user without write access

@hankyul2
Copy link
Copy Markdown
Contributor Author

hankyul2 commented Dec 2, 2021

@Borda
Thank you for your detailed instruction:)
I changed the updated date and build number.
Can you give me a hint about how to fix this check error

@Borda
Copy link
Copy Markdown
Contributor

Borda commented Dec 2, 2021

Can you give me a hint about how to fix this check error

it says Cell 5: Timeout of 300 seconds exceeded while executing cell. Failed to interrupt kernel in 5 seconds, so failing without traceback.
so the cell takes too long and I see it does create DM and fit, so you can split it into two cels and also decrease nb of training epochs

@hankyul2
Copy link
Copy Markdown
Contributor Author

hankyul2 commented Dec 3, 2021

@Borda
The check error that I mentioned before seems to be fixed now. (I don't know why) Do you think that we should do more commits for this?

image

@Borda Borda merged commit 2887239 into Lightning-AI:main Dec 3, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

bug / fix Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Find import bugs in "lightnin_examples/text-transformers.py"

2 participants