Load TF weights

#9
by muhbdeir - opened

I cannot load weights of TF model:
got this error

ValueError Traceback (most recent call last)
Cell In[17], line 4
2 model = TFAutoModelForSequenceClassification.from_pretrained(MODEL)
3 model.save_pretrained(MODEL)
----> 4 model.load_weights("/home/muhammad/git.flare/Warmfire/tf_model.h5")

File ~/anaconda3/lib/python3.10/site-packages/keras/utils/traceback_utils.py:70, in filter_traceback..error_handler(*args, **kwargs)
67 filtered_tb = _process_traceback_frames(e.traceback)
68 # To get the full stack trace, call:
69 # tf.debugging.disable_traceback_filtering()
---> 70 raise e.with_traceback(filtered_tb) from None
71 finally:
72 del filtered_tb

File ~/anaconda3/lib/python3.10/site-packages/keras/saving/legacy/hdf5_format.py:808, in load_weights_from_hdf5_group(f, model)
806 layer_names = filtered_layer_names
807 if len(layer_names) != len(filtered_layers):
--> 808 raise ValueError(
809 "Layer count mismatch when loading weights from file. "
810 f"Model expected {len(filtered_layers)} layers, found "
811 f"{len(layer_names)} saved layers."
812 )
814 # We batch weight value assignments in a single backend call
815 # which provides a speedup in TensorFlow.
816 weight_value_tuples = []

ValueError: Layer count mismatch when loading weights from file. Model expected 2 layers, found 1 saved layers.

Sign up or log in to comment