AttributeError:"google.protobuf.pyext._message.RepeatedCompositeCo"对象没有属性"append" [英] AttributeError: 'google.protobuf.pyext._message.RepeatedCompositeCo' object has no attribute 'append'

查看:1038
本文介绍了AttributeError:"google.protobuf.pyext._message.RepeatedCompositeCo"对象没有属性"append"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在基于Google Collab上的MobileNetv2预训练模型构建迁移学习模型.直到昨天,一切都很好.但是,今天,在执行

I am building a transfer learning model on the MobileNetv2 pretrained model on Google Collab. Till yesterday, everything was fine. But, today, on executing

#Create the base model(feature_extractor) from the pre-trained model MobileNet V2
_URL = "https://tfhub.dev/google/tf2-preview/mobilenet_v2/feature_vector/2"
feature_extractor = hub.KerasLayer(_URL, input_shape=(_TARGET_SIZE, _TARGET_SIZE,3))

我得到了错误:


---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-29-663d4cbb70df> in <module>()
      2 _TARGET_SIZE = 224
      3 _URL = "https://tfhub.dev/google/tf2-preview/mobilenet_v2/feature_vector/2"
----> 4 feature_extractor = hub.KerasLayer(_URL, input_shape=(_TARGET_SIZE, _TARGET_SIZE,3))
      5 #print(feature_extractor._layers)


/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/ops/resource_variable_ops.py in _variable_handle_from_shape_and_dtype(shape, dtype, shared_name, name, graph_mode, initial_value)
    165     handle_data = cpp_shape_inference_pb2.CppShapeInferenceResult.HandleData()
    166     handle_data.is_set = True
--> 167     handle_data.shape_and_type.append(
    168         cpp_shape_inference_pb2.CppShapeInferenceResult.HandleShapeAndType(
    169             shape=shape.as_proto(), dtype=dtype.as_datatype_enum))

AttributeError: 'google.protobuf.pyext._message.RepeatedCompositeCo' object has no attribute 'append'

任何想法为什么会发生这种情况,我是否需要进入/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/ops/resource_variable_ops.py 文件并制作一些变化 ?我认为它与某些更新问题有关.有什么解决方法的帮助吗?

Any idea why this happens and do I need to get into the /usr/local/lib/python3.6/dist-packages/tensorflow_core/python/ops/resource_variable_ops.py file and make some changes ? I think its related to some update issue. Any help on how to tackle it?

推荐答案

如果直到昨天运行良好,并且您没有进行任何更改,请检查以下两项: TF版本,如果最近更改了BC,则将默认" TF版本从1.14设置为1.15.rc.

If it was running fine until yesterday and you did not change anything, then check for two things- Th TF version, if it has changed bc recently they set 'default' TF version to 1.15.rc from 1.14.

如果相同,则保存该文件并关闭所有colab窗口,甚至您的chrome或您正在使用的任何浏览器,然后再次打开并尝试运行该文件.

If that is same then save this file and close all the colab windows even your chrome or whatever browser you are using then open again and try running the file.

正如我上面所说,这一定是因为TF版本.因此,请恢复为模型工作时使用的模型.正如您在下面的评论中提到的那样,它正在使用版本"dev20191010",因此回滚它可以解决您的问题.

As I said above it must be because of the TF version. So revert back to the one that you used when the model was working. As you mentioned in your comments below it was working on version ‘dev20191010’, so rolling back to it will fix your issue.

这篇关于AttributeError:"google.protobuf.pyext._message.RepeatedCompositeCo"对象没有属性"append"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆