GlassyWing / bi-lstm-crf

使用keras实现的基于Bi-LSTM + CRF的中文分词+词性标注
Apache License 2.0
373 stars 84 forks source link

AttributeError,查不到解决办法,求指点 #6

Closed lili1234567890 closed 5 years ago

lili1234567890 commented 5 years ago

Using TensorFlow backend. WARNING:tensorflow:From /usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/op_def_library.py:263: colocate_with (from tensorflow.python.framework.ops) is deprecated and will be removed in a future version. Instructions for updating: Colocations handled automatically by placer. WARNING:tensorflow:From /usr/local/lib/python3.5/dist-packages/keras/backend/tensorflow_backend.py:3445: calling dropout (from tensorflow.python.ops.nn_ops) with keep_prob is deprecated and will be removed in a future version. Instructions for updating: Please use rate instead of keep_prob. Rate should be set to rate = 1 - keep_prob. Traceback (most recent call last): File "/home/wll/transformer-word-segmenter/examples/init.py", line 320, in get_or_create TFSegmenter.singleton = TFSegmenter(**config) File "/home/wll/transformer-word-segmenter/examples/init.py", line 118, in init self.model, self.parallel_model = self.__build_model() File "/home/wll/transformer-word-segmenter/examples/init.py", line 134, in build_model enc_output = self.encoder(emb_output, mask) File "/home/wll/transformer-word-segmenter/examples/init.py", line 177, in __encoder next_step_input = transformer_enc_layer(next_step_input, padding_mask=mask) File "/home/wll/transformer-word-segmenter/examples/transformer.py", line 193, in call output = self.attention_layer(_input, padding_mask=padding_mask) File "/usr/local/lib/python3.5/dist-packages/keras/engine/base_layer.py", line 409, in call with K.name_scope(self.name): File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/ops.py", line 6088, in enter return self._name_scope.enter() File "/usr/lib/python3.5/contextlib.py", line 59, in enter__ return next(self.gen) File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/ops.py", line 3994, in name_scope raise ValueError("'%s' is not a valid scope name" % name) ValueError: '{name}_self_attention' is not a valid scope name Traceback (most recent call last): File "train_example.py", line 63, in save_config(segmenter, config_save_path) File "/home/wll/transformer-word-segmenter/examples/init.py", line 333, in save_config json.dump(obj.get_config(), file) AttributeError: 'NoneType' object has no attribute 'get_config'

GlassyWing commented 5 years ago

这应该是tensorflow版本问题,用的是1.9.0,tensorflow几乎每个版本都不兼容,