首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >TensorFlow-超薄多GPU培训

TensorFlow-超薄多GPU培训
EN

Stack Overflow用户
提问于 2017-04-14 12:49:29
回答 2查看 4.2K关注 0票数 1

我正在使用TensorFlow-Slim。我的目标是在多GPU模式下运行给定的标准脚本(位于/models/slim/scripts中)。我已经测试了finetune_resnet_v1_50_on_flowers.sh脚本(在2017年4月12日克隆)。我刚刚在训练部分的末尾添加了--num_clones=2 (灵感来自/slim/deployment/model_Test.py和之前的StackOverflow答案):

代码语言:javascript
复制
python train_image_classifier.py \
  --train_dir=${TRAIN_DIR} \
  --dataset_name=flowers \
  --dataset_split_name=train \
  --dataset_dir=${DATASET_DIR} \
  --model_name=resnet_v1_50 \
  --checkpoint_path=${PRETRAINED_CHECKPOINT_DIR}/resnet_v1_50.ckpt \
  --checkpoint_exclude_scopes=resnet_v1_50/logits \
  --trainable_scopes=resnet_v1_50/logits \
  --max_number_of_steps=3000 \
  --batch_size=32 \
  --learning_rate=0.01 \
  --save_interval_secs=60 \
  --save_summaries_secs=60 \
  --log_every_n_steps=100 \
  --optimizer=rmsprop \
  --weight_decay=0.00004 \
  --num_clones=2

部署/model_deploy_test.py中的代码:

代码语言:javascript
复制
def testMultiGPU(self):
    deploy_config = model_deploy.DeploymentConfig(num_clones=2)

我有一个警告(‘忽略设备规范’):

代码语言:javascript
复制
I tensorflow/core/common_runtime/gpu/gpu_device.cc:975] Creating TensorFlow device (/gpu:0) -> (device: 0, name: Tesla P100-SXM2-16GB, pci bus id: 0000:85:00.0)
I tensorflow/core/common_runtime/gpu/gpu_device.cc:975] Creating TensorFlow device (/gpu:1) -> (device: 1, name: Tesla P100-SXM2-16GB, pci bus id: 0000:86:00.0)
I tensorflow/core/common_runtime/simple_placer.cc:669] Ignoring device specification /GPU:1 for node 'clone_1/fifo_queue_Dequeue' because the input edge from 'prefetch_queue/fifo_queue' is a reference connection and already has a device field set to /CPU:0
I tensorflow/core/common_runtime/simple_placer.cc:669] Ignoring device specification /GPU:0 for node 'clone_0/fifo_queue_Dequeue' because the input edge from 'prefetch_queue/fifo_queue' is a reference connection and already has a device field set to /CPU:0

GPU运行正常(内存使用率和GPU利用率),但与单个GPU训练相比,训练速度并不快。

此问题可能与:https://github.com/tensorflow/tensorflow/issues/8061有关

我将非常高兴收到您对这个问题的答案、意见或具体建议。

CUDA版本: 8.0版,V8.0.53版

从二进制文件安装的TensorFlow,测试版本: 1.0.1和1.1.0rc

图形处理器: NVIDIA Tesla P100 (SXM2)

EN

回答 2

Stack Overflow用户

发布于 2017-11-21 14:07:53

请遵循本文档https://github.com/tensorflow/tensorflow/issues/12689以确保变量存储在CPU中,我们需要在slim.arg_scope([slim.model_variable, slim.variable], device='/cpu:0'):中使用上下文管理器。

它解决了我的问题。

票数 2
EN

Stack Overflow用户

发布于 2017-05-31 06:42:15

即使这个答案可能会晚一点,训练也不应该更快(以秒为单位)。相反,创建了另一个模型,使用您的参数导致有效的批处理大小为64,因此您可以将最大步数减半。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/43405358

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档