硕士研究 1-2:遇到的问题

matplotlib.animation:MovieWriter

在使用 matplotlib.animation:MovieWriter 存储影片时 memory 和 cache 不够

1
2
3
WARNING:matplotlib.animation:MovieWriter stderr:
convert-im6.q16: cache resources exhausted `./gym_animation.gif' @ error/cache.c/OpenPixelCache/4083.
convert-im6.q16: memory allocation failed `./gym_animation.gif' @ error/quantize.c/AssignImageColors/496

原因:For some reason, my ImageMagick came with very low limits:

cache 不够

解决办法:清理 pip cache

1
2
3
4
cd ~/.cache/pip
sudo rm -rf *
# 或者在 pip 安装的时候,跳过缓存
pip install ... --no-cache-dir

字符串 array 用 np.save 储存成 csv 档案

1
2
3
# 报错 TypeError: Mismatch between array dtype ('<U21') and format specifier ('%.18e,%.18e')
#You have to specify the format (fmt) of you data in savetxt, in this case as a string (% s):
np.savetxt ('test.csv', DAT, delimiter="", fmt="% s")

transforms.Resize () 只接受 PIL 类型

可以参考的 implement

有用到 d4rl 和 Atari

1


pytorch tutorial