keras ignoring values in $HOME/.keras/keras.json file

前端 未结 1 1317
旧时难觅i
旧时难觅i 2021-02-19 20:00

I know the default backend for Keras has switched from Theano to TensorFlow, but with the dev version of Theano I can train on the GPU with OpenCL (I have an AMD card).

相关标签:
1条回答
  • 2021-02-19 20:35

    Same issue here, system setup:

    • Ubuntu 16.04
    • Anaconda + Python 3.6
    • Keras 2.0.2

    The only way to change backend is to use KERAS_BACKEND environment variable. Json field is ignored.

    EDIT: The issue is Anaconda, open anaconda3/envs/ENV-NAME/etc/conda/activate.d/keras_activate.sh

    #!/bin/bash
    if [ "$(uname)" == "Darwin" ]
    then
        # for Mac OSX
        export KERAS_BACKEND=tensorflow
    elif [ "$(uname)" == "Linux" ]
    then
        # for Linux
        export KERAS_BACKEND=theano
    fi
    

    You'll see that tensorflow is forced for MAC, and Theano for Linux.

    I have no idea who creates this file, keras or anaconda, and the reasoning behind this forcing. I'm just ignoring it and doing my own way:)

    0 讨论(0)
提交回复
热议问题