![](/img/trans.png)
[英]How to download TensorFlow trained model on Google Colab?
[英]using a tensorflow model trained on google colab on my PC
我正在使用 colab 訓練張量tensorflow
模型。 我看到google colab默認安裝了以下版本:
import tensorflow
tensorflow.__version__
2.6.0
...
[train model]
...
model.save('mymodel.h5')
但是,當我將模型下載到我的 windows pc 並嘗試使用tensorflow/keras
加載它時,出現錯誤
import keras
import tensorflow
model = keras.models.load_model(r"mymodel.h5")
model_config = json.loads(model_config.decode('utf-8'))
AttributeError: 'str' object has no attribute 'decode'
在網上搜索后,這似乎是由於不同的tensorflow
版本(colab 與我的 PC)。
tensorflow.__version__
Out[4]: '2.1.0'
問題是,當我使用tensorflow
conda install tensorflow-gpu
這是我得到的版本。 即使試圖強制conda install tensorflow-gpu==2.6
也不會安裝任何東西。
我該怎么辦? 謝謝!
現在的hacky解決方案......
conda install tensorflow-gpu
下載 tensorflow 2.1 + CUDA 和 CuDNNpip install tensorflow-gpu==2.6 --upgrade --force-reinstall
升級GPU 不工作(可能是因為 CUDA 版本不正確)但至少我可以使用 CPU 運行 tf 2.6 腳本。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.