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

why does the variable 'vocab' there have the property - 'vectors'? #100

Open
HandanDiana opened this issue Feb 15, 2022 · 1 comment
Open

Comments

@HandanDiana
Copy link

image

Hi, I have some confusions about the variable **'vocab'** there. I'm the beginner in this field, so maybe these are some silly questions. But hopefully, you guys can help to give me some suggestions. Thanks!

Firstly, whether the variable 'vocab' was generated by CharVocab.from_data function as mentioned in README.md. Additionally, if so, I couldn't find a property called 'vectors'.
What the exactly type of the variable 'vocab' there? Whether I missed other key points on 'vocab'?

@HandanDiana HandanDiana changed the title why the variable 'vocab' there has the property - 'vectors'? why does the variable 'vocab' there have the property - 'vectors'? Feb 15, 2022
@davidegraff
Copy link

vectors is an attribute of a OneHotVocabulary, a subclass of CharVocab. It's uncessary though- the purpose of the class is really to initialize the embedding layer (nn.Embedding) with the identity matrix (L18). Two notes:

  1. the weights of the embedding layer can be learned and there's nothing special about the identity matrix
  2. the embedding size does not need to be the same as the vocab size. many VAE implementations project the vocabulary into a higher-dimensional embedding space (i.e., d_emb > n_vocab) with this typically improving performance

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

No branches or pull requests

2 participants