解决集群服务器异构资源下的tensorflow 多版本冲突问题

解决:根据服务器上上的计算资源类型进入不同的的虚拟环境后再执行相应的脚本

以 tensorflow object detection api 的模型导出部分脚本化为例:

高亮部分就是判断当前主机是否有GPU,有就进入tensorflow-gpu版本的虚拟环境,
不然就是进入cpu版本的环境

#!/bin/bash
show_usage=“args: [–pipeline_config_path, --trained_checkpoint_prefix, --output_directory]”
source /etc/profile

lspci | grep -i nvidia &> /dev/null
if [ $? -eq 0 ];then
echo "有显卡"
source activate cvtf
else
echo "没显卡"
source activate cpu_cvtf
fi

INPUT_TYPE=image_tensor
PIPELINE_CONFIG_PATH= 1 T R A I N E D C K P T P R E F I X = {1} TRAINED_CKPT_PREFIX= 1TRAINEDCKPTPREFIX={2}
EXPORT_DIR= 3 p y t h o n p a t h = ‘ / u s r / b i n / w h i c h p y t h o n ‘ d n a m e = {3} python_path=`/usr/bin/which python` dname= 3pythonpath=/usr/bin/whichpythondname=(dirname “$PWD”)

$python_path KaTeX parse error: Expected 'EOF', got '\ ' at position 89: …=image_tensor \̲ ̲--pipeline_conf…{PIPELINE_CONFIG_PATH}
–trained_checkpoint_prefix=KaTeX parse error: Expected 'EOF', got '\ ' at position 24: …_CKPT_PREFIX} \̲ ̲--output_direct…{EXPORT_DIR}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值