pykeen icon indicating copy to clipboard operation
pykeen copied to clipboard

save_to_directory partially working

Open giuspillo opened this issue 3 years ago • 2 comments

Hi everyone,

i'm having issues with the function save_to_directory. In particular, given the folder i pass as argument, it is able to generate the files

metadata.json
results.json
trained_model.pkl

but does not generate the folder training_triples.

This is the source code (i used nation dataset to test it) I'm currently under Windows with Python 3.9.7

test_path = NATIONS_TEST_PATH

emb_training = TriplesFactory.from_path(
    train_path,
    create_inverse_triples=True,
)

emb_testing = TriplesFactory.from_path(
    test_path,
    entity_to_id=emb_training.entity_to_id,
    relation_to_id=emb_training.relation_to_id,
    create_inverse_triples=True,
)

result = pipeline(
    training=emb_training,
    testing=emb_testing,
    model=emb_model,
    model_kwargs=dict(embedding_dim=emb_dim),
    epochs=emb_epochs, 
)

# save mappings
result.save_to_directory('dest')

giuspillo avatar Oct 26 '22 21:10 giuspillo

Hi @giuspillo ,

would you mind re-opening the ticket with the "bug report" template and fill-in the environment information (e.g., which PyKEEN version)?

mberr avatar Nov 06 '22 11:11 mberr

With the current master branch, I cannot reproduce your observation:

from pykeen.pipeline import pipeline
from pykeen.triples import TriplesFactory
from pykeen.datasets.nations import NATIONS_TEST_PATH, NATIONS_TRAIN_PATH

emb_training = TriplesFactory.from_path(
    NATIONS_TRAIN_PATH,
    create_inverse_triples=True,
)

emb_testing = TriplesFactory.from_path(
    NATIONS_TEST_PATH,
    entity_to_id=emb_training.entity_to_id,
    relation_to_id=emb_training.relation_to_id,
    create_inverse_triples=True,
)

result = pipeline(
    training=emb_training,
    testing=emb_testing,
    model="TransE",
    epochs=0,
)
# save mappings
result.save_to_directory("/tmp/test")
$ ls /tmp/test
metadata.json  results.json  trained_model.pkl  training_triples

mberr avatar Nov 06 '22 11:11 mberr