我尝试通过运行模型来纠正英语语法。
我的开发环境是Linux
+ Anaconda3
+ Python 3.6
+ CUDA 9.0
+ tensorflow1.9.0
我运行模型后,测试出现以下问题:
Traceback (most recent call last):
File "./generate.py", line 236, in <module>
main(args)
File "./generate.py", line 93, in main
fluency_scorer = FluencyScorer(args.lang_model_path, args.lang_model_data)
File "/home/gpower/zhangtianjiu/NLP/pytorch-human-performance-gec-master/fairseq-scripts/fluency_scorer.py", line 58, in __init__
self.task = tasks.setup_task(self.args)
File "/home/gpower/zhangtianjiu/NLP/pytorch-human-performance-gec-master/fairseq/fairseq/tasks/__init__.py", line 19, in setup_task
return TASK_REGISTRY[args.task].setup_task(args)
File "/home/gpower/zhangtianjiu/NLP/pytorch-human-performance-gec-master/fairseq/fairseq/tasks/language_modeling.py", line 90, in setup_task
dictionary = Dictionary.load(os.path.join(args.data, 'dict.txt'))
File "/home/gpower/anaconda3/envs/tf/lib/python3.6/posixpath.py", line 78, in join
a = os.fspath(a)
TypeError: expected str, bytes or os.PathLike object, not NoneType
我该如何解决这个问题?
最佳答案
查看一些代码会很有帮助,但看起来 a = os.fspath(a)
中的 a
变量的类型为 NoneType
。 a
变量应该是字符串、字节或 os.PathLike
对象,以便与 os.fspath
函数一起使用。
您可以查看关于os.fspath
函数的Python文档:python docs
关于python - 关于 TypeError : expected str, bytes 或 os.PathLike 对象的错误,而不是 NoneType,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55490951/