Model Accuracy Degradation by 6x when Switching TF_USE_LEGACY_KERAS from "1" (Keras 2) to "0" (Keras 3) #20320
Labels
stat:awaiting response from contributor
type:support
User is asking for help / asking an implementation question. Stackoverflow would be better suited.
Summary
There is a significant degradation in model performance when changing the
TF_USE_LEGACY_KERAS
environment variable between Keras 2 and Keras 3 in an Encoder-Decoder Network for Neural Machine Translation. Withos.environ["TF_USE_LEGACY_KERAS"] = "1"
(Keras 2), the validation set accuracy is much higher (60% v.s. 10%) compared to whenos.environ["TF_USE_LEGACY_KERAS"] = "0"
(Keras 3), despite no changes in the model architecture or training procedure.System Information:
Steps to Reproduce:
os.environ["TF_USE_LEGACY_KERAS"] = "1"
to use Keras 2 and run the Encoder-Decoder model.os.environ["TF_USE_LEGACY_KERAS"] = "0"
to use Keras 3 and run the same model.Expected Results:
The validation accuracy should remain consistent between both runs, or at least be comparable.
Looking for guidance on the cause of this discrepancy and possible ways to resolve this performance issue.
The text was updated successfully, but these errors were encountered: