Open Annztt opened 3 years ago
句子长度最大是多少?
Traceback (most recent call last): File "flat_main.py", line 787, in trainer.train() File "/raid/ztt/anaconda2/envs/p3/lib/python3.6/site-packages/fastNLP/core/trainer.py", line 613, in train self.callback_manager.on_exception(e) File "/raid/ztt/anaconda2/envs/p3/lib/python3.6/site-packages/fastNLP/core/callback.py", line 309, in wrapper returns.append(getattr(callback, func.name)(*arg)) File "/raid/ztt/anaconda2/envs/p3/lib/python3.6/site-packages/fastNLP/core/callback.py", line 505, in on_exception raise exception # 抛出陌生Error File "/raid/ztt/anaconda2/envs/p3/lib/python3.6/site-packages/fastNLP/core/trainer.py", line 609, in train self._train() File "/raid/ztt/anaconda2/envs/p3/lib/python3.6/site-packages/fastNLP/core/trainer.py", line 664, in _train prediction = self._data_forward(self.model, batch_x) File "/raid/ztt/anaconda2/envs/p3/lib/python3.6/site-packages/fastNLP/core/trainer.py", line 752, in _data_forward y = network(x) File "/raid/ztt/anaconda2/envs/p3/lib/python3.6/site-packages/torch/nn/modules/module.py", line 541, in call result = self.forward(*input, kwargs) File "../V1/models.py", line 440, in forward bert_embed = self.bert_embedding(char_for_bert) File "/raid/ztt/anaconda2/envs/p3/lib/python3.6/site-packages/torch/nn/modules/module.py", line 541, in call* result = self.forward(input, kwargs) File "../fastNLP_module.py", line 389, in forward outputs = self.model(words) File "/raid/ztt/anaconda2/envs/p3/lib/python3.6/site-packages/torch/nn/modules/module.py", line 541, in call result = self.forward(*input, **kwargs) File "/raid/ztt/anaconda2/envs/p3/lib/python3.6/site-packages/fastNLP/embeddings/bert_embedding.py", line 339, in forward "After split words into word pieces, the lengths of word pieces are longer than the " RuntimeError: After split words into word pieces, the lengths of word pieces are longer than the maximum allowed sequence length:512 of bert. You can set
auto_truncate=True
for BertEmbedding to automatically truncate overlong input. 我也出现了这样的情况,将auto_truncate = Ture也不太管用,请问您解决了吗
、
额,你能把具体送到bert embedd里的序列长度输出给我看一下么
Traceback (most recent call last): File "flat_main.py", line 787, in
trainer.train()
File "/raid/ztt/anaconda2/envs/p3/lib/python3.6/site-packages/fastNLP/core/trainer.py", line 613, in train
self.callback_manager.on_exception(e)
File "/raid/ztt/anaconda2/envs/p3/lib/python3.6/site-packages/fastNLP/core/callback.py", line 309, in wrapper
returns.append(getattr(callback, func.name)(*arg))
File "/raid/ztt/anaconda2/envs/p3/lib/python3.6/site-packages/fastNLP/core/callback.py", line 505, in on_exception
raise exception # 抛出陌生Error
File "/raid/ztt/anaconda2/envs/p3/lib/python3.6/site-packages/fastNLP/core/trainer.py", line 609, in train
self._train()
File "/raid/ztt/anaconda2/envs/p3/lib/python3.6/site-packages/fastNLP/core/trainer.py", line 664, in _train
prediction = self._data_forward(self.model, batch_x)
File "/raid/ztt/anaconda2/envs/p3/lib/python3.6/site-packages/fastNLP/core/trainer.py", line 752, in _data_forward
y = network(x)
File "/raid/ztt/anaconda2/envs/p3/lib/python3.6/site-packages/torch/nn/modules/module.py", line 541, in call
result = self.forward(*input, *kwargs)
File "../V1/models.py", line 440, in forward
bert_embed = self.bert_embedding(char_for_bert)
File "/raid/ztt/anaconda2/envs/p3/lib/python3.6/site-packages/torch/nn/modules/module.py", line 541, in call
result = self.forward(input, kwargs)
File "../fastNLP_module.py", line 389, in forward
outputs = self.model(words)
File "/raid/ztt/anaconda2/envs/p3/lib/python3.6/site-packages/torch/nn/modules/module.py", line 541, in call
result = self.forward(*input, **kwargs)
File "/raid/ztt/anaconda2/envs/p3/lib/python3.6/site-packages/fastNLP/embeddings/bert_embedding.py", line 339, in forward
"After split words into word pieces, the lengths of word pieces are longer than the "
RuntimeError: After split words into word pieces, the lengths of word pieces are longer than the maximum allowed sequence length:512 of bert. You can set
auto_truncate=True
for BertEmbedding to automatically truncate overlong input.