-
Notifications
You must be signed in to change notification settings - Fork 21
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
a problem of code #5
Comments
Hi, are you using the same Transformer version as indicated in the requirement file? |
Because the Transformer version is too old, so I can't install it. |
I cannot replicate the error because I still have the old version. I suggest you the following and hope it helps: change line#26 in the above image as Please, make sure the shape of a returned tensor is (batch, seq_length, hidden_dim). |
OK, thank you! I will try this! |
You're welcome, please let me know if it works. I may update my code for those who have newer versions of the Transformer! Thanks :) |
I think it doesn't work.
then output is
you will get a dict type of output, and you can output.last_hidden_state to get last hidden state |
I have just updated the model script to handle both old and new versions of Transformers. |
It seems to me that you have added something to the learner script, right? This error is quite weird since it's not relevant to any part of my codes! |
my fault! Sorry, maybe I have made a mistake! I'm sorry! |
Glad to heat that it works fine for you now :) |
After I change anecdotes and ambience to another word, respectively. It works well! I think maybe its vocabulary doesn't have these words. |
Yes, Transformers-based models use Word-Piece tokenizer, which can split words that don't exit in the vocabulary set into pieces as you got in your example ('anecdotes' to 'an', '##ec', '##dote', and '###s'). This is how such models deal with OOV! |
I just try to run the code, I download the dataset, but I got an error about "TypeError: linear(): argument 'input' (position 1) must be Tensor, not str". I check the code, and I find the two lines code maybe have a mistake.
I just change them to
but I still got the same mistake, I don't know why.
Here is my colab code
I would appreciate it if you could help me again!
The text was updated successfully, but these errors were encountered: