Using File-Based Tracking
Rather than logging to an external backend like MLflow or W&B, file based trackers write to local files.
Minimal Pipeline Example with CSV
A CSV log file can be generated with the following:
from pykeen.pipeline import pipeline pipeline_result = pipeline( model='RotatE', dataset='Kinships', result_tracker='csv', )
It is placed in a subdirectory of
pystow default data directory with PyKEEN called
which will likely be at
~/.data/pykeen/logs/ on your system. The file is named based on the
Specifying a Name
If you want to specify the name of the log file in the default directory, use the
from pykeen.pipeline import pipeline pipeline_result = pipeline( model='RotatE', dataset='Kinships', result_tracker='csv', result_tracker_kwargs=dict( name='test.csv', ), )
Additional keyword arguments are passed through to the
csv.writer(). This can include
If you specify the file name, it will overwrite the previous log file there.
path argument can be used instead of the
name to specify an absolute path to the
log file rather than using the PyStow directory.
If you know the name of a file, you can monitor it with
tail and the
$ tail -f ~/data/pykeen/logs/test.csv | grep "hits_at_10"
Pipeline Example with JSON
The JSON writer creates a JSONL file on which each line is a valid JSON object.
Similarly to the CSV writer, the
name argument can be omitted to create a time-based
file name or given to pick the default name. The
path argument can still be used to specify
an absolute path.
from pykeen.pipeline import pipeline pipeline_result = pipeline( model='RotatE', dataset='Kinships', result_tracker='json', result_tracker_kwargs=dict( name='test.json', ), )
The same concepts can be applied in the HPO pipeline as in the previous tracker tutorials.
Additional documentation of the valid keyword arguments can be found