2017-10-09 14 views
1

GPL에서 https://github.com/chiphuyen/stanford-tensorflow-tutorials/tree/master/assignments/chatbot 여기에서 "standford chatbot"을 훈련시키고 싶지만 내 GPU는 사용하지 않지만 모든 필요 라이브러리 (CuNN, CUDA, tensorflow-gpu 등)는Tensorflow에서 GPU를 사용하고 싶지 않다

def train(): 
""" Train the bot """ 

test_buckets, data_buckets, train_buckets_scale = _get_buckets() 
# in train mode, we need to create the backward path, so forwrad_only is False 

model = ChatBotModel(False, config.BATCH_SIZE) 
model.build_graph() 

saver = tf.train.Saver(var_list=tf.trainable_variables()) 

with tf.Session(config=tf.ConfigProto(allow_soft_placement=True,log_device_placement=True)) as sess: 
    print('Start training') 

    sess.run(tf.global_variables_initializer()) 
    _check_restore_parameters(sess, saver) 

    iteration = model.global_step.eval() 
    total_loss = 0 
    while True: 

     skip_step = _get_skip_step(iteration) 
     bucket_id = _get_random_bucket(train_buckets_scale) 
     encoder_inputs, decoder_inputs, decoder_masks = data.get_batch(data_buckets[bucket_id], 
                     bucket_id, 
                     batch_size=config.BATCH_SIZE) 
     start = time.time() 
     _, step_loss, _ = run_step(sess, model, encoder_inputs, decoder_inputs, decoder_masks, bucket_id, False) 
     total_loss += step_loss 
     iteration += 1 

     if iteration % skip_step == 0: 
      print('Итерация {}: потеря {}, время {}'.format(iteration, total_loss/skip_step, time.time() - start)) 
      start = time.time() 
      total_loss = 0 
      saver.save(sess, os.path.join(config.CPT_PATH, 'chatbot'), global_step=model.global_step) 
      if iteration % (10 * skip_step) == 0: 
       # Run evals on development set and print their loss 
       _eval_test_set(sess, model, test_buckets) 
       start = time.time() 
      sys.stdout.flush() 

그러나 그것은 항상 보여줍니다 : 설치된 I 시도

InvalidArgumentError (see above for traceback): Cannot assign a device to node 'save/Const': Could not satisfy explicit device specification '/device:GPU:0' because no supported kernel for GPU devices is available. 

코 로케이션 디버그 정보 : 헌장 : CPU 정체성 : CPU 코 로케이션 그룹은 다음과 같은 유형 및 장치를했다

tensorflow에 대한 일부 구성 파일에서 GPU 만 사용하도록 지정할 수도 있고 일부만 사용하도록 지정할 수도 있습니다 (일부는 GPU 또는 일부만 사용할 수 있습니다). 또 다른 방법은 (") :"0 나는/GPU "tf.device (와"시도 DEVICE_COUNT은 = { 'GPU는': 1})) 당신의 오류에서

답변

1

:

Could not satisfy explicit device specification '/device:GPU:0' because no supported kernel for GPU devices is available.

는 그 것을 의미한다 'save/Const' 작업은 GPU 구현이 없으므로 with tf.device():을 통해 강제로 GPU에 할당 할 수 없습니다. with tf.device(): 부분을 제거 (또는 그 작업을 외부에두기)하고 TF가 어디에서 작업을 할 지 결정하게하십시오 (CPU보다 GPU를 선호 할 것입니다)

+0

나는 그것을했지만 tensorflow는 GPU 대신 CPU를 선택합니다 –

+0

당신이 모델이 어떻게 생겼는지 보여주지 않으면 CPU에서 작업이 왜 끝나는지를 자세히 설명 할 수는 없습니다. 일부 연산은 CPU에있을 수 있습니다 (예를 들어 오류를 저장하는 저장과 같은). 계산 작업의 대부분은 CPU와 GPU 구현을 모두 처리합니다. 장치 배치 로깅을 활성화하면 출력은 어떻게 생깁니 까? – GPhilo

+0

'/ job : localhost/replica : 0/task : 0/gpu : 0'에있는 모든 것이 GPU에 할당 (그리고 실행)됩니다. – GPhilo