Medical-Event-Data-Standard / Medical-Event-Data-Standard/MEDS-DEV

CEHRBERT Error

Open
#213 0 comments 0 reactions 1 assignee View on GitHub

@ChaoPang is already working on this.

Since May 30, 2025.

CEHR-BERT priority:medium
Dominant language
Python
Stars
43
Forks
10
PR merge metrics
No merged PRs in 30d

Description

I got this error on a cehrbert model run on MIMIC-IV for elevated creatinine

Predicting: 100%|█████████▉| 1615/1616 [02:08<00:00, 12.52it/s]
Traceback (most recent call last):
  File "/n/data1/hms/dbmi/zaklab/MIMIC-IV/MEDS_DEV_MIMIC/models/cehrbert/.venv/lib/python3.11/site-packages/cehrbert/runners/hf_cehrbert_finetune_runner.py", line 359, in do_predict
    index_dates = [datetime.fromtimestamp(ts) if not np.isnan(ts) else None for ts in timestamps]
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: 'float' object is not iterable

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/n/data1/hms/dbmi/zaklab/MIMIC-IV/MEDS_DEV_MIMIC/models/cehrbert/.venv/lib/python3.11/site-packages/cehrbert/runners/hf_cehrbert_finetune_runner.py", line 407, in <module>
    main()
  File "/n/data1/hms/dbmi/zaklab/MIMIC-IV/MEDS_DEV_MIMIC/models/cehrbert/.venv/lib/python3.11/site-packages/cehrbert/runners/hf_cehrbert_finetune_runner.py", line 314, in main
    do_predict(test_dataloader, model_args, training_args)
  File "/n/data1/hms/dbmi/zaklab/MIMIC-IV/MEDS_DEV_MIMIC/models/cehrbert/.venv/lib/python3.11/site-packages/cehrbert/runners/hf_cehrbert_finetune_runner.py", line 361, in do_predict
    index_dates = [None] * len(timestamps)
                           ^^^^^^^^^^^^^^^
TypeError: object of type 'float' has no len()

Any ideas @ChaoPang

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.