Ich weiß, dass das Standard-Backend für Keras von Theano zu TensorFlow gewechselt hat, aber mit der Dev-Version von Theano kann ich auf der GPU mit OpenCL trainieren (ich habe eine AMD-Karte).
Allerdings, wenn ich Keras importieren, verwendet er nur die TensorFlow Backend auch nachdem ich die Werte in der Keras Konfigurationsdatei geändert:
~ $ cat $HOME/.keras/keras.json
{"epsilon": 1e-07, "floatx": "float32", "backend": "theano"}
~ $ python -c 'import keras'
Using TensorFlow backend.
~ $ KERAS_BACKEND=theano python -c 'import keras'
Using Theano backend.
Mapped name None to device opencl0:2: AMD Radeon R9 M370X Compute Engine
Außerdem weiß ich, dass Keras die Konfigurationsdatei liest nach dem Import, weil, wenn ich etwas nicht gültigen Wert für "backend"
füllen bekomme ich einen Fehler:
~ $ cat $HOME/.keras/keras.json
{"epsilon": 1e-07, "floatx": "float32", "backend": "foobar"}
~ $ python -c 'import keras'
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/Users/antalek/anaconda/envs/ENVPy3/lib/python3.5/site-packages/keras/__init__.py", line 3, in <module>
from . import activations
File "/Users/antalek/anaconda/envs/ENVPy3/lib/python3.5/site-packages/keras/activations.py", line 3, in <module>
from . import backend as K
File "/Users/antalek/anaconda/envs/ENVPy3/lib/python3.5/site-packages/keras/backend/__init__.py", line 34, in <module>
assert _backend in {'theano', 'tensorflow'}
AssertionError
System:
- Mac OSX 10.11.6
- Anaconda Python v 3.5
- Keras v 2.0.2
Ich möchte Keras haben Theano verwenden als Standard-Backend. Wer weiß, wie man es so einstellt?
EDIT:
@Marcin Mozejko ‚s Frage zu beantworten:
~ $ which python
/Users/<my name>/anaconda/envs/ENVPy3/bin/python
Welche der Conda virtuelle Umgebung ist, dass Keras in als auch installiert ist.
Ist ein 'Python' in Ihrer Konsole mit einer 'conda'-Distribution verbunden? –
hat eine Bearbeitung hinzugefügt, um Ihre Frage zu beantworten – themantalope