NJUNLP / knn-box

an easy-to-use knn-mt toolkit
MIT License
104 stars 12 forks source link

翻译错误:AssertionError: interactive mode, should have only one sentence #23

Closed Old-Young233 closed 11 months ago

Old-Young233 commented 1 year ago

Traceback (most recent call last): File "/home/nlp/anaconda3/envs/knn/lib/python3.7/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 564, in _run_script exec(code, module.dict) File "/home/nlp/y2020/yzh/knn-box-master/knnbox-scripts/vanilla-knn-mt-visual/src/app.py", line 215, in knn_main() File "/home/nlp/y2020/yzh/knn-box-master/knnbox-scripts/vanilla-knn-mt-visual/src/app.py", line 126, in knnmain k = 1, lambda=0.0, temperature=1.0 File "/home/nlp/y2020/yzh/knn-box-master/knnbox-scripts/vanilla-knn-mt-visual/../../knnbox-scripts/vanilla-knn-mt-visual/src/function.py", line 510, in translate_using_knn_model assert len(results) == 1, "interactive mode, should have only one sentence" AssertionError: interactive mode, should have only one sentence image

隔了一段时间重新用后出现了上述问题

ZhaoQianfeng commented 1 year ago

从给出的信息不太好推断发生了什么,你可以贴出完整的model_configs.yml吗?有以下几个解决方案你可以先尝试下:

  1. 在报错的assert len(results) == 1, "interactive mode, should have only one sentence"前面加个断点查看下翻译的results是什么样的,看看为什么会导致报错
  2. 从报错信息看你使用的是老版本的knn-box,可能是存在一些问题。你可以重开个conda环境换最新的knn-box代码跑一遍。新版在配置model_configs.yml时可以自定义Tokenizer处理函数,readme里有写如何配置。