Lightning-AI / tutorials

Collection of Pytorch lightning tutorial form as rich scripts automatically transformed to ipython notebooks.
https://lightning-ai.github.io/tutorials
Apache License 2.0
285 stars 80 forks source link

Text transformer tutorial doesn't work with the latest transformer version #262

Closed shamanez closed 2 months ago

shamanez commented 1 year ago

🐛 Bug

This text transformer tutorial fails with the transformers==4.31.0 version

and works fine with transformers==4.27.0 and bellow

To Reproduce

Run the notebook

Error:
"  File "/opt/conda/envs/cb-ml/lib/python3.10/site-packages/torch/autograd/__init__.py", line 200, in backward
    Variable._execution_engine.run_backward(  # Calls into the C++ engine to run the backward pass
RuntimeError: element 0 of tensors does not require grad and does not have a grad_fn
Epoch 0:   0%|          | 0/32 [00:01<?, ?it/s] "
Borda commented 1 year ago

Any thoughts on what could be the root of this issue? So far you refer to Torch so not sure how this can be fixed in lightning...

Borda commented 2 months ago

the latest build is with transformers==4.43.1 so I believe this was resolved :flamingo: https://github.com/Lightning-AI/tutorials/blob/publication/.notebooks/lightning_examples/text-transformers.yaml