当前位置:网站首页>Tensorflow2 模型优化环境快速搭建
Tensorflow2 模型优化环境快速搭建
2022-06-22 11:55:00 【Johns】
一. 环境安装
1. 安装Anaconda并创建虚拟环境
wget https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/Anaconda3-2020.07-Linux-x86_64.sh --no-check-certificate
bash Anaconda3-2020.07-Linux-x86_64.sh
source ~/.bashrc
# 检查是否安装成功, 需要看配置有没有写到环境变量里
conda -V
# “tf2”是你建立的conda虚拟环境的名字
conda create --name tf2 python=3.7
# 进入名为“tf2”的conda虚拟环境
conda activate tf2 2. 安装tf2.5(GPU版本包含了CPU)
pip install tensorflow-gpu==2.5.0 -i https://pypi.douban.com/simple验证下是否安装正常, 命令行输入: python3, 然后粘贴以下内容, 看结果是否能正常输出
import tensorflow as tf
A = tf.constant([[1, 2], [3, 4]])
B = tf.constant([[5, 6], [7, 8]])
C = tf.matmul(A, B)
print(C)Output:
tf.Tensor(
[[19 22]
[43 50]], shape=(2, 2), dtype=int32)3. 安装Dokcer和 Nvidia-Docker
yum install tlinux-release-docker-ce docker-ce
# 下载nvidia-docker的repo文件
curl -s -L https://nvidia.github.io/nvidia-docker/centos7/nvidia-docker.repo | tee /etc/yum.repos.d/nvidia-docker.repo
# 安装
yum install nvidia-container-runtime
# 安装完成后需要启动一下docker
service docker start4. Docker安装TFServing (GPU版本包含了CPU)
docker pull tensorflow/serving:2.5.3-gpu5. Tensorboard安装
conda activate tf2
pip3 install tensorboard==2.5.0
pip3 install tensorboard-data-server==0.6.1
pip3 install tensorboard-plugin-profile==2.5.0
pip3 install tensorflow-model-optimization==0.7.06. Tensorboard Profiler抓包
nohup tensorboard --logdir=/tmp/tensorboard --host=127.0.0.1 --port=6006 &进入 http://localhost:6006/ 开始进行抓包, 抓包前需要选择PROFILE选项, 然后填写对应配置(注意这里tensorboard和tfserving必须是在同一台机器启动), 抓取期间使用TF-preftest工具进行请求.
7. 使用Netron可视化模型h5文件
首先下载并安装 https://netron.app/, 然后打开模型里面的h5文件就行了
边栏推荐
- 职场杰出人士的20个好习惯
- Redis - 3、发布和订阅
- 得物技术复杂 C 端项目的重构实践
- Struggle, programmer -- Chapter 41 all kinds of things today are like water without trace; On the eve of the Ming Dynasty, you are a stranger
- Sometimes hard work is not what you are willing to do
- 《梦华录》成吸金王:广告主投500万排不上队,腾讯视频赢麻了?
- 国外LEAD需要干劲、兴趣、钻研、勤奋、缺一不可
- Messari年度报告-2021
- [安洵杯 2019]iamthinking
- sql注入绕过方法总结
猜你喜欢
![[安洵杯 2019]iamthinking](/img/56/ffdcdeb8246d9ae7fb1eb72b45b614.png)
[安洵杯 2019]iamthinking

重磅直播|BizDevOps:数字化转型浪潮下的技术破局之路

2022过半,没有新风口

Redis - 7. Transaction operation

SPI 与 API的区别

TIS教程04-客户端

What is homology??? Cross domain error??? How to solve???

磁盘rejecting I/O to offline device故障导致4TB生产数据库无法访问

《梦华录》成吸金王:广告主投500万排不上队,腾讯视频赢麻了?

俞敏洪称未来可能开电商学院;马斯克儿子申请断绝父子关系;饿了么回应大量用户收到免单信息;B站上线付费视频...
随机推荐
Explanation of 94F question in Niuke practice match
oracle处理插入重复记录的技巧
TIS教程01-安装
jmeter生成测试报告
The input input box can only input an array between 0 and 100, with two decimal places reserved
Solution to the 55D problem of Niuke challenge
Andrdoid延时操作
SQL函数——将一对多关系转换成一对一关系
磁盘rejecting I/O to offline device故障导致4TB生产数据库无法访问
CAT敏捷团队教练工作坊 (Coaching Agile Teams) | 8月20日开课
Share 7 free super clear video resource stations! Both editing and collection are practical enough to cry!
推荐系统从入门到接着入门
[high frequency written test questions] 513 Find the value in the lower left corner of the tree
Software architecture design principles
Oracle用游标分解号码次数
[lihongyi] notes on deep learning of machine learning -- Introduction to training model clearance
云上人和物联科技加入龙蜥社区,携手打造软硬件服务生态
Redis - 12. Application problem solving
About cache exceptions: solutions for cache avalanche, breakdown and penetration
Configure the GPU version of pytorch and torchvision, and learn the GPU version of torch step