Forschungsprojekt-Informatik / CompGCN

ICLR 2020: Composition-Based Multi-Relational Graph Convolutional Networks
Apache License 2.0
0 stars 0 forks source link

Allow to disable the GNN Encoder with a specific parameter #8

Closed 1Maxnet1 closed 1 year ago

1Maxnet1 commented 1 year ago

This PR introduces another parameter which allows to disable the GNN encoder.

@vinhsuhi Could you have a quick look whether I got your comments right and else comment on what I changed in the wrong? Thanks in regard.

1Maxnet1 commented 1 year ago

@RaphaW @JWG-1 I incorporated all the feedback, and the parameter itself works now. However the training does fail. I will further investigate and report back. If you find some time, you can give it a try as well.

1Maxnet1 commented 1 year ago

Okay I double checked the issue and when I try running conKB function, it fails:

python run.py -score_func convkb -init_dim 100 -num_filt 3 -opn sub -disable_gnn_encoder DISABLE_GNN_ENCODER

However running it with transE does work:

python run.py -score_func transe -opn sub -gamma 9 -hid_drop 0.1 -init_dim 200 -disable_gnn_encoder DISABLE_GNN_ENCODER
JWG-1 commented 1 year ago
python run.py -score_func convkb -init_dim 100 -num_filt 3 -opn sub -disable_gnn_encoder DISABLE_GNN_ENCODER

This should fix it:

python run.py -score_func convkb -init_dim 100 -embed_dim 100 -num_filt 3 -opn sub -disable_gnn_encoder DISABLE_GNN_ENCODER
1Maxnet1 commented 1 year ago

Thank you for adding that, but sadly it does not really work for me yet. If I add the argument 'false' to the gnn encoder, the box still says that the parameter is true.

I also do not know how to check whether the run used the gnn encoder or not Other than checking the box in which it says 'true' or 'false'.

Should be fixed in the meantime, could you give it another try?

JWG-1 commented 1 year ago

Also, when training with the scoring function convE, i get the following error:

Traceback (most recent call last):
  File "C:\Daten\Hochschule\Wintersemester 22-23\Forschungsarbeit\CompGCN\run.py", line 461, in <module>
    model.fit()
  File "C:\Daten\Hochschule\Wintersemester 22-23\Forschungsarbeit\CompGCN\run.py", line 386, in fit
    train_loss  = self.run_epoch(epoch, val_mrr)
  File "C:\Daten\Hochschule\Wintersemester 22-23\Forschungsarbeit\CompGCN\run.py", line 352, in run_epoch
    pred        = self.model.forward(sub, rel)
  File "C:\Daten\Hochschule\Wintersemester 22-23\Forschungsarbeit\CompGCN\model\models.py", line 149, in forward
    x = torch.mm(x, all_ent.transpose(1,0))
RuntimeError: mat1 and mat2 shapes cannot be multiplied (64x200 and 100x2034)

can you send the call parameters? I belive the problem is coming from defining the embed_dim, because for conve the embed_dim is calculated in the script run.py, so we should leave it empty when setting our parameters

EhrenbruderRoschtbraten commented 1 year ago

Also, when training with the scoring function convE, i get the following error:

Traceback (most recent call last):
  File "C:\Daten\Hochschule\Wintersemester 22-23\Forschungsarbeit\CompGCN\run.py", line 461, in <module>
    model.fit()
  File "C:\Daten\Hochschule\Wintersemester 22-23\Forschungsarbeit\CompGCN\run.py", line 386, in fit
    train_loss  = self.run_epoch(epoch, val_mrr)
  File "C:\Daten\Hochschule\Wintersemester 22-23\Forschungsarbeit\CompGCN\run.py", line 352, in run_epoch
    pred        = self.model.forward(sub, rel)
  File "C:\Daten\Hochschule\Wintersemester 22-23\Forschungsarbeit\CompGCN\model\models.py", line 149, in forward
    x = torch.mm(x, all_ent.transpose(1,0))
RuntimeError: mat1 and mat2 shapes cannot be multiplied (64x200 and 100x2034)

can you send the call parameters? I belive the problem is coming from defining the embed_dim, because for conve the embed_dim is calculated in the script run.py, so we should leave it empty when setting our parameters

Yeah of course, so i left the embed_dim empty, but it doesn't work for example for the following command:

python run.py -score_func conve -opn sub -ker_sz 5 -data codex-s -disable_gnn_encoder DISABLE_GNN_ENCODER
JWG-1 commented 1 year ago
python run.py -score_func conve -opn sub -ker_sz 5 -data codex_s  -k_w 10 -k_h 10 -gcn_dim 100 -disable_gnn_encoder 1

it should work like this

EhrenbruderRoschtbraten commented 1 year ago
python run.py -score_func conve -opn sub -ker_sz 5 -data codex_s  -k_w 10 -k_h 10 -gcn_dim 100 -disable_gnn_encoder 1

it should work like this

Yeah, it works now, thanks

1Maxnet1 commented 1 year ago
python run.py -score_func conve -opn sub -ker_sz 5 -data codex-s  -k_w 10 -k_h 10 -gcn_dim 100 -disable_gnn_encoder 1

I added this command to the Readme.md to have an example how to use the new parameter there. Thanks for the review. Will merge, due to 2 approvals