Hi,
I would like to modify the interact.py in such a way, that it uses the BertModel and BertTokenizer. I have adapted the file. However, when I try to run the code, I get the following error:
>>> hello
Traceback (most recent call last):
File "/Users/timospring/Desktop/empathic-chatbot/code/bertBot.py", line 169, in <module>
run()
File "/Users/timospring/Desktop/empathic-chatbot/code/bertBot.py", line 161, in run
out_ids = sample_sequence(history, tokenizer, model, args)
File "/Users/timospring/Desktop/empathic-chatbot/code/bertBot.py", line 70, in sample_sequence
logits = model(input_ids, token_type_ids=token_type_ids)
File "/usr/local/lib/python3.7/site-packages/torch/nn/modules/module.py", line 489, in __call__
result = self.forward(*input, **kwargs)
File "/usr/local/lib/python3.7/site-packages/transformers/modeling_bert.py", line 624, in forward
embedding_output = self.embeddings(input_ids, position_ids=position_ids, token_type_ids=token_type_ids)
File "/usr/local/lib/python3.7/site-packages/torch/nn/modules/module.py", line 489, in __call__
result = self.forward(*input, **kwargs)
File "/usr/local/lib/python3.7/site-packages/transformers/modeling_bert.py", line 169, in forward
token_type_embeddings = self.token_type_embeddings(token_type_ids)
File "/usr/local/lib/python3.7/site-packages/torch/nn/modules/module.py", line 489, in __call__
result = self.forward(*input, **kwargs)
File "/usr/local/lib/python3.7/site-packages/torch/nn/modules/sparse.py", line 118, in forward
self.norm_type, self.scale_grad_by_freq, self.sparse)
File "/usr/local/lib/python3.7/site-packages/torch/nn/functional.py", line 1454, in embedding
return torch.embedding(weight, input, padding_idx, scale_grad_by_freq, sparse)
RuntimeError: index out of range at /Users/soumith/b101_2/2019_02_08/wheel_build_dirs/wheel_3.7/pytorch/aten/src/TH/generic/THTensorEvenMoreMath.cpp:191
I did some digging and this error is supposed to appear when there is a mismatch in the vocab_size. However, I tried to change the size in the code and then I get other errors complaining that the vocab_size does not match the original 30522. Any help in getting it to work with bert would be highly appreciated!
Hi, I would like to modify the interact.py in such a way, that it uses the BertModel and BertTokenizer. I have adapted the file. However, when I try to run the code, I get the following error:
I did some digging and this error is supposed to appear when there is a mismatch in the vocab_size. However, I tried to change the size in the code and then I get other errors complaining that the vocab_size does not match the original 30522. Any help in getting it to work with bert would be highly appreciated!