Skip to content
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

Possible error in MobileBert embedding convolution #1970

Open
jaemo91 opened this issue Mar 29, 2024 · 0 comments
Open

Possible error in MobileBert embedding convolution #1970

jaemo91 opened this issue Mar 29, 2024 · 0 comments

Comments

@jaemo91
Copy link

jaemo91 commented Mar 29, 2024

if config.trigram_input:
inputs = self.word_embedding_output
self.embedding_output = tf.concat(
[tf.pad(inputs[:, 1:], ((0, 0), (0, 1), (0, 0))),
inputs,
tf.pad(inputs[:, :-1], ((0, 0), (1, 0), (0, 0)))],
axis=2)

(This gives you [1=0=pad],[2=1=0],[3=2=1] style concatenation)
It seems the concatenation is being done backwards and it should be done like below:

        if config.trigram_input:
          inputs = self.word_embedding_output
          self.embedding_output = tf.concat(
              [tf.pad(inputs[:, :-1], ((0, 0), (1, 0), (0, 0))),
               inputs,
               tf.pad(inputs[:, 1:], ((0, 0), (0, 1), (0, 0)))],
              axis=2)

(This gives you [pad=0=1],[0=1=2],[1=2=3] style concatenation)

Given that this change will affect all the models already generated, I don't think it would be a good idea to force an update, but I was wondering if this was intentional and if you were aware of this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant