fix gemma-2-27b text generation pytest#1828
Conversation
|
I don't think there is an issue with Gemma2. The reason why I added the code block if self.config.final_logit_softcapping is not None:
...is because it has been in Transformers since Gemma2 was added. I'm not sure why it was not included here in #1280 and #1504 (any idea @billishyahao @Luca-Calabria ?).
Moreover, the output of the model with this change still makes sense:
I think what we should do here is rather to update the baseline here: |
You can use rebase to update baseline: python -m pytest --rebase tests/test_text_generation_example.py::test_text_generation_bf16_1x[google/gemma-2-27b-1-False-True] |
it makes sense, but there seems to be a lot of repetition. The output before this change seemed a little better. |
|
This happens with greedy search, especially with models that have not been instruction fine-tuned. I'll take a look to see how to get more realistic results by tweaking a few generation parameters. |
I have not a clear answer why it was not part of Gemma2 enabling PRs, but if this block was part of transformers and was not integrated on Gemma2 for Gaudi then it is something to add. |
|
@skaulintel It seems casting the logits to float when they are extracted from the forward pass of the model solves it: 02c4aa0#diff-c7b7c0b91ade41a0c87f1ad1f6784e4d51fb88c6a65f350042aca052b7ca1558R960 This used to be done in previous versions of Transformers. Now they have removed it but it seems it slightly affects a few models on Gaudi. So I reverted this change in the commit posted above. Closing this PR. |
So do we need to update the corresponding unit test? |
Nope, since it generates the exact same output as before when using the cast to float |
That doesn't seem to be the case for me. I collected some data on gaudi3: transformers_4_49 commit 6edca72: transformers_4_49 commit 11140b2: reference, which i think we should update? : |
I thought I added the change for Mixtral too, that was not the case, #1839 should solve it edit: ah wait this is gemma2, let me see edit2: okay I only used Gaudi2, that's why I didn't meet the same issue. I just pushed 96c8a32 to correct the Gaudi3 baseline, let me know if that works for you |
Yes, it works for me now. Thanks! |
fixes the following pytest
python -m pytest tests/test_text_generation_example.py tests/test_encoder_decoder.py -v -s -k "gemma-2-27b and test_text_generation_bf16_1x" --token=****without it, get the following assertionerror