TypeError - Keras related?

68 views
Skip to first unread message

Rangana Warshamanage

unread,
Mar 19, 2024, 7:01:14 PM3/19/24
to IsoNet
Hi All

I have just started to use Isonet but now have an issue in the refinement.

The command I used is 
isonet.py refine subtomo.star --gpuID 0 --result_dir results

This started the refinement but hit on the following error:

(isonet_env) bash-4.4$ isonet.py refine subtomo.star --gpuID 0 --result_dir results
03-19 22:40:39, INFO    
######Isonet starts refining######

03-19 22:40:44, INFO     Start Iteration1!
03-19 22:40:44, WARNING  The results folder already exists  
 The old results folder will be renamed (to results~)
/lmb/home/ranganaw/opt/anaconda3/envs/isonet_env/lib/python3.9/site-packages/keras/src/layers/activations/leaky_relu.py:41: UserWarning: Argument `alpha` is deprecated. Use `negative_slope` instead.
  warnings.warn(
03-19 22:40:46, WARNING  You are saving your model as an HDF5 file via `model.save()` or `keras.saving.save_model(model)`. This file format is considered legacy. We recommend using instead the native Keras format, e.g. `model.save('my_model.keras')` or `keras.saving.save_model(model, 'my_model.keras')`.
03-19 22:40:54, INFO     Noise Level:0.0
03-19 22:48:15, INFO     Done preparing subtomograms!
03-19 22:48:15, INFO     Start training!
03-19 22:48:18, ERROR    Traceback (most recent call last):
  File "/lmb/home/ranganaw/SW/IsoNet/bin/refine.py", line 128, in run
    history = train_data(args) #train based on init model and save new one as model_iter{num_iter}.h5
  File "/lmb/home/ranganaw/SW/IsoNet/models/unet/train.py", line 93, in train_data
    history = train3D_continue('{}/model_iter{:0>2d}.h5'.format(settings.result_dir,settings.iter_count),
  File "/lmb/home/ranganaw/SW/IsoNet/models/unet/train.py", line 38, in train3D_continue
    model = load_model( model_file)
  File "/lmb/home/ranganaw/opt/anaconda3/envs/isonet_env/lib/python3.9/site-packages/keras/src/saving/saving_api.py", line 183, in load_model
    return legacy_h5_format.load_model_from_hdf5(filepath)
  File "/lmb/home/ranganaw/opt/anaconda3/envs/isonet_env/lib/python3.9/site-packages/keras/src/legacy/saving/legacy_h5_format.py", line 155, in load_model_from_hdf5
    **saving_utils.compile_args_from_training_config(
  File "/lmb/home/ranganaw/opt/anaconda3/envs/isonet_env/lib/python3.9/site-packages/keras/src/legacy/saving/saving_utils.py", line 143, in compile_args_from_training_config
    loss = _deserialize_nested_config(losses.deserialize, loss_config)
  File "/lmb/home/ranganaw/opt/anaconda3/envs/isonet_env/lib/python3.9/site-packages/keras/src/legacy/saving/saving_utils.py", line 202, in _deserialize_nested_config
    return deserialize_fn(config)
  File "/lmb/home/ranganaw/opt/anaconda3/envs/isonet_env/lib/python3.9/site-packages/keras/src/losses/__init__.py", line 124, in deserialize
    return serialization_lib.deserialize_keras_object(
  File "/lmb/home/ranganaw/opt/anaconda3/envs/isonet_env/lib/python3.9/site-packages/keras/src/saving/serialization_lib.py", line 570, in deserialize_keras_object
    return deserialize_keras_object(
  File "/lmb/home/ranganaw/opt/anaconda3/envs/isonet_env/lib/python3.9/site-packages/keras/src/saving/serialization_lib.py", line 671, in deserialize_keras_object
    return _retrieve_class_or_fn(
  File "/lmb/home/ranganaw/opt/anaconda3/envs/isonet_env/lib/python3.9/site-packages/keras/src/saving/serialization_lib.py", line 805, in _retrieve_class_or_fn
    raise TypeError(
TypeError: Could not locate function 'mae'. Make sure custom classes are decorated with `@keras.saving.register_keras_serializable()`. Full object config: {'module': 'keras.metrics', 'class_name': 'function', 'config': 'mae', 'registered_name': 'mae'}

I have Tensorflow-2.16.1 with CUDA/12.1

Any idea what's cuasing this error?

Thanks for your advices.

Best,
Rangana

YUNTAO LIU

unread,
Mar 19, 2024, 7:31:37 PM3/19/24
to Rangana Warshamanage, IsoNet
Hi Rangana,

I have not tested the Tensorflow-2.16.1 with CUDA/12.1. This is probably because the some of the functions used in IsoNet are deprecated in the latest keras. 

Did you test older versions of the Tensorflow?

Best Regards,
Yuntao

--
You received this message because you are subscribed to the Google Groups "IsoNet" group.
To unsubscribe from this group and stop receiving emails from it, send an email to isonet+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/isonet/ae2b4641-4526-48a2-bbd5-0899145642e6n%40googlegroups.com.


--
Best Regards,
Yuntao Liu,  Postdoc.

California NanoSystem Institute
University of California Los Angeles
Reply all
Reply to author
Forward
Message has been deleted
0 new messages