-
I am trying to train my own custom ELMo model on AllenNLP. The following bug RuntimeError: The size of tensor a (5158) must match the size of tensor b (5000) at non-singleton dimension 1 arises when training the model. There are instances where the size of tensor a is stated to be other values (e.g. 5300). When I tested on a small subset of files, I was able to train the model successfully. Based on my intuition, this is something that deals with the number of tokens in my model. More specifically specific files which has tokens more than 5000. However, there is no parameter within the AllenNLP package which allows me to tweak this to bypass this error. Any advice on how I can overcome this issue? Would tweaking the PyTorch code to set it at a 5000 size work (If yes, how can I do that)? Any insights will be deeply appreciated. FYI, I am currently using a customised DatasetReader for tokenisation purposes. I've generated my own vocab list before training the model (to save some time) which is used to train the ELMo model via AllenNLP. Update: I found out that there is this variable from AllenNLP Environment: Python 3.6.9, Linux Ubuntu, allennlp=2.9.1, allennlp-models=2.9.0 Traceback:
AllenNLP training config file:
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Have you tried changing your tokenizer to truncate the input to 5000 tokens? |
Beta Was this translation helpful? Give feedback.
Have you tried changing your tokenizer to truncate the input to 5000 tokens?