tensowflow 训练 远程提交_远程配置 tensorflow 环境

本文档详细记录了配置Python 3.6.4、Keras 2.1.6和TensorFlow 1.7.0的全过程,包括在本地和远程Ubuntu 18.04服务器上安装环境,解决TensorFlow GPU版与CUDA、cuDNN版本不匹配的问题,以及Keras与TensorFlow GPU版的兼容性调整。最终成功实现使用GPU运行代码并控制GPU显存占用。
摘要由CSDN通过智能技术生成

1.为了对比别人的方法,需要配置的环境为:Python 3.6.4,Keras 2.1.6,Tensorflow 1.7.0

在自己电脑上,anaconda3, 直接用原环境下的 tensorflow-gpu1.13.1  发现最开始的部分代码段可以运行,但无法保存model 的代码段不起作用,造成错误。

callbacks=[ModelCheckpoint(filepath=filepath_INCV, monitor='val_acc', verbose=1, save_best_only=INCV_save_best),

只好寻求安装虚拟环境,准备一模一样的设置。

2. 新开了一个虚拟环境,tf1.7.0, 刚开始没有安装成功,似乎是选用的python版本没有完全对应,删除环境后又重新开始,成功了。似乎如果用 conda install tensorflow-gpu=1.7.0 命令在线安装tensorflow 时,会自动安装所需的 cuda9.0 toolkit 以及 cudadnn 包。

然后运行 import tensorflow as tf 会报缺少 numpy 和 pandas 等包,依次是用 conda install 安装就好,其会自动安装对应可用的版本。

import tensorflow 时,还会报

/home/guixj/anaconda3/envs/tf1.7.0/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:458: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.

_np_qint8= np.dtype([("qint8", np.int8, 1)])/home/guixj/anaconda3/envs/tf1.7.0/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:459: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.

_np_quint8= np.dtype([("quint8", np.uint8, 1)])/home/guixj/anaconda3/envs/tf1.7.0/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:460: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.

_np_qint16= np.dtype([("qint16", np.int16, 1)])/home/guixj/anaconda3/envs/tf1.7.0/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:461: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.

_np_quint16= np.dtype([("quint16", np.uint16, 1)])/home/guixj/anaconda3/envs/tf1.7.0/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:462: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.

_np_qint32= np.dtype([("qint32", np.int32, 1)])/home/guixj/anaconda3/envs/tf1.7.0/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:465: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.

np_resource= np.dtype([("resource", np.ubyte, 1)])

不过这个不是太大问题,可以修改,也可以不改。

2019-12-24 10:12:41.915407: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.1 instructions, but these are available on your machine and could speed up CPU computations.

2019-12-24 10:12:41.915435: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.2 instructions, but these are available on your machine and could speed up CPU computations.

2019-12-24 10:12:41.915442: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX instructions, but these are available on your machine and could speed up CPU computations.

2019-12-24 10:12:41.915447: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compi

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值