tensorflow显存不够,报错

Using TensorFlow backend.
2019-05-15 06:48:05.053398: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1471] Adding visible gpu devices: 0
2019-05-15 06:48:05.053430: I tensorflow/core/common_runtime/gpu/gpu_device.cc:952] Device interconnect StreamExecutor with strength 1 edge matrix:
2019-05-15 06:48:05.053434: I tensorflow/core/common_runtime/gpu/gpu_device.cc:958]      0 
2019-05-15 06:48:05.053437: I tensorflow/core/common_runtime/gpu/gpu_device.cc:971] 0:   N 
2019-05-15 06:48:05.053550: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1084] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 12194 MB memory) -> physical GPU (device: 0, name: TITAN Xp, pci bus id: 0000:01:00.0, compute capability: 6.1)
2019-05-15 06:48:06.463039: E tensorflow/stream_executor/cuda/cuda_dnn.cc:332] could not create cudnn handle: CUDNN_STATUS_INTERNAL_ERROR
段错误 (核心已转储)

 

出现这种错误,找代码:

def load_tf_model():
    # load config file
    cfg.TEST.checkpoints_path = './ctpn/checkpoints'

    # init session
    gpu_options = tf.GPUOptions(per_process_gpu_memory_fraction=1.0) # 错误原因,不要写1.0
    config = tf.ConfigProto(allow_soft_placement=True, gpu_options=gpu_options)
    sess = tf.Session(config=config)

    # load network
    net = get_network("VGGnet_test")

    # load model
    print('Loading network {:s}... '.format("VGGnet_test"))
    saver = tf.train.Saver()
    try:
        ckpt = tf.train.get_checkpoint_state(cfg.TEST.checkpoints_path)
        print('Restoring from {}...'.format(ckpt.model_checkpoint_path))
        saver.restore(sess, ckpt.model_checkpoint_path)
        print('done')
    except:
        raise 'Check your pretrained {:s}'.format(ckpt.model_checkpoint_path)

    return sess, net

把gpu_options = tf.GPUOptions(per_process_gpu_memory_fraction=1.0)里面的1.0写成0.7,反正不要写满

解决问题,至于网上的什么sudo rm ~/.nv  之类的不解决问题

你可能感兴趣的:(深度学习,tensorflow)