在GPU上运行Keras时遇到问题

时间:2017-09-28 22:07:35

标签: python keras tensorflow-gpu

我成功可以在CPU上运行模型。 但由于下面列出的问题我无法使用GPU。 我认为这与Conda有关,但我已经通过pip安装了tensorflow和tensorflow-gpu。 怎么解决?

  Using TensorFlow backend.
  Found 1864 images belonging to 15 classes.
  Found 792 images belonging to 15 classes.
  Epoch 1/20
  Traceback (most recent call last):
  File "e:\NN_Music\fma_small\model_train.py", line 102, in <module>
    validation_steps=(nb_validation_samples / batch_size)
  File "E:\programs\Conda\lib\site-packages\keras\legacy\interfaces.py", line 87, in wrapper
    return func(*args, **kwargs)
  File "E:\programs\Conda\lib\site-packages\keras\models.py", line 1121, in fit_generator
    initial_epoch=initial_epoch)
  File "E:\programs\Conda\lib\site-packages\keras\legacy\interfaces.py", line 87, in wrapper
    return func(*args, **kwargs)
  File "E:\programs\Conda\lib\site-packages\keras\engine\training.py", line 2042, in fit_generator
    class_weight=class_weight)
  File "E:\programs\Conda\lib\site-packages\keras\engine\training.py", line 1762, in train_on_batch
    outputs = self.train_function(ins)
  File "E:\programs\Conda\lib\site-packages\keras\backend\tensorflow_backend.py", line 2273, in __call__
    **self.session_kwargs)
  File "E:\programs\Conda\lib\site-packages\tensorflow\python\client\session.py", line 895, in run
    run_metadata_ptr)
  File "E:\programs\Conda\lib\site-packages\tensorflow\python\client\session.py", line 1124, in _run
    feed_dict_tensor, options, run_metadata)
  File "E:\programs\Conda\lib\site-packages\tensorflow\python\client\session.py", line 1321, in _do_run
    options, run_metadata)
  File "E:\programs\Conda\lib\site-packages\tensorflow\python\client\session.py", line 1340, in _do_call
    raise type(e)(node_def, op, message)

我试图检查GPU是否存在 - 是的。

name: "/cpu:0"device_type: "CPU",
name: "/gpu:0"device_type: "GPU"

这是我的源代码: model_train.py

0 个答案:

没有答案