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

歡迎訪問 生活随笔!

生活随笔

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

编程问答

日常ERROR笔记

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

1、port:443報錯

Failed to connect to raw.githubusercontent.com:443(https://zhuanlan.zhihu.com/p/115450863)

2、Tensorflow:AssertionError: Bad argument number for Name: 3, expecting 4 (bug)

tf=1.14環境,查看安裝的gast包版本,版本太高不兼容
pip install gast==0.2.2

3、h5文件錯誤:解決IOError Unable to open file file signature not found

h5文件0字節

4、ValueError: Tensor Tensor(“dense/Sigmoid:0”, shape=(?, 13), dtype=float32) is not an element of this graph.

keras模型在Flask應用中調用時就會出現該錯誤,本質原因是web應用的模型初始化和模型調用不在同一個線程導致的,解決方法:在load_model后,立刻調用一次predict。

5、tensorflow.python.framework.errors_impl.InvalidArgumentError: Tensor Input-Token:0, specified in either feed_devices or fetch_devices was not found in the Graph

(離線模型跑的好好的,放進web應用就各種報錯~~~出現錯誤5,就無須錯誤4中的修改了)

因為需要加載兩個模型,底層tensorflow面對兩個模型懵圈分不清楚了,解決方法是定義不同的計算圖和會話:
from tensorflow.python.keras.backend import set_session import tensorflow as tf # 程序開始時聲明 # tf2中: graph = tf.compat.v1.get_default_graph() # 在model加載前添加set_session sess1 = tf.Session() graph1 = tf.get_default_graph() set_session(sess1) model1.load_model(model_path1)sess2 = tf.Session() graph2 = tf.get_default_graph() set_session(sess2) model2.load_model(model_path2) # 每次使用有關模型請求時 for each request:global sess1global graph1with graph1.as_default():set_session(sess1)model1.predict(...)global sess2global graph2with graph2.as_default():set_session(sess2)

6、ImportError: dlopen: cannot load any more object with static TLS

import kashgari時報該sklearn的錯誤,網上查資料,和包引用順序之間有關系,*.py腳本中雖然沒用到sklearn,但是在import kashgari之前import sklearn,完美解決該問題。

7、tensorflow.python.framework.errors_impl.InvalidArgumentError: No OpKernel was registered to support Op ‘CudnnRNN’ used by node

GPU訓練的模型,本地CPU加載的時候報錯,可以將帶有cudnn的部分刪除,本人代碼里沒有cudnn,只是將模型中的json文件中的cudnn刪除,問題解決。

8、You can turn this error into a warning by using the flag ignore_longer_outputs_than_inputs

輸出維度大于輸入,tensorflow的話,將 ignore_longer_outputs_than_inputs改為True

tf.compat.v1.nn.ctc_loss(labels, inputs=None, sequence_length=None, preprocess_collapse_repeated=False, ctc_merge_repeated=True, ignore_longer_outputs_than_inputs=False, time_major=True,logits=None)

用keras的話,需要去安裝包更改ignore_longer_outputs_than_inputs=True:

/usr/local/lib/python3.7/site-packages/tensorflow_core/python/ops/ctc_ops.py

9、TypeError: get_encoders() got an unexpected keyword argument ‘use_adapter’

keras-transformer 版本問題

10、kashgari1.1.1 error

original_keras_version = f.attrs[‘keras_version’].decode(‘utf8’)
AttributeError: ‘str’ object has no attribute 'decode
python uninstall h5py pip install h5py==2.10

11、NotImplementedError: Cannot convert a symbolic Tensor (up_sampling2d_5_target_2:0) to a numpy array.

tensorflow版本問題,更新到tf 2.2.0試試

12、TypeError: ‘BertTokenizerFast’ object is not callable

transformers版本問題,更新就好了

13、MaxOS/Linux 安裝horovod報錯: subprocess.CalledProcessError: Command '[‘cmake’ ERROR: Command errored out with exit status 1

MacOS:1.需要安裝cmake,官網下載并安裝(可搜教程);2.確保g++已安裝;3.安裝libuv
Linux:教程

14、訓練幾個batch后,損失函數為 nan

損失函數計算過程中,計算導數的時候,存在無窮大,tensorflow或keras可以分別利用tf.clip_by_value(value, min, max)或K.clip(value, min, max)設置上下界。

總結

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

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