Comments (3)
Hello, thanks for your patient and detailed explanation, I will read code again with the help of this explanation.
from behavior-sequence-transformer-pytorch.
Hi! Thanks for the question, let me try answer it
Is exactly just returning the weight of the positional embedding, weight is the actual value of the embeddings.
Since we are using a fixed sequence length and we are creating positional embeddings for positions==max_len we will want the full weight of the positional embedding table.
So for max_len=10 the positional embedding table will have 10 entries right?? We want to access those 10 entries and sum the value of those entries to the already existing sequence items (we are doing sum of positional embedding here, not concat)
from behavior-sequence-transformer-pytorch.
def forward(self, batch):
transfomer_features, user_features, target_movie_rating = self.encode_input(batch)
transfomer_features = self.positional_embedding(transfomer_features)
transformer_output = self.transfomerlayer(transfomer_features)
transformer_output = torch.flatten(transformer_output,start_dim=1)
According to the above function, you only input the positional encoding to the transformer layer. Because the output from self.positional_embedding is actually an embedding lookup. I think you need an extra step to add transfomer_features, with positional encodings before sending it through the transformer layer.
from behavior-sequence-transformer-pytorch.
Related Issues (8)
- How can we use same code or architecture to movie recommendation instead of predicting ratings HOT 2
- 【QUES】Padding ??? HOT 2
- test_step
- What to use an extra embedding for self.embeddings_user_id and the self.embeddings_movie_id HOT 10
- would be nice to add an input mask, so we can use arbitrary length input during the training.
- [sequence question] How should I run this code if I set the sequence_length to 4?
- How did you decide on nn.linear(661, 1024)? 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 behavior-sequence-transformer-pytorch.