Comments (15)
my fault! Sorry, maybe I have made a mistake! I'm sorry!
The code after updating can run without error. Thank you so much! You are the most awesome people I have seen on Github!
from spanemo.
Hi, are you using the same Transformer version as indicated in the requirement file?
from spanemo.
Because the Transformer version is too old, so I can't install it.
from spanemo.
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
"last_hidden_state = self.bert(input_ids)[0]".
Please, make sure the shape of a returned tensor is (batch, seq_length, hidden_dim).
from spanemo.
OK, thank you! I will try this!
from spanemo.
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 :)
from spanemo.
I think it doesn't work.
For example,
tokenizer = AutoTokenizer.from_pretrained("bert-base-uncased")
model = BertModel.from_pretrained('bert-base-uncased')
input_ids = torch.LongTensor([[31, 51, 99], [15, 5, 0]])
output = model(input_ids)
print(output)
then output is
BaseModelOutputWithPoolingAndCrossAttentions(last_hidden_state=tensor([[[-0.3521, -0.7047, -0.6663, ..., 0.4252, 0.7841, 0.9555],
[-0.1795, -0.7452, -0.3822, ..., 0.2929, 0.9957, 0.9606],
[-0.2068, -0.6080, -0.3451, ..., 0.1681, 0.9724, 0.7488]],
[[-0.3532, -0.0907, -0.2980, ..., 0.1295, 0.4900, 0.3955],
[-0.3334, -0.0261, -0.1224, ..., 0.2188, 0.4691, 0.3899],
[-0.2931, 0.0495, -0.2581, ..., 0.2843, 0.5286, 0.3704]]],
grad_fn=<NativeLayerNormBackward>), pooler_output=tensor([[-0.0852, 0.0362, 0.1649, ..., -0.4534, -0.2865, 0.4123],
[ 0.0966, 0.0838, 0.0168, ..., -0.4515, -0.2616, 0.1139]],
grad_fn=<TanhBackward>), hidden_states=None, past_key_values=None, attentions=None, cross_attentions=None)
you will get a dict type of output, and you can output.last_hidden_state to get last hidden state
from spanemo.
I have just updated the model script to handle both old and new versions of Transformers.
Please, test it and let me know if it doesn't work!
from spanemo.
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!
from spanemo.
I'm very curious about why your code can work well, but my code can't. Do you just modify this place? Maybe when I use colab to run code, I don't update the edited file successfully.
Have a good day!
from spanemo.
Glad to heat that it works fine for you now :)
All the best.
from spanemo.
I just modify your code to run SemEval 2014 task4, I use ['food', 'anecdotes', 'service', 'ambience', 'price'] as aspects like emotions, but I can't use encode_plus method like this
I don't know why it split 'anecdotes' to 'an', '##ec', '##dote', and '###s'. I use encode_plus for a long time and I never met this problem.
from spanemo.
After I change anecdotes and ambience to another word, respectively. It works well! I think maybe its vocabulary doesn't have these words.
from spanemo.
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!
from spanemo.
from spanemo.
Related Issues (12)
- Error Runtime HOT 2
- Type error during test HOT 7
- AttributeError: 'NoneType' object has no attribute 'update' HOT 1
- questions on overfitting issue and co-existing emotions percentage calculation HOT 1
- Spanish test accuracy pretty low (> 10%) HOT 1
- discussion on previous issue :) HOT 5
- I want to ask a few questions. HOT 7
- Problem with test.py HOT 1
- Question about evaluation on SemEval2018 HOT 2
- Cannot reproduce results, could you please provide the pretrained weights? HOT 2
- the question of running project with Spanish HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from spanemo.