在tf1.15的环境中运行github上slot-gated代码,出现rnn_cell_impl中没有rnn_cell_impl属性的问题。已解决

Traceback (most recent call last):
  File "G:\python_project\Slot-Gated\SlotGated-SLU\train.py", line 188, in
    training_outputs = createModel(input_data, len(in_vocab['vocab']), sequence_length, len(slot_vocab['vocab']), len(intent_vocab['vocab']), layer_size=arg.layer_size)
  File "G:\python_project\Slot-Gated\SlotGated-SLU\train.py", line 119, in createModel
    y = rnn_cell_impl._linear(slot_inputs, attn_size, True)
AttributeError: module 'tensorflow.python.ops.rnn_cell_impl' has no attribute '_linear'

环境配置:tf1.15+w10+anaconda+python3.7+cuda11.2+cudnn8.1.0

win10下给rtx3090用的tensorflow1.15以及c++ dll - 知乎 (zhihu.com)

项目源码地址:MiuLab/SlotGated-SLU: Slot-Gated Modeling for Joint Slot Filling and Intent Prediction (github.com)

解决方法:将源代码

from tensorflow.python.ops import rnn_cell_impl

替换成

from tensorflow_core.contrib.rnn.python.ops import core_rnn_cell as rnn_cell_impl

可以解决问题

你可能感兴趣的:(tensorflow,python)