Giter Site home page Giter Site logo

Comments (8)

AjibolaPy avatar AjibolaPy commented on July 20, 2024

That's also my confusion. I guess instead of using random values, the embedding weights was used and reshaped. Maybe it's the same. But is it trainable?. I'll appreciate an answer if you've gotten the answer

from detr.

Zhong-Zi-Zeng avatar Zhong-Zi-Zeng commented on July 20, 2024

I have implemented DETR and found that embedding weights is more convenient than random values when building a model.

from detr.

AjibolaPy avatar AjibolaPy commented on July 20, 2024

I have implemented DETR and found that embedding weights is more convenient than random values when building a model.

Thanks for helping.
Assuming:

embedding=nn.Embedding(45, 2)


weights=embedding.weight.unsqueeze(1).repeat(1,3)

Did you keep the weights requires_grad=True. This is just my confusion

from detr.

Zhong-Zi-Zeng avatar Zhong-Zi-Zeng commented on July 20, 2024

Yes, so that the gradient of embedding weight will have the same value.

from detr.

AjibolaPy avatar AjibolaPy commented on July 20, 2024

Yes, so that the gradient of embedding weight will have the same value.

Thanks for your answer.
I should keep requires_grad set to 'True.' That means it will also be trained during backpropagation, and the value will change. This applies to the embedding weights, specifically the query embedding.

from detr.

AjibolaPy avatar AjibolaPy commented on July 20, 2024

Yes, so that the gradient of embedding weight will have the same value.

I think it's in (num_queries, batch_size, dim) and not (batch_size, num_queries, dim)

from detr.

Zhong-Zi-Zeng avatar Zhong-Zi-Zeng commented on July 20, 2024

You are right!

from detr.

MLDeS avatar MLDeS commented on July 20, 2024

I have implemented DETR and found that embedding weights is more convenient than random values when building a model.

@Zhong-Zi-Zeng What do you mean with more convenient? Is it that the results are better? Because, as shown in the DETR colab notebook, if you use, nn.Parameter(torch.rand(100, hidden_dim)) as the queries with 100 being the num_queries and update all parameters of the model, it should still work because the nn.parameter has requires_grad=True by default, so it will still update the parameters, right? It will not be random values thereafter.

from detr.

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.