dair-iitd / openie6

OpenIE6 system
GNU General Public License v3.0
121 stars 38 forks source link

crash with curr_line_num referenced before assignment #15

Closed sreiling closed 2 years ago

sreiling commented 2 years ago

run.py crashed on me with the following exception:

Traceback (most recent call last):
  File "run.py", line 469, in <module>
    main(hyperparams)
  File "run.py", line 459, in main
    train_dataloader, val_dataloader, test_dataloader, all_sentences)
  File "run.py", line 245, in splitpredict
    if curr_line_num not in no_extractions:
UnboundLocalError: local variable 'curr_line_num' referenced before assignment

Looking at the code, it looks like curr_line_num is only initialized when the for loop is executed at least once, which seems not to be true in my example.

SaiKeshav commented 2 years ago

Thanks for raising the issue. It seems to fail when the first sentence has no extractions. I have pushed a commit where the initialization is correctly done before the for loop.