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

Cannot provide custom entity_representations_kwargs or relation_representations_kwargs via model_kwargs to pipeline #1441

Open
3 tasks done
mberr opened this issue Sep 7, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@mberr
Copy link
Member

mberr commented Sep 7, 2024

Describe the bug

When providing custom entity_representations_kwargs (or relation_representations_kwargs) via model_kwargs to pykeen.pipeline.pipeline, a TypeError occurs

Traceback (most recent call last):
  File "/home/max/code/pykeen/scratch/tmp.py", line 4, in <module>
    result = pipeline(
  File "/home/max/code/pykeen/src/pykeen/pipeline/api.py", line 1503, in pipeline
    model_instance = _handle_model(
  File "/home/max/code/pykeen/src/pykeen/pipeline/api.py", line 970, in _handle_model
    model_instance, model_kwargs = _build_model_helper(
  File "/home/max/code/pykeen/src/pykeen/pipeline/api.py", line 837, in _build_model_helper
    model_resolver.make(
  File "/home/max/code/pykeen/venv/lib/python3.10/site-packages/class_resolver/api.py", line 210, in make
    raise e
  File "/home/max/code/pykeen/venv/lib/python3.10/site-packages/class_resolver/api.py", line 204, in make
    return cls(**(pos_kwargs or {}), **kwargs)  # type: ignore
  File "/home/max/code/pykeen/src/pykeen/models/unimodal/trans_e.py", line 87, in __init__
    super().__init__(
TypeError: pykeen.models.nbase.ERModel.__init__() got multiple values for keyword argument 'entity_representations_kwargs'

How to reproduce

from pykeen.pipeline import pipeline

result = pipeline(
    dataset="nations",
    model="TransE",
    model_kwargs=dict(entity_representations_kwargs=dict()),
)

Environment

Key Value
OS posix
Platform Linux
Release 5.15.153.1-microsoft-standard-WSL2
Time Sat Sep 7 13:43:19 2024
Python 3.10.6
PyKEEN 1.10.3-dev
PyKEEN Hash 3f4c870
PyKEEN Branch master
PyTorch 2.3.1+cu121
CUDA Available? true
CUDA Version 12.1
cuDNN Version 8902

Additional information

The reason is that some models (e.g., TransE) add their own entity_representations_kwargs.

While I would generally advocate using the new style interaction + entity_representations (+...) whenever you want to have custom representations, many users may not be aware of this and face problems when trying to use it.

Issue Template Checks

  • This is not a feature request (use a different issue template if it is)
  • This is not a question (use the discussions forum instead)
  • I've read the text explaining why including environment information is important and understand if I omit this information that my issue will be dismissed
@mberr mberr added the bug Something isn't working label Sep 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant