Das-Boot / scite

Code and data for paper 'Causality extraction based on self-attentive BiLSTM-CRF with transferred embeddings'
https://github.com/Das-Boot/scite
Apache License 2.0
63 stars 16 forks source link

add_weight in CRF has issues with multiple names #9

Open FedericoCampe8 opened 3 years ago

FedericoCampe8 commented 3 years ago

Running the code "as-is" I see

/content/ChainCRF.py in build(self, input_shape) 302 name='U', 303 regularizer=self.U_regularizer, --> 304 constraint=self.U_constraint) 305 306 self.b_start = self.add_weight((n_classes, ),

TypeError: add_weight() got multiple values for argument 'name'

Is the code maintained?

Ding-Chian commented 5 months ago
    可能因为它把第一个参数当成了name,而它实际上是shape
    更改为下面的代码:
    self.U = self.add_weight(name='U',
                             shape=(n_classes, n_classes),
                             initializer=self.init,
                             regularizer=self.U_regularizer,
                             constraint=self.U_constraint)

或者你看另一个人提出的问题,里面作者给出了另外一个ChainCRF.py文件,替换原来的就可以了