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
TypeError: missing required positional argument when using CoreTriplesFactory.from_path_binary()
#1182
Comments
@uier this seems to be resolved in #1185 now - if you already want to try it out, you can install PyKEEN from the given branch (cf. here): pip install https://github.com/pykeen/pykeen/archive/fix-from-path-binary.zip Note that after #1185 has been merged, you would need to update to pip install git+https://github.com/pykeen/pykeen.git (as explained in the repo's README). |
Hi @mberr Thanks for fixing the bug and providing a patch. I tested it and it works for me too. Thanks for your hard work! |
@mberr Traceback (most recent call last):
File "/home/bio/groupshare/kshalaby/drug_repurposing/pykeen/NP_RotatE/NP_RotatE_Prediction_wwl_ns.py", line 60, in <module>
pred = predict_target(
^^^^^^^^^^^^^^^
File "/home/bio/groupshare/kshalaby/drep/lib/python3.11/site-packages/torch/utils/_contextlib.py", line 115, in decorate_context
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/home/bio/groupshare/kshalaby/drep/lib/python3.11/site-packages/pykeen/predict.py", line 1077, in predict_target
target, batch, other_col_ids = _get_input_batch(factory=triples_factory, head=head, relation=relation, tail=tail)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/bio/groupshare/kshalaby/drep/lib/python3.11/site-packages/pykeen/predict.py", line 563, in _get_input_batch
head = factory.entity_to_id[head]
^^^^^^^^^^^^^^^^^^^^
AttributeError: 'CoreTriplesFactory' object has no attribute 'entity_to_id'. Did you mean: 'entities_to_ids'? my code: tf = CoreTriplesFactory.from_path_binary(
"./NP_RotatE_model_results_wwl_ns/training_triples"
)
my_model = torch.load("./NP_RotatE_model_results_wwl_ns/trained_model.pkl")
pred = predict_target(
model=my_model, head=str(head), tail=str(tail), triples_factory=tf
) |
@Karimsaber1 , would you mind sharing on which PyKEEN version your code runs (and with which version you wrote the training factory into a file)? You can get this via python -m pykeen version |
Describe the bug
According to the document about saving pipeline result to directory, it said:
But error occurred when I want to load the
triplets_factory
from the pipeline result saved before.Seems like the data return by
cls._from_path_binary
does not containnum_entities
andnum_relations
at line 816.pykeen/src/pykeen/triples/triples_factory.py
Lines 793 to 824 in 313055e
How to reproduce
The following code can reproduce the problem on my machine
Environment
Unable to handle parameter in CooccurrenceFilteredModel: base
Additional information
Thank you for providing this open source project. Your work is very helpful to me. 😄
Issue Template Checks
The text was updated successfully, but these errors were encountered: