-
Notifications
You must be signed in to change notification settings - Fork 29.2k
[WIP] T5v1.1 & MT5 #8488
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] T5v1.1 & MT5 #8488
Conversation
Maybe wrong model config for T5.1.1. For instance, T5.1.1.small should have num_layers=8 and num_heads=6. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, there are some problems I found:
- different model configs, compared with the official
- relu maybe unnecessary in FFN
- lm_head weight should not share with the embedding of enc/dec
And just point it out if anything wrong :)
Thanks yeah, I implemented that. The new model structure is now equal to mesh t5 v1.1. If you download the t5v1.1 There is still quite some work to do: write more tests, lots of cleaning and better design, and check if mT5 works with it. |
Hi, |
loss = model(input_ids, labels=labels).loss | ||
mesh_tf_loss = -(labels.shape[-1] * loss.item()) | ||
|
||
if mesh_tf_loss - score[0][0] < 1e-4: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe better to use abs()
here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will delete this file eventually - it's just for now :-)
Hmm, it works for me - do you experience that for T5v1.1 or mT5? |
return self.weight * x | ||
|
||
|
||
class T5v2DenseReluDense(nn.Module): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This class differs from previous T5DenseReluDense
significantly -> different weights are used here
) | ||
|
||
sequence_output = decoder_outputs[0] | ||
# Rescale output before projecting on vocab |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For T5v1.1 there is no rescaling because the input and output embedding are not tied.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree on these changes. But the PyTorch T5.1.1 model still differs from the official tf version. I'm working on it too.
Aha, the checking is OK now. Yesterday I made a mistake that when I changed the test input sentence in the check script, I didn't update the input length for MTF model from 4 to a longer value like 128. So actually the MTF model and PyTorch model received different inputs, and of course got different results. Besides, if I add the z-loss to the CE loss at last, it differs from MTF score again. I just found MTF ignores z-loss when not training (code). So I think MTF model score does not include z-loss, but its training does, which is absent from HF T5 training. Well, this is absolutely not a blocking issue now. Appreciate your great work :) |
closing in favor of #8552. |
What does this PR do?
Fixes # (issue)
Before submitting
Pull Request section?
to the it if that's the case.
documentation guidelines, and
here are tips on formatting docstrings.
Who can review?
Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors which may be interested in your PR.