Giter VIP home page Giter VIP logo

Comments (3)

Theheavens avatar Theheavens commented on May 28, 2024

In a way, it's a bug. self.hidden_dim = self.h_dim * self.num_heads.
Maybe we should remove one of the parameters to fix the bug.
Or we move the code L232 after the best configuration setting.
In the beginning, I just want to solve the integer division problem (hidden_dim / num_heads).
Or you get other solutions?

from openhgnn.

LspongebobJH avatar LspongebobJH commented on May 28, 2024

I think we should not remove one of the parameters. I'm not sure how these two work for other models. But self.h_dim and self.hidden_dim actually mean different but important things in MAGNN. The former represents the hidden dimension in each head while the latter represents the sum of hidden dimension across all heads. And I see these two parameters in other models' config as well (probably those with attention mechanism). Removing them might affect a lot to some models.

Probably it'd better if we could try to differentiate the sources from which we read config arguments instead of using best config to replace original one. For example, we should read args from best_config.py when setting --use_best_config and from config.ini otherwise.

I'm not sure if it's important to give hidden_dim a clear definition, the hidden dimension in each head or the sum of hidden dimension across all heads, in multi-head attention mechanism. If we want to remove one of them, we should figure this definition out and revise model codes that confused this concept or utilized both h_dim and hidden_dim. But the method mentioned above might be more convenient at the moment.

from openhgnn.

dddg617 avatar dddg617 commented on May 28, 2024

I think we do not need to specify three parameters, instead, we need only two of them, as self.hidden_dim = self.h_dim * self.num_heads. Given two of them and the third one is determined. Considering this system, I think we only need self.hidden_dim and self.num_heads, as in module preprocess, we need args.hidden_dim, so this parameter is necessary. Then in the model, we just need to replace self.h_dim with self.hidden_dim // self.num_heads. This method we need to check if self.hidden_dim can self.num_heads

We may rename self.h_dim to self.head_size like the definition in dgl.gatconv. The head_size means the hidden dimension in each head. The hidden_dim means the output dimension of each hidden layer.

We can keep the two parameters in config.ini and best_config.py. When we use best_config and change it, it will not affect other parameters.

from openhgnn.

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.