bojone / t5_in_bert4keras

整理一下在keras中使用T5模型的要点
171 stars 28 forks source link

設置output模型時,發生[ValueError:not enough values to unpack (expected 3, got 2)]錯誤 #3

Closed fox88-tw closed 4 years ago

fox88-tw commented 4 years ago
ValueError                                Traceback (most recent call last)
<ipython-input-19-35bdf477e910> in <module>()
----> 1 output = CrossEntropy(1)([model.inputs[1], model.outputs[0]])
      2 model = Model(model.inputs, output)
      3 model.compile(optimizer=Adam(2e-4))

/usr/local/lib/python3.6/dist-packages/tensorflow/python/autograph/impl/api.py in wrapper(*args, **kwargs)
    256       except Exception as e:  # pylint:disable=broad-except
    257         if hasattr(e, 'ag_error_metadata'):
--> 258           raise e.ag_error_metadata.to_exception(e)
    259         else:
    260           raise

ValueError: in user code:

    /usr/local/lib/python3.6/dist-packages/bert4keras/layers.py:949 call  *
        loss = self.compute_loss(inputs, mask)
    <ipython-input-5-613b8c5c3994>:113 compute_loss  *
        y_true, y_mask, y_pred = inputs

    ValueError: not enough values to unpack (expected 3, got 2)

網路上無適當的解方,僅得知[所需的 數值 數量不足],但卻不如何修改、增加~~

fox88-tw commented 4 years ago

已找到錯誤!謝謝劍大~