matejklemen / slovene-coreference-resolution

MIT License
5 stars 5 forks source link

TypeError in utils.get_clusters() function #1

Closed mcebular closed 4 years ago

mcebular commented 4 years ago

Under some rare circumstances which need to be investigated, the following error happens:

Traceback (most recent call last):
  File "D:/PythonProjects/nlp-coreference-resolution/src/baseline.py", line 696, in <module>
    baseline.evaluate(test_docs)
  File "D:/PythonProjects/nlp-coreference-resolution/src/baseline.py", line 476, in evaluate
    test_clusters = get_clusters(test_preds)
  File "D:\PythonProjects\nlp-coreference-resolution\src\utils.py", line 36, in get_clusters
    for id_cluster, cluster_starter in enumerate(preds[None]):
TypeError: list indices must be integers or slices, not NoneType

Error can be reproduced with the following parameters:

NUM_FEATURES:  14
NUM_EPOCHS:    100
LEARNING_RATE: 0.005
RANDOM_SEED:   3696759207

with code at commit https://github.com/matejklemen/slovene-coreference-resolution/commit/8919e9cdc180cf874e44441226e89d71e558184d

mcebular commented 4 years ago

Found the culprit in _train_doc() function, early return statement was returning a list [] instead of a dictionary {}. Fixed in https://github.com/matejklemen/slovene-coreference-resolution/commit/14a86c4692a68967555a26e4bc5caf262a11769f