【问题标题】:"ValueError: bad marshal data" with Keras on Windows 10在 Windows 10 上使用 Keras 的“ValueError: bad marshal data”
【发布时间】:2018-05-04 23:23:21
【问题描述】:

我目前在 Windows 10 上遇到 Keras 问题。我试图搜索我的问题并尝试了不同的方法,但不幸的是我还无法修复它。非常感谢您的帮助!

我试图在 Windows 10 上的 conda env 上安装 Keras 2.1.1、Tensorflow-gpu 1.4.0 和 Python 3.6(后来我尝试使用 Python 3.5.2 创建另一个 conda env,但它仍然无法正常工作)。当我试图保存我的模型时,我得到了UnicodeDecodeError: 'rawunicodeescape' codec can't decode bytes in position 111-112: truncated \uXXXX。然后我通过在generic_utils.py 中添加replace(b'\\',b'/') 来关注this,效果很好。

但是,之后我打开另一个文件来加载我的模型,然后出现此错误:ValueError: bad marshal data (unknown type code)(如果它在使用 python 3.6 的环境中)和SystemError: unknown opcode(如果它在使用 python 3.5.2 的环境中) .

我尝试使用 python 3.6/3.5 创建新环境并使用 Keras 2.0.8 重新安装,并尝试更改 tensorflow-gpu 1.3.0,但没有成功。

我尝试过的一些链接:

  1. https://github.com/fchollet/keras/issues/7297
  2. Encoding error when installing Keras on Windows 10

有人知道如何解决它或有什么建议吗?提前谢谢你。

P/S:其他信息(不确定是否有帮助):我正在使用GTX 1080Tisublime text 3

【问题讨论】:

    标签: python-3.x windows-10 keras tensorflow-gpu


    【解决方案1】:

    好的,我为上面的问题找到了解决方案。对不起我的无知。

    该问题与 Keras 或 Tensorflow 问题无关。相反,它与 python 3 问题有关。 Python 3 无法在 Windows 上解码特殊字符 \u

    所以解决方法很简单:你只需要把你的路径改成绝对路径,比如'C:/users/.../'或者移动你的文件,把文件名改成其他路径,只要不包含特殊字符\u

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-08-22
      • 2020-11-21
      • 2019-12-22
      • 2023-03-19
      • 1970-01-01
      • 2014-11-17
      • 2017-12-14
      • 2016-11-12
      相关资源
      最近更新 更多