txsun1997 / CoLAKE

COLING'2020: CoLAKE: Contextualized Language and Knowledge Embedding
https://aclanthology.org/2020.coling-main.327/
MIT License
114 stars 17 forks source link

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

Closed calebjacksonhoward closed 3 years ago

calebjacksonhoward commented 3 years ago

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.

txsun1997 commented 3 years ago

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.

calebjacksonhoward commented 3 years ago

Thank you for the clarification!