hemingkx / ChineseNMT

ChineseNMT: Translate English to Chinese with PyTorch Implementation of Transformer
439 stars 84 forks source link

RuntimeError: Empty or `None` reference sentence found #10

Open HammerWang98 opened 2 years ago

HammerWang98 commented 2 years ago

您好,运行完第一个epoch之后,第二个epoch就报错,没有tgt sentence,是生成的语料没有对齐吗。如何解决

HammerWang98 commented 2 years ago

100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 395/395 [38:25<00:00, 5.84s/it] Traceback (most recent call last): File "main.py", line 123, in run() File "main.py", line 78, in run train(train_dataloader, dev_dataloader, model, model_par, criterion, optimizer) File "/root/ChineseNMT/train.py", line 43, in train bleu_score = evaluate(dev_data, model) File "/root/ChineseNMT/train.py", line 170, in evaluate bleu = sacrebleu.corpus_bleu(res, trg, tokenize='zh') File "/root/miniconda3/lib/python3.8/site-packages/sacrebleu/compat.py", line 35, in corpus_bleu return metric.corpus_score(hypotheses, references) File "/root/miniconda3/lib/python3.8/site-packages/sacrebleu/metrics/base.py", line 421, in corpus_score stats = self._extract_corpus_statistics(hypotheses, references) File "/root/miniconda3/lib/python3.8/site-packages/sacrebleu/metrics/base.py", line 366, in _extract_corpus_statistics ref_cache = self._cache_references(references) File "/root/miniconda3/lib/python3.8/site-packages/sacrebleu/metrics/base.py", line 333, in _cache_references raise RuntimeError("Empty or None reference sentence found.") RuntimeError: Empty or None reference sentence found.

liminn commented 2 years ago

same error

HammerWang98 commented 2 years ago

same error

I had solved it. change your method to install sacrebleu rather than pip.

liminn commented 2 years ago

same error

I had solved it. change your method to install sacrebleu rather than pip.

you are linux or windows?

liminn commented 2 years ago

same error

I had solved it. change your method to install sacrebleu rather than pip.

I can't solve this error by your method.

biel-wangdf3 commented 2 years ago

how do you solve this error? @HammerWang98

biel-wangdf3 commented 2 years ago

pip install sacrebleu==1.4.14 @liminn @HammerWang98