Hyunjun Kim
Hyunjun Kim

Reputation: 124

Change number of GPUs when deploy

I have a fine-tuned Inception v3 on a 2-GPU machine. Now I am trying to run the trained model on another machine with 1 GPU, but I got an error like this:

Cannot assign a device to node 'tower_1/gradients/tower_1/conv0/BatchNorm/moments/sufficient_statistics/Sub_grad/BroadcastGradientArgs': Could not satisfy explicit device specification '/device:GPU:1' because no devices matching that specification are registered in this process; available devices: /job:localhost/replica:0/task:0/cpu:0, /job:localhost/replica:0/task:0/gpu:0

It seems that the model wants a 2-GPU environment like the one it was trained on. Can I convert this model so that it uses only 1 GPU?

Upvotes: 1

Views: 71

Answers (1)

Hyunjun Kim
Hyunjun Kim

Reputation: 124

I changed two things and it worked.

  1. Turn on allow_soft_placement option in Session:

    config = tf.ConfigProto(allow_soft_placement=True)
    sess = tf.Session(config=config)
    
  2. Rename model file name from model.ckpt-50000.data-00000-of-00001 to model.ckpt-50000

Upvotes: 0

Related Questions