Jwoo5/ecg-qa

Error in Preprocessing

Closed this issue · 1 comments

When I run the preprocess script, I encounter an error.

Traceback (most recent call last):
File "/data/work/TimeLLM/ecg-qa/preprocess_ecgqa.py", line 198, in
main(args)
File "/data/work/TimeLLM/ecg-qa/preprocess_ecgqa.py", line 109, in main
sample["answer"] = encode_answer(sample_data["answer"], classes)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/data/work/TimeLLM/ecg-qa/preprocess_ecgqa.py", line 150, in encode_answer
idx = [classes[a] for a in answer if a != "none"]
~~~~~~~^^^
KeyError: 'late stage of myocardial infarction'

Replacing "late stage of myocardial infarction" with "old stage of myocardial infarction" in the file "ecgqa/ptbxl/train/110000.json" "ecgqa/ptbxl/valid/20000.json""ecgqa/ptbxl/test/20000.json" resolves the error.

Sorry for the late reply.
It turns out that I've replaced the term "late stage of myocardial infarction" with "old stage of myocardial infarction" in questions but not in answers, which occurs such error. I've re-uploaded the dataset after correcting them.
Thanks for the correction!