BrikerMan/Kashgari

[BUG] AttributeError: module 'tensorflow.python.keras.utils.generic_utils' has no attribute 'populate_dict_with_module_objects'

learnpythontheew opened this issue · 1 comments

You must follow the issue template and provide as much information as possible. otherwise, this issue will be closed.
请按照 issue 模板要求填写信息。如果没有按照 issue 模板填写,将会忽略并关闭这个 issue

Check List

Thanks for considering to open an issue. Before you submit your issue, please confirm these boxes are checked.

You can post pictures, but if specific text or code is required to reproduce the issue, please provide the text in a plain text format for easy copy/paste.

Environment

  • OS [e.g. Mac OS, Linux]: linux
  • Python Version:3.8
  • requirements.txt:
[Paste requirements.txt file here]

Issue Description

What

[Tell us about the issue]
from kashgari.embeddings import BertEmbedding报错

Reproduce

from kashgari.embeddings import BertEmbedding
[The steps to reproduce this issue. What is the URL you were trying to play, where did you put your code, etc.]

Other Comment

[Add anything else here]

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-66-550c659cf1fa> in <module>
     11 
     12 #bert extract feature
---> 13 from kashgari.embeddings import BertEmbedding
     14 from kashgari.processors import SequenceProcessor
     15 bert = BertEmbedding('<BERT_MODEL_FOLDER>')

/opt/conda/lib/python3.8/site-packages/kashgari/__init__.py in <module>
     22 from kashgari.__version__ import __version__
     23 from kashgari.macros import config
---> 24 from kashgari import layers
     25 from kashgari import corpus
     26 from kashgari import embeddings

/opt/conda/lib/python3.8/site-packages/kashgari/layers/__init__.py in <module>
      9 
     10 from typing import Dict, Any
---> 11 from tensorflow import keras
     12 
     13 from .conditional_random_field import KConditionalRandomField

/opt/conda/lib/python3.8/site-packages/tensorflow/__init__.py in <module>
     39 import sys as _sys
     40 
---> 41 from tensorflow.python.tools import module_util as _module_util
     42 from tensorflow.python.util.lazy_loader import LazyLoader as _LazyLoader
     43 

/opt/conda/lib/python3.8/site-packages/tensorflow/python/__init__.py in <module>
     82 from tensorflow.python import data
     83 from tensorflow.python import distribute
---> 84 from tensorflow.python import keras
     85 from tensorflow.python.feature_column import feature_column_lib as feature_column
     86 from tensorflow.python.layers import layers

/opt/conda/lib/python3.8/site-packages/tensorflow/python/keras/__init__.py in <module>
     25 
     26 # See b/110718070#comment18 for more details about this import.
---> 27 from tensorflow.python.keras import models
     28 
     29 from tensorflow.python.keras.engine.input_layer import Input

/opt/conda/lib/python3.8/site-packages/tensorflow/python/keras/models.py in <module>
     22 from tensorflow.python.framework import ops
     23 from tensorflow.python.keras import backend as K
---> 24 from tensorflow.python.keras import metrics as metrics_module
     25 from tensorflow.python.keras import optimizers
     26 from tensorflow.python.keras.engine import network

/opt/conda/lib/python3.8/site-packages/tensorflow/python/keras/metrics.py in <module>
     35 from tensorflow.python.framework import tensor_spec
     36 from tensorflow.python.keras import backend as K
---> 37 from tensorflow.python.keras.engine import base_layer
     38 from tensorflow.python.keras.engine import base_layer_utils
     39 from tensorflow.python.keras.losses import binary_crossentropy

/opt/conda/lib/python3.8/site-packages/tensorflow/python/keras/engine/base_layer.py in <module>
     49 from tensorflow.python.keras import backend
     50 from tensorflow.python.keras import constraints
---> 51 from tensorflow.python.keras import initializers
     52 from tensorflow.python.keras import regularizers
     53 from tensorflow.python.keras.engine import base_layer_utils

/opt/conda/lib/python3.8/site-packages/tensorflow/python/keras/initializers/__init__.py in <module>
    125 # from ALL_OBJECTS. We make no guarantees as to whether these objects will
    126 # using their correct version.
--> 127 populate_deserializable_objects()
    128 globals().update(LOCAL.ALL_OBJECTS)
    129 

/opt/conda/lib/python3.8/site-packages/tensorflow/python/keras/initializers/__init__.py in populate_deserializable_objects()
     83     v2_objs = {}
     84     base_cls = initializers_v2.Initializer
---> 85     generic_utils.populate_dict_with_module_objects(
     86         v2_objs,
     87         [initializers_v2],

AttributeError: module 'tensorflow.python.keras.utils.generic_utils' has no attribute 'populate_dict_with_module_objects'

stale commented

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.