-
-
Notifications
You must be signed in to change notification settings - Fork 192
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 ERMLP functional form #444
Conversation
Can you encode the failing functionality in a test? |
The error in the implementation was that In For new-style interaction functions, we only test the I can try to come up with a test, but right now I just stumbled across this error and pushed my local fix here without having time for a deeper investigation of the root cause. |
A smaller snippet for reproducing the error without any training: from pykeen.models.resolve import make_model_cls
from pykeen.triples.generation import generate_triples_factory
triples_factory = generate_triples_factory()
model_cls = make_model_cls(
interaction="ermlp",
dimensions=dict(d=3),
interaction_kwargs=dict(
embedding_dim=3,
hidden_dim=5,
),
)
model = model_cls(triples_factory=triples_factory)
model.predict_t(triples_factory.mapped_triples[:1, :-1]) |
An even smaller one import torch
from pykeen.nn.modules import ERMLPInteraction
num = 5
dim = 3
batch_size = 1
interaction = ERMLPInteraction(embedding_dim=dim, hidden_dim=1)
interaction.score_t(h=torch.rand(batch_size, dim), r=torch.rand(batch_size, dim), all_entities=torch.rand(num, dim)) |
This is strange, since we have pykeen/tests/test_nn/test_modules.py Line 106 in 9b7adc6
and Lines 445 to 453 in 9b7adc6
which essentially should do the same. |
batch_size=1 seems to be what causes the problem. |
…fix-ermlp-functional-form
@mberr yes let’s implement this check for all models/score_* |
Trigger CI
@cthoyt there seems to be a new version of mypy, since there are now some mypy errors in non-modified code parts, cf. https://github.com/pykeen/pykeen/pull/444/checks?check_run_id=2793677666#step:9:12 |
This is now necessary as of mypy 0.900
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fine for me. Squash+merge when ready
🦜 💃 ⏩ |
This PR fixes an issue with the ER-MLP functional form.
I encountered the issue trying to run inference on a single element batch