shibing624 / pycorrector

pycorrector is a toolkit for text error correction. 文本纠错,实现了Kenlm,T5,MacBERT,ChatGLM3,Qwen2.5等模型应用在纠错场景,开箱即用。
https://www.mulanai.com/product/corrector/
Apache License 2.0
5.61k stars 1.1k forks source link

on_validation_epoch_end() missing 1 required positional argument: 'outputs' #475

Closed banxialiangsheng closed 8 months ago

banxialiangsheng commented 8 months ago

请问我在运行examples\macbert\train.py时,出现这个问题该怎么解决? Traceback (most recent call last): File "D:\bishe\code\pycorrector\examples\macbert\train.py", line 139, in main() File "D:\bishe\code\pycorrector\examples\macbert\train.py", line 105, in main trainer.fit(model, train_loader, valid_loader) File "C:\Anaconda3\envs\deeplearning\lib\site-packages\pytorch_lightning\trainer\trainer.py", line 543, in fit call._call_and_handle_interrupt( File "C:\Anaconda3\envs\deeplearning\lib\site-packages\pytorch_lightning\trainer\call.py", line 44, in _call_and_handle_interrupt return trainer_fn(*args, kwargs) File "C:\Anaconda3\envs\deeplearning\lib\site-packages\pytorch_lightning\trainer\trainer.py", line 579, in _fit_impl self._run(model, ckpt_path=ckpt_path) File "C:\Anaconda3\envs\deeplearning\lib\site-packages\pytorch_lightning\trainer\trainer.py", line 986, in _run results = self._run_stage() File "C:\Anaconda3\envs\deeplearning\lib\site-packages\pytorch_lightning\trainer\trainer.py", line 1030, in _run_stage self._run_sanity_check() File "C:\Anaconda3\envs\deeplearning\lib\site-packages\pytorch_lightning\trainer\trainer.py", line 1059, in _run_sanity_check val_loop.run() File "C:\Anaconda3\envs\deeplearning\lib\site-packages\pytorch_lightning\loops\utilities.py", line 182, in _decorator return loop_run(self, *args, *kwargs) File "C:\Anaconda3\envs\deeplearning\lib\site-packages\pytorch_lightning\loops\evaluation_loop.py", line 142, in run return self.on_run_end() File "C:\Anaconda3\envs\deeplearning\lib\site-packages\pytorch_lightning\loops\evaluation_loop.py", line 254, in on_run_end self._on_evaluation_epoch_end() File "C:\Anaconda3\envs\deeplearning\lib\site-packages\pytorch_lightning\loops\evaluation_loop.py", line 334, in _on_evaluation_epoch_end call._call_lightning_module_hook(trainer, hook_name) File "C:\Anaconda3\envs\deeplearning\lib\site-packages\pytorch_lightning\trainer\call.py", line 157, in _call_lightning_module_hook output = fn(args, kwargs) TypeError: on_validation_epoch_end() missing 1 required positional argument: 'outputs'

shibing624 commented 8 months ago

严格按照readme的版本安装。https://github.com/shibing624/pycorrector/blob/master/examples/macbert/README.md