Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

【运行出错】ValueError: Layer #13 (named "attn_layer_2" in t...2 weights, but the saved weights have 2 elements. #3

Open
mokeeqian opened this issue Oct 30, 2023 · 0 comments

Comments

@mokeeqian
Copy link

使用您的仓库代码,NYC-OD,HAIKOU-OD,均报错如下:

Exception:..... ValueError: Layer #13 (named "attn_layer_2" in t...2 weights, but the saved weights have 2 elements.
Call ended by exception
Elapsed time: 00:00:00.044523
Traceback (most recent call last):
  File "/root/autodl-tmp/project/HSTN-main/HAIKOU-OD/HSTN_HK_train_test.py", line 107, in <module>
    train()
  File "/root/miniconda3/lib/python3.8/site-packages/pysnooper/tracer.py", line 310, in simple_wrapper
    return function(*args, **kwargs)
  File "/root/autodl-tmp/project/HSTN-main/HAIKOU-OD/HSTN_HK_train_test.py", line 87, in train
    model = create_model()
  File "/root/autodl-tmp/project/HSTN-main/HAIKOU-OD/HSTN_HK_train_test.py", line 77, in create_model
    model.load_weights(model_file)
  File "/root/miniconda3/lib/python3.8/site-packages/tensorflow/python/keras/engine/training.py", line 2326, in load_weights
    hdf5_format.load_weights_from_hdf5_group(f, self.layers)
  File "/root/miniconda3/lib/python3.8/site-packages/tensorflow/python/keras/saving/hdf5_format.py", line 705, in load_weights_from_hdf5_group
    raise ValueError('Layer #' + str(k) + ' (named "' + layer.name +
ValueError: Layer #13 (named "attn_layer_2" in the current model) was found to correspond to layer dense_10 in the save file. However the new layer attn_layer_2 expects 12 weights, but the saved weights have 2 elements.

Process finished with exit code 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant