huggingface / transformers

🤗 Transformers: State-of-the-art Machine Learning for Pytorch, TensorFlow, and JAX.
https://huggingface.co/transformers
Apache License 2.0
132.4k stars 26.37k forks source link

Key error during Training #22088

Closed kashalakarthik closed 1 year ago

kashalakarthik commented 1 year ago

We are trying to do text summarization using BERT2BERT model. But facing this error mentioned below: The above exception was the direct cause of the following exception:

KeyError Traceback (most recent call last) /usr/local/lib/python3.9/dist-packages/pandas/core/indexes/base.py in get_loc(self, key, method, tolerance) 3361 return self._engine.get_loc(casted_key) 3362 except KeyError as err: -> 3363 raise KeyError(key) from err 3364 3365 if is_scalar(key) and isna(key) and not self.hasnans:

KeyError: 6868

Link for google collab: error img https://colab.research.google.com/drive/1ySZS1VifUxbccI81y9dLOHxg_nr9mSc0?usp=sharing

sgugger commented 1 year ago

Without seeing the code you run or the whole traceback, there is nothing we can do to help you.

kashalakarthik commented 1 year ago

The below is the code link, you can access it: https://colab.research.google.com/drive/1ySZS1VifUxbccI81y9dLOHxg_nr9mSc0?usp=sharing

kashalakarthik commented 1 year ago

Without seeing the code you run or the whole traceback, there is nothing we can do to help you.

The below is the code link, you can access it: https://colab.research.google.com/drive/1ySZS1VifUxbccI81y9dLOHxg_nr9mSc0?usp=sharing

sgugger commented 1 year ago

The link does not point to anything.

kashalakarthik commented 1 year ago

Sorry about that, Please use the link below mentioned: https://github.com/kashalakarthik/BERT-Hugging-face

please copy paste the link in browser if it is not working. The links to download the dataset also mentioned in the repository.

sgugger commented 1 year ago

You are not passing a dataset to your Trainer but a pandas dataframe, so this can't work. The Trainer only accepts PyTorch Dataset objects.

github-actions[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

Please note that issues that do not follow the contributing guidelines are likely to be ignored.