日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

Pocketflow 使用

發布時間:2023/12/4 编程问答 29 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Pocketflow 使用 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

Pocketflow的簡介:https://pocketflow.github.io/

由兩個modules組成:Learner module 負責利用隨機hyperparameters壓縮并fine-tuning,optimizer module 負責依據隨機參數對應的結果確定最佳的壓縮參數。Learn module 遍歷的hyperparameter來自于:

NameDescription
ChannelPrunedLearnerchannel pruning with LASSO-based channel selection (He et al., 2017)
DisChnPrunedLearnerdiscrimination-aware channel pruning (Zhuang et al., 2018)
WeightSparseLearnerweight sparsification with dynamic pruning schedule (Zhu & Gupta, 2017)
UniformQuantLearnerweight quantization with uniform reconstruction levels (Jacob et al., 2018)
UniformQuantTFLearnerweight quantization with uniform reconstruction levels and TensorFlow APIs
NonUniformQuantLearnerweight quantization with non-uniform reconstruction levels (Han et al., 2016)

壓縮后可以快速訓練收斂。

optimizer module 的策略來自于

Gaussian Processes (GP, Mockus, 1975), Tree-structured Parzen Estimator (TPE, Bergstra et al., 2013), and Deterministic Deep Policy Gradients (DDPG, Lillicrap et al., 2016) 以及當前hyperparameters的reward

安裝Pocketflow:https://pocketflow.github.io/installation/

本地安裝或在docker環境中安裝

本地安裝:

配置文件 path.conf 說明數據集路徑(.tfrecord)以及預訓練模型的路徑

首先安裝 anaconda 和 tensorflow,注意python 版本不能高于3.6

一句話就可訓練:./scripts/run_local.sh nets/resnet_at_cifar10_run.py

docker環境安裝:

官方推薦??horovod?docker ,因其支持多GPU分布

一句話訓練:./scripts/run_docker.sh nets/resnet_at_cifar10_run.py

?

壓縮方法:

參考https://pocketflow.github.io/tutorial/

輸出:*.tflite 文件

Step 1: 準備數據成TFRecord格式

Step 2: 根據上面的步驟訓練或直接下載 .ckpt 模型 保存在?models

Step 3: 選擇壓縮方法 開始調優壓縮后的模型?

./scripts/run_local.sh nets/resnet_at_ilsvrc12_run.py \ --learner dis-chn-pruned

壓縮方法與arg對應:

Learner nameLearner classNote
full-precFullPrecLearnerNo model compression
channelChannelPrunedLearnerChannel pruning with LASSO-based channel selection (He et al., 2017)
dis-chn-prunedDisChnPrunedLearnerDiscrimination-aware channel pruning (Zhuang et al., 2018)
weight-sparseWeightSparseLearnerWeight sparsification with dynamic pruning schedule (Zhu & Gupta, 2017)
uniformUniformQuantLearnerWeight quantization with uniform reconstruction levels (Jacob et al., 2018)
uniform-tfUniformQuantTFLearnerWeight quantization with uniform reconstruction levels and TensorFlow APIs
non-uniformNonUniformQuantLearnerWeight quantization with non-uniform reconstruction levels (Han et al., 2016)

保存在models_dcp_eval文件夾

Step 3: 轉化成 tflite 格式:

python tools/conversion/export_pb_tflite_models.py \ --model_dir models_dcp_eval

保存在?models_dcp_eval

?

?

?

總結

以上是生活随笔為你收集整理的Pocketflow 使用的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。