swabhs / open-sesame

A frame-semantic parsing system based on a softmax-margin SegRNN.
Apache License 2.0
229 stars 65 forks source link

KeyError on `factorexprs` in `get_loss` #40

Closed free-soellingeraj closed 4 years ago

free-soellingeraj commented 4 years ago

  File "/opt/conda/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/opt/conda/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/ws/nbs/frame-sem-parse/open-sesame/sesame/argid.py", line 924, in <module>
    goldfes=trex.invertedfes)
  File "/ws/nbs/frame-sem-parse/open-sesame/sesame/argid.py", line 813, in identify_fes
    segrnnloss = get_loss(factor_exprs, goldfes, valid_fes, sentlen)
  File "/ws/nbs/frame-sem-parse/open-sesame/sesame/argid.py", line 674, in get_loss
    numeratorexprs = [factorexprs[gf] for gf in goldfactors]
  File "/ws/nbs/frame-sem-parse/open-sesame/sesame/argid.py", line 674, in <listcomp>
    numeratorexprs = [factorexprs[gf] for gf in goldfactors]
KeyError: <sesame.housekeeping.Factor object at 0x7f320dac0f98>```

Are the keys of `factorexprs` supposed to be `sesame.housekeeping.Factor` objects?
Any idea what is going on here?  The line right above 
`numeratorexprs = [factorexprs[gf] for gf in goldfactors]`
is where the Factor objects are instantiated:
`goldfactors = [Factor(span[0], span[1], feid) for feid in gold_fes for span in gold_fes[feid]]`
free-soellingeraj commented 4 years ago

This error occurred because numbreaks = math.ceil(spanlen / maxspanlen) does not work in the sesame.housekeeping.