I tried to correct English grammar by running a model.
My development environment is Linux
+ Anaconda3
+ Python 3.6
+ CUDA 9.0
+ tensorflow1.9.0
After I ran the model, there was the following problem with the test:
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
How should I solve this problem?
Advertisement
Answer
It would be helpful to see some code but it looks like the a
variable in a = os.fspath(a)
is of type NoneType
. The a
variable should either be a string, bytes or an os.PathLike
object in order to work with the os.fspath
function.
You can check the Python documentation on the os.fspath
function: python docs