文本分类出现找不到文件错误如何解决

File "C:\Anaconda3\lib\site-packages\tensorflow\python\lib\io\file_io.py", line 78, in _preread_check
compat.as_bytes(self.__name), 1024 * 512, status)
File "C:\Anaconda3\lib\contextlib.py", line 88, in __exit__
next(self.gen)
File "C:\Anaconda3\lib\site-packages\tensorflow\python\framework\errors_impl.py", line 466, in raise_exception_on_not_ok_status
pywrap_tensorflow.TF_GetCode(status))
tensorflow.python.framework.errors_impl.NotFoundError: NewRandomAccessFile failed to Create/Open: ./..\vocab : ϵͳ\udcd5Ҳ\udcbb\udcb5\udcbdָ\udcb6\udca8\udcb5\udcc4\udcceļ\udcfe\udca1\udca3
出错代码:
vocab_path = os.path.join(FLAGS.checkpoint_dir, "..", "vocab")
vocab_processor = learn.preprocessing.VocabularyProcessor.restore(vocab_path)

解决方法如下:tf.flags.DEFINE_string("checkpoint_dir", "runs/1551860826/checkpoints", "Checkpoint directory from training run")把这个路径"runs/1551860826/checkpoints"改成你自己代码里checkpoints的路径
我原先下载是这样的tf.flags.DEFINE_string("checkpoint_dir", " ", "Checkpoint directory from training run")就会出现跟你一样的错误

发布了218 篇原创文章 · 获赞 110 · 访问量 22万+

猜你喜欢

转载自blog.csdn.net/zhuiyunzhugang/article/details/104565937