OffensEval2020-code icon indicating copy to clipboard operation
OffensEval2020-code copied to clipboard

TypeError: unhashable type: 'dict' while using batch_generator

Open austinyoung1 opened this issue 3 years ago • 3 comments

I have an error in the following line: for batch_index, batch_dict in enumerate(batch_generator): Error: TypeError Traceback (most recent call last) in () 19 ) 20 model.train() ---> 21 for batch_index, batch_dict in enumerate(batch_generator): 22 optimizer.zero_grad() 23 12 frames /usr/local/lib/python3.7/dist-packages/transformers/tokenization_utils.py in _convert_token_to_id_with_added_voc(self, token) 398 return None 399 --> 400 if token in self.added_tokens_encoder: 401 return self.added_tokens_encoder[token] 402 return self._convert_token_to_id(token) TypeError: unhashable type: 'dict'

How can I solve this?

austinyoung1 avatar Jun 24 '21 18:06 austinyoung1

If you could please share a Colab Notebook reproducing this error it would be easier for me to investigate the issue.

cozek avatar Jun 25 '21 14:06 cozek

Thanks for the reply. I'm using a small dataset of my own. Data: https://drive.google.com/drive/folders/1kgmWjgfYR0kg8M1EnTnyjQdd7rdwkzv1?usp=sharing Notebook: https://colab.research.google.com/drive/1yPlcI_rKNQ2uwuvPgFo047A6v52RuNCc?usp=sharing

austinyoung1 avatar Jun 27 '21 20:06 austinyoung1

@austinyoung1 Hi, austinyoung1. Have you solved it? I ran into the same problem as you.

SunnyGJing avatar Aug 18 '21 07:08 SunnyGJing