-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Vocab size for microsoft/layoutxlm-base #50
Comments
Hi, Thanks for the kind words! Actually, I recently updated the config.json of LayoutXLM, and I probably know the reason: in a recent PR, I added a LayoutXLMProcessor, together with a new LayoutXLMTokenizer/LayoutXLMTokenizerFast. Therefore, I removed the "tokenizer_class" attribute of LayoutXLM"s configuration, as this was still set to XLMRobertaTokenizer. However, you've got install Transformers from master for them to use them for now: pip install git+https://github.com/huggingface/transformers.git. Maybe it's better for me to add the tokenizer_class attribute again, and remove it once Transformers has a new version on PyPi. Thanks for reporting! |
Hmm ok I see. Well I'm using the right tokenizer and everything is working fine now. Just to update I let the model train with the previous change in the word embedding layer but it doesn't converged, the loss kept high all the training process. Appreciate your help! |
Update: I've restored the However, in the new version of Transformers, it's recommended to use |
Hello there,
First of all thank you so much for the work you are doing, it's being really helpful for me to get my hands dirty with state-of-the-art models.
Some weeks ago I fine-tunned a layoutxlm-base using this notebook as reference and it worked, even got nice results with it.
Today I tried to run another training but unfortunetaly something went wrong, after a couple of hours I noticed that the tokenizer's size and model's vocab_size is
250002
but vocab's length is250007
.So as a work around I came with this:
model.layoutlmv2.embeddings.word_embeddings = torch.nn.Embedding(250007, 768, padding_idx=1)
It seems to be working..
Furthermore I will save tokenizer and model files to ensure that will be always the same.
But my question is if I change this layer in the previous model I will get the same results? Or it is needed to re-train?
Once again, thank you so much!
The text was updated successfully, but these errors were encountered: