当前位置:网站首页>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文件就行了
边栏推荐
- Redis - 7、事務操作
- SQL Server到Oracle连接服务器的实现_包括查询的实现
- KNN classification of MATLAB (with source code) is used to realize pixel classification (set the proportion of training set by yourself) and print test accuracy
- In C # development, the third-party components lambdaparser, dynamicexpresso and z.expressions are used to dynamically parse / evaluate string expressions
- DevSecOps: CI/CD 流水线安全的最佳实践
- Reddit产品主管:为Web3创作者准备的NFT会员实用指南
- Redis - 9、持久化之AOF(Append OnlyFile)
- 把蔚来告上法庭,奥迪急什么?
- 【高频笔试题】513. 找树左下角的值
- 机器学习与深度学习 --- 激活函数(未完待续)
猜你喜欢

Heavyweight live | bizdevops: the way to break the technology situation under the tide of digital transformation

Redis - 12、应用问题解决

报错:unresolved variable $bus 及 “TypeError: Cannot read property ‘$on‘ of undefined“

初始transformer需要了解的一些概念

Find all prime numbers between 100 and 200

Foreign lead needs energy, interest, research, diligence and is indispensable

12306抢票使用教程

EndeavourOS安装配置全攻略!

Redis - 11、集群(Cluster)

Word技巧汇总
随机推荐
Redis - 5. Jedis operation redis6
oracle存储过程2
Could not determine which parameter to assign generated keys to
有时候努力,并不是自己心甘情愿
酷开电视adb
论文解读——Factorization Meets the Neighborhood: a Multifaceted Collaborative Filtering Model
本地裸文件包含
EndeavourOS安装配置全攻略!
Matlab的KNN分類使用(附源碼),實現像素分類(自己設置訓練集比例),打印測試精度
Lyndon breaks down learning notes
[2022 summer] [leetcode] 31 Next spread
Redis - 12、应用问题解决
Find all prime numbers between 100 and 200
Linux Installation and deployment mysql5.7 (enterprise common Edition) ultra detailed
Take Wei Lai to court. What's Audi's hurry?
[WMCTF2020]Make PHP Great Again 2.0
Configure the GPU version of pytorch and torchvision, and learn the GPU version of torch step
SQL函数——将一对多关系转换成一对一关系
Numpy库常用功能 合并
国外LEAD需要干劲、兴趣、钻研、勤奋、缺一不可