Skip to content

How can I solve the Keyerror ? #2

@JimmyHO9057

Description

@JimmyHO9057

Traceback (most recent call last):
File "D:\python-numpy\DL1-1\MathOCR-master\src\utilss\latexlang.py", line 23, in getitem
retval = self.idx_token[item]
KeyError: 'START'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "D:\python-numpy\DL1-1\MathOCR-master\src\models\train.py", line 91, in
main()
File "D:\python-numpy\DL1-1\MathOCR-master\src\models\train.py", line 66, in main
dtrain, dtest, dvalid = build_im2latex(formulas_path,
File "D:\python-numpy\DL1-1\MathOCR-master\src\data\dataset.py", line 32, in build_im2latex
encoded_formulas = [tokenizer.encode(t, vocabulary) for t in tokenized_formulas]
File "D:\python-numpy\DL1-1\MathOCR-master\src\data\dataset.py", line 32, in
encoded_formulas = [tokenizer.encode(t, vocabulary) for t in tokenized_formulas]
File "D:\python-numpy\DL1-1\MathOCR-master\src\utilss\latexlang.py", line 64, in encode
return [vocabulary['START']] + [vocabulary[t] for t in sequence] + [vocabulary['END']]
File "D:\python-numpy\DL1-1\MathOCR-master\src\utilss\latexlang.py", line 30, in getitem
retval = self.idx_token['UNK']
KeyError: 'UNK'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions