debug Tensorflow: ‘_UserObject‘ object has no attribute ‘add_slot‘
平台
- ubuntu
- tensoflow
现象
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
/tmp/ipykernel_39/883809998.py in <module>
----> 1 model0 = tf.saved_model.load('../input/ubiquant-dataset/nn0')/opt/conda/lib/python3.7/site-packages/tensorflow/python/saved_model/load.py in load(export_dir, tags, options)862 """863 metrics.IncrementReadApi(_LOAD_V2_LABEL)
--> 864 result = load_internal(export_dir, tags, options)["root"]865 metrics.IncrementRead()866 return result/opt/conda/lib/python3.7/site-packages/tensorflow/python/saved_model/load.py in load_internal(export_dir, tags, options, loader_cls, filters)901 try:902 loader = loader_cls(object_graph_proto, saved_model_proto, export_dir,
--> 903 ckpt_options, options, filters)904 except errors.NotFoundError as err:905 raise FileNotFoundError(/opt/conda/lib/python3.7/site-packages/tensorflow/python/saved_model/load.py in __init__(self, object_graph_proto, saved_model_proto, export_dir, ckpt_options, save_options, filters)160 self._filtered_nodes = self._retrieve_all_filtered_nodes()161
--> 162 self._load_all()163 164 if not save_options.experimental_skip_checkpoint:/opt/conda/lib/python3.7/site-packages/tensorflow/python/saved_model/load.py in _load_all(self)257 def _load_all(self):258 """Loads all nodes and functions from the SavedModel and their edges."""
--> 259 self._load_nodes()260 self._load_edges()261 # TODO(b/124045874): There are limitations with functions whose captures/opt/conda/lib/python3.7/site-packages/tensorflow/python/saved_model/load.py in _load_nodes(self)446 optimized_variable = nodes[447 slot_variable_proto.original_variable_node_id]
--> 448 slot_variable = optimizer_object.add_slot(449 var=optimized_variable,450 slot_name=slot_variable_proto.slot_name)AttributeError: '_UserObject' object has no attribute 'add_slot'
解决
- 起初我猜测我训练用tensorflow2.3.1,加载模型用2.6.2。二者不一致导致,半天功夫升级cuda、cudnn和tf后,问题仍然存在
- 加载pb模型时,采用了tf.keras.models.load_model,替换tf.saved_model.load。问题解决
参考
- https://github.com/tensorflow/models/issues/8990
debug Tensorflow: ‘_UserObject‘ object has no attribute ‘add_slot‘相关推荐
- 成功解决tensorflow.keras: AttributeError: ‘str‘ object has no attribute ‘decode‘
tensorflow.keras: AttributeError: 'str' object has no attribute 'decode' 出现该问题,解决分两步首先检测自身的版本是否对应, 然 ...
- Tensorflow报错:AttributeError: 'module' object has no attribute 'scalar_summary'
报错: tf.scalar_summary(l.op.name + ' (raw)', l) AttributeError: 'module' object has no attribute 'sca ...
- M1Mac使用TensorFlow出现AttributeError: ‘h5py.h5t.TypeID‘ object has no attribute ‘set_fields‘的解决办法
问题 TensorFlow使用Apple官方优化版2.4.1(conda-forge),使用tf.keras后端时候出现: AttributeError: 'h5py.h5t.TypeID' obje ...
- tensorflow出现如下错误:AttributeError: ‘module’ object has no attribute ‘merge_all_summaries’
tensorflow版本问题,导致函数的变化,summary使用如下变化机制: AttributeError: 'module' object has no attribute 'merge_all_ ...
- ‘tensorflow.python.framework.ops.EagerTensor‘ object has no attribute ‘reshape‘
'tensorflow.python.framework.ops.EagerTensor' object has no attribute 'reshape' 可以将其用numpy读取后再reshap ...
- ‘Tensor‘ object has no attribute ‘_keras_history‘——keras和tensorflow版本不兼容
'Tensor' object has no attribute '_keras_history'--keras和tensorflow版本不兼容 每天踩一坑,坑坑不一样,每天的生活状态就是踩坑踩坑,爬 ...
- 北京大学曹建老师tensorflow慕课中在运行GRU模型时,history = model.fit()中遇到的问题:object has no attribute ‘dtype‘
1.在运行下方代码时,遇到了 history = model.fit(x_train, y_train, batch_size=64, epochs=50, validation_data=(x_te ...
- tensorflow报错:AttributeError: 'module' object has no attribute 'get_or_create_global_step'
Tensorflow 1.0训练官方教程中CIFAR10例子 官方教程 执行 python cifar10_train.py时 报错: AttributeError: 'module' objec ...
- 'module' object has no attribute 'scalar_summary'
TensorFlow不同版本引起的错误 报错: tf.scalar_summary(l.op.name + ' (raw)', l) AttributeError: 'module' object h ...
最新文章
- dlib人脸比对算法代码java,Python 使用dlib 5行代码实现人脸比对
- 你说我画,你画我说:全球最大中文跨模态生成模型文心ERNIE-ViLG来了!
- 干货丨机器学习傻瓜指南
- python 重写断言_历时四年,Dropbox 用 Rust 重写同步引擎核心代码
- springboot设置默认值_spring boot jpa存储数据的默认值为java的默认值
- 如何和后台接触的_后台产品,不只是做支持
- 关于大型网站技术演进的思考(十四)--网站静态化处理—前后端分离—上(6)...
- vb6计算机,[计算机软件及应用]VB6.ppt
- c语言笔试题7(25),嵌入式软件工程师C语言笔试题(7页)-原创力文档
- ProE5.0有限元分析优化设计Mechanica视频教程
- css中如何使图标的旋转
- 手把手教你软件著作权申请(全流程)(不花一分冤枉钱)
- 人生就是个学习、思考与实践的过程
- opencv之伪彩变换
- Android8.0未知来源应用安装权限
- GIT fatal: unable to auto-detect email address (got 'Administrator@DESKTOP-880G72L.(none)')
- 自考计算机专业实践报不了名,2014年9月北京自考计算机及应用专业实践课程网报通知...
- 出现BOOTMGR is missing 最简单实用的解决方案
- JAVA面试100道必考题
- 精选| 2020年5月R新包推荐(第42期)