使用Pytorch运行过去别人深度学习的代码出现:No module named 'tokenizer'


原文:

https://github.com/DeepRNN/image_captioning/issues/27

递归点击链接:

https://docs.python.org/2.5/whatsnew/pep-328.html

解决方法:

Update: I solve this issue by using relative import. Namely, e.g. change

译:Update:我使用相对导入解决了这个问题。也就是说,例如改变

from tokenizer.ptbtokenizer import PTBTokenizer

to

from .tokenizer.ptbtokenizer import PTBTokenizer

I am thinking this results from different python versions (I am using python 3.6 while coco-caption metrics is for 2.7). Another solution is use the coco-caption metrics for python3.

译:我认为这是不同python版本的结果(我使用的是python 3.6,而coco caption metrics是针对2.7的)。另一个解决方案是使用python3的coco字幕指标。


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM