持续创作,加速成长!这是我参与「掘金日新计划 · 10 月更文挑战」的第23天,download.pytorch.org/models/ince…” to /root/.cache/torch/hub/checkpoints/inception_v3_google-0cc3c7bd.pth
那么我们去直接手动访问download.pytorch.org/models/ince…
问题三:Resource punkt not found.
问题描述:
Resource punkt not found.
Please use the NLTK Downloader to obtain the resource:
import nltk
nltk.download(‘punkt’)
For more information see: www.nltk.org/data.html
Attempted to load tokenizers/punkt/PY3/english.pickle
Searched in:
– ‘/root/nltk_data’
– ‘/root/.local/conda/envs/ss/nltk_data’
– ‘/root/.local/conda/envs/ss/share/nltk_data’
– ‘/root/.local/conda/envs/ss/lib/nltk_data’
– ‘/usr/share/nltk_data’
– ‘/usr/local/share/nltk_data’
– ‘/usr/lib/nltk_data’
– ‘/usr/local/lib/nltk_data’
– ”
问题原因:因为没有安装punkt
解决方案:直接下载离线punkt包,将其放到以上的目录当中
- '/root/nltk_data'
- '/root/.local/conda/envs/ss/nltk_data'
- '/root/.local/conda/envs/ss/share/nltk_data'
- '/root/.local/conda/envs/ss/lib/nltk_data'
- '/usr/share/nltk_data'
- '/usr/local/share/nltk_data'
- '/usr/lib/nltk_data'
- '/usr/local/lib/nltk_data'
问题四:找不到FreeMono字体
File “/content/sample_data/AttnGAN/code/miscc/utils.py”, line 104, in build_super_images
drawCaption(text_convas, captions, ixtoword, vis_size)
File “/content/sample_data/AttnGAN/code/miscc/utils.py”, line 35, in drawCaption
fnt = ImageFont.truetype(‘Pillow/Tests/fonts/FreeMono.ttf’, 50)
OSError: cannot open resource
这是因为没有FreeMono字体原因,找到字体文件的调用地方,改为Humor-Sans.ttf或者LiberationMono-Bold.ttf,或者在计算机中下载FreeMono字体
问题五:解码问题
‘ascii’ codec can’t decode byte 0x80 in position 0: ordinal not in range(128)
问题原因:读取文件时的解码问题
解决方案:更改为:
class_id = pickle.load(f, encoding=’bytes’)
问题六:IndexError: invalid index of a 0-dim tensor
IndexError: invalid index of a 0-dim tensor. Use tensor.item() to convert a 0-dim tensor to a Python number
问题原因:在pytorch高版本用item()
解决方案:将【0】改为.item()
问题七:EasyDict’ object has no attribute ‘iteritems’
EasyDict’ object has no attribute ‘iteritems’
问题原因:Python3中:iteritems变为items
解决方案:根据提示将iteritems改为items