-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
how to set padding_idx in conformer_ctc? set padding_idx = -1 may be wrong ? #5691
Comments
Thanks a lot for your report. |
Dear @sw005320, I apologize for the delay in my response. I can confirm that I have been using two versions of PyTorch, specifically 1.13.1 and 2.1.0. In the if padding_idx is not None:
if padding_idx > 0:
assert padding_idx < self.num_embeddings, 'Padding_idx must be within num_embeddings'
elif padding_idx < 0:
assert padding_idx >= -self.num_embeddings, 'Padding_idx must be within num_embeddings'
padding_idx = self.num_embeddings + padding_idx This code snippet is directly related to the issue I previously described. I hope this information helps in resolving the issue. I look forward to your feedback. Best regards, |
Thanks a lot! Several discussion items
We may need to fix it in the future, but we're also expecting that this might not cause a big issue. |
Thank you very much for your attention. Indeed, as you discussed, using <sos\eos> instead of generally does not pose a significant problem, and I will pay attention to your repair results. Currently, I am trying to reproduce a paper. The main idea is to re-input the text result of the intermediate ctc_out through Embedding and gate units to re-input the obtained intermediate text result into the next layer of the encoder. The setting of padding_idx may have a certain impact on the results, and I want to solve the problems caused by the setting of padding_idx as much as possible. I am trying to call the token_list generation stage in asr.sh,
In the subsequent settings, I still use padding_idx=-1, of course, there may be other places that need to be modified. What do you think about this, or what is your repair plan, I can try it myself. |
I see. |
Hi, Espnet Team !
I have a question regarding the default settings in ESPnet for ASR tasks, specifically related to the Conformer model when the
input_layer
is set to "embed".Firstly, I noticed that the default generated
token_list
does not include a<pad>
token. When using the Conformer model with an "embed"input_layer
, apadding_idx
needs to be passed totorch.nn.Embedding
. By default, ESPnet setspadding_idx
to -1. My understanding is that this setting is intended to avoid the<blank>
token, astoken_list[0]
is<blank>
.However,
torch.nn.Embedding
restrictspadding_idx
to be within the range of 0 tonum_embeddings - 1
. Whenpadding_idx
is less than 0, it is added tonum_embeddings
and the result is re-assigned aspadding_idx
. This means that even though we intend to setpadding_idx
as -1, it actually becomesnum_embeddings - 1
.I am concerned that this might not be the correct behavior. Could you please clarify this for me? I look forward to your response.
Best regards,
ck
The text was updated successfully, but these errors were encountered: