YerevaNN / mimic3-benchmarks

Python suite to construct benchmark machine learning datasets from the MIMIC-III 💊 clinical database.
https://arxiv.org/abs/1703.07771
MIT License
805 stars 329 forks source link

ValueError: Could not interpret optimizer identifier: 0.9 #109

Closed xiuwei1026 closed 1 year ago

xiuwei1026 commented 3 years ago

When I run below command, got a error message. Any idea to fix it? Thanks. python -um mimic3models.length_of_stay.main --network mimic3models/keras_models/lstm.py --dim 64 --timestep 1.0 --depth 1 --dropout 0.3 --mode train --batch_size 8 --partition custom --output_dir mimic3models/length_of_stay

==> model.final_name: k_lstm.n64.d0.3.dep1.bs8.ts1.0.partition=custom
==> compiling the model
Traceback (most recent call last):
  File "C:\Users\xwei\Anaconda3\lib\runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Users\xwei\Anaconda3\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\XP\Projects\mimic\mimic3-benchmarks\mimic3models\length_of_stay\main.py", line 104, in <module>
    model.compile(optimizer=optimizer_config,
  File "C:\Users\xwei\AppData\Roaming\Python\Python38\site-packages\tensorflow\python\keras\engine\training.py", line 537, in compile
    self.optimizer = self._get_optimizer(optimizer)
  File "C:\Users\xwei\AppData\Roaming\Python\Python38\site-packages\tensorflow\python\keras\engine\training.py", line 574, in _get_optimizer
    return nest.map_structure(_get_single_optimizer, optimizer)
  File "C:\Users\xwei\AppData\Roaming\Python\Python38\site-packages\tensorflow\python\util\nest.py", line 659, in map_structure
    structure[0], [func(*x) for x in entries],
  File "C:\Users\xwei\AppData\Roaming\Python\Python38\site-packages\tensorflow\python\util\nest.py", line 659, in <listcomp>
    structure[0], [func(*x) for x in entries],
  File "C:\Users\xwei\AppData\Roaming\Python\Python38\site-packages\tensorflow\python\keras\engine\training.py", line 565, in _get_single_optimizer
    opt = optimizers.get(opt)
  File "C:\Users\xwei\AppData\Roaming\Python\Python38\site-packages\tensorflow\python\keras\optimizers.py", line 120, in get
    raise ValueError(
ValueError: Could not interpret optimizer identifier: 0.9
strayMat commented 3 years ago

It seems like a tensorflow version issue.

Same problem here with :

tensorflow-2.2.0 (defaults/linux-64)
tensorflow-base-2.2.0 (defaults/linux-64)
tensorflow-estimator-2.2.0 (defaults/noarch)
tensorflow-gpu-2.2.0 (defaults/linux-64)
keras-2.4.3 (defaults/noarch)
keras-base-2.4.3 (defaults/noarch)

I did not have the issue with tensorflow-1.1.10. Neither did I with tensorflow-gpu==1.15 .

Ownspirit commented 2 years ago

you need download 2.1.2 version keras

ogegulec commented 1 year ago

I had the same issue I used Keras version 2.1.2 tensorflow version 1.15.0 and python 3.7.11. This solved the issue.

hrayrhar commented 1 year ago

Thanks for raising the issue. As @ogegulec said, this is because of using newer versions of Keras. I have updated the requirements.txt and added installation notes to the README. Following those instructions should resolve this.