incrementaled's People
incrementaled's Issues
Loss function in train.py
Thank you for the great job!
During studying the source code, I found something difficult for me to understand.
First
The loss function in 'train.py' is nn.CrossEntropyLoss().
logits, _ = self.model(train_X, train_mask)
p = logits[:, :, :self.seen_cls+1]
loss = criterion(p.view(-1, self.seen_cls+1), train_Y.view(-1))
The variable 'p' is the first self.seen_cls+1 colums of each matrix in logits tensor, but we usually utilize the index of max value in logits as the prediction result. Could you please tell me why do you choose the self.seen_cls+1 rows as input? And the shape of input is [batch_size * max_length, self.seen_cls+1], which is different with the shape of target 'train_Y.view(-1)'.
Second
outputs = self.bert(data_x, attention_mask = mask_x)
bert_enc = outputs[0]
logits = self.fc(bert_enc)
return logits, outputs[0]
The shape of the variable 'bert_enc' is [batch_size, max_length, hidden_size], and the shape of 'logits' is [batch_size, max_length, y_num]. Do you want to get the pooled result of bert encoder and the corresponding predictions?
Data format
Thanks for your great work! However, I wonder whether you could give some explanations about the data format in your codes? To exemplify this, what does the 7
mean in the following sample?
The same official said the IMF also insists that the good sections of the two banks be merged . 7 contact
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.