Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix loading of pretrained reciprocal relations model #191

Merged
merged 4 commits into from
Mar 18, 2021

Conversation

AdrianKs
Copy link
Collaborator

@AdrianKs AdrianKs commented Mar 8, 2021

fix for #190

can not override the method _intersect_ids_with_pretrained_embedder in reciprocal_relations_model.py since the base model is created before the reciprocal relations model

@rgemulla
Copy link
Member

rgemulla commented Mar 9, 2021

Why is this needed? Model-specific code in a generic method is problematic from a maintainance point of view. Isn't there a clean solution (e.g., a "load embeddings" method in KgeEmbedder)?

@AdrianKs
Copy link
Collaborator Author

AdrianKs commented Mar 9, 2021

with a "load embeddings" function in KgeEmbedder we still could not achieve a model specific initialization.

The main problem is that we would need to override the intersect_ids method inside the reciprocal relations model. But when we initialize the reciprocal relations model we first create a base model which already initializes the embedders with the method of the base model.
I am not sure how to solve this in a nice way. The design of the reciprocal relations model makes this hard.

@AdrianKs
Copy link
Collaborator Author

AdrianKs commented Mar 9, 2021

one could make the method _intersect_ids_with_pretrained_embedder static and exchange the method in the init method of the reciprocal relations model
But this would also not be nice.

@rgemulla
Copy link
Member

rgemulla commented Mar 9, 2021

The "right" way would be to fix the dataset or not? I.e., improve the alt_dataset in ReciprocalRelationsModel to correctly report the inverse relations with relation_ids by adding these relations with some suffix (e.g., _reciprocal).

@AdrianKs
Copy link
Collaborator Author

You are right. I adapted the relation ids in the alt_dataset.

@rgemulla
Copy link
Member

Looks good (and simple)!

@AdrianKs AdrianKs merged commit d063477 into master Mar 18, 2021
@AdrianKs AdrianKs deleted the fix_pretrain_reciprocal branch March 18, 2021 08:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants