txsun1997/CoLAKE

run_pretrain.py: line 94: TypeError: TypeError: get_ent_freq() missing 1 required positional argument: 'path'

Closed this issue · 2 comments

The declaration of get_ent_freq() in pretrain/utils.py:

def get_ent_freq(path):
    with open(path, 'rb') as fin:
        ent_freq = pickle.load(fin)
    print('# of entities: {}'.format(len(ent_freq)))
    return ent_freq

requires a path parameter be passed,
but line 94 of pretrain/run_pretrain.py:

ent_freq = get_ent_freq()

does not pass a path. So I am getting an error:

TypeError: get_ent_freq() missing 1 required positional argument: 'path'

What file should I pass to get_ent_freq() to avoid this error?

[edit]
It seems like the author may not see this call fail due to a cached result locally, perhaps; looking at the decorator:

@cache_results(_cache_fp='ent_freq.bin', _refresh=False)

which decorates get_ent_freq()

Thanks for any clues.

Thanks for reporting this bug. True, I didn't see this because of the cached file...
The path should be a pickle file that saves a python dictionary as such: {entity: frequence}, which is used to perform negative entity sampling.
And a similar issue may be found when loading entity and relation vocabularies.

Thank you for the clarification!