Coder Social home page Coder Social logo

hello about gopt HOT 3 CLOSED

cageyoko avatar cageyoko commented on August 17, 2024
hello

from gopt.

Comments (3)

YuanGongND avatar YuanGongND commented on August 17, 2024

Hi there,

First, I want to remind that GOPTNoPhn is way worse than GOPT, and should only be used for analysis purpose.

Second, in this script, we hardcoded the sequence length as 50, that's why the positional embedding has shape [1,55,41] (50 + 5 CLS tokens = 55). You should either 1) change your input sequence length to 50, something like below:

# embed_dim is the width of the transformer, we suggest to set it as feat_dim, 41 is a quite weird value to me
a = GOPT(embed_dim=41, num_heads=4, depth=2)
# [batch_size, seq_len, feat_dim]
data = torch.randn(2, 50, 84)
# [batch_size, seq_len]
phn = torch.randint(40, (2, 50))
a(data, phn)

or 2) modify the GOPT model sequence length to be your sequence length + 5 (i.e., in your example, if your sequence length is 4, than you should set positional embedding length of 4+5=9).

self.pos_embed = nn.Parameter(torch.zeros(1, 55, self.embed_dim))

Hope this help.

-Yuan

from gopt.

YuanGongND avatar YuanGongND commented on August 17, 2024

Also, if you do have access to Google Colab, I'd suggest starting from our colab example at https://colab.research.google.com/github/YuanGongND/gopt/blob/master/colab/GOPT_GPU.ipynb

from gopt.

cageyoko avatar cageyoko commented on August 17, 2024

Ok, I got it! thanks for your help, now I can run it.

from gopt.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.