"git@developer.sourcefind.cn:chenpangpang/transformers.git" did not exist on "e75c3f70aa5122dbdd06cc693a58df837e422721"
Unverified Commit 35c04596 authored by Yih-Dar's avatar Yih-Dar Committed by GitHub
Browse files

Fix `main_input_name` in `src/transformers/keras_callbacks.py` (#24916)



fix
Co-authored-by: default avatarydshieh <ydshieh@users.noreply.github.com>
parent 85514c17
...@@ -193,8 +193,7 @@ class KerasMetricCallback(Callback): ...@@ -193,8 +193,7 @@ class KerasMetricCallback(Callback):
# This dense conditional recognizes the case where we have an encoder-decoder model, but # This dense conditional recognizes the case where we have an encoder-decoder model, but
# avoids getting tangled up when we just have a model with a layer called 'encoder' # avoids getting tangled up when we just have a model with a layer called 'encoder'
if hasattr(self.model, "encoder") and hasattr(self.model.encoder, "main_input_name"): if hasattr(self.model, "encoder") and hasattr(self.model.encoder, "main_input_name"):
if self.model.encoder.main_input_name != self.model.main_input_name: main_input_name = self.model.encoder.main_input_name
main_input_name = self.model.encoder.main_input_name
else: else:
main_input_name = getattr(self.model, "main_input_name", "input_ids") main_input_name = getattr(self.model, "main_input_name", "input_ids")
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment