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

unexpected result when loading baidu_en8k #3776

Open
firdota opened this issue May 25, 2024 · 2 comments
Open

unexpected result when loading baidu_en8k #3776

firdota opened this issue May 25, 2024 · 2 comments
Labels

Comments

@firdota
Copy link

firdota commented May 25, 2024

my code is as follows:

import paddle
from paddlespeech.s2t.models.ds2 import DeepSpeech2Model

config = './conf/deepspeech2.yaml'
model = DeepSpeech2Model.from_config(config)
model_param_path = './baidu_en8k/params.pdparams'
model_dict = paddle.load(model_param_path)
print(model_dict)
model.set_state_dict(model_dict)

The error when running is as follows:
Tensor(shape=[32], dtype=float32, place=Place(gpu:0), stop_gradient=True,
[-0.13427278, -0.55235499, -1.24842834, 0.20777903, 0.27952033,
0.16212732, -0.99394548, -0.01013480, -0.40001720, 0.04474913,
0.24409334, -0.24370413, 0.12284821, -0.28940210, 0.27778339,
0.44302204, 0.49736398, -0.96350390, -1.41964650, 0.61999571,
0.22443774, -1.09316063, 0.38835990, 0.44136432, 0.09003256,
-0.32678720, -0.18228465, -0.29467481, -1.33099961, -0.45747182,
0.34930611, 0.15642692])
File "test.py", line 9, in
model.set_state_dict(model_dict)
File "/usr/local/lib/python3.7/dist-packages/paddle/fluid/framework.py", line 486, in wrapper
return func(*args, **kwargs)
File "/usr/local/lib/python3.7/dist-packages/paddle/fluid/dygraph/layers.py", line 1480, in set_state_dict
match_res = _check_match(key_name, param)
File "/usr/local/lib/python3.7/dist-packages/paddle/fluid/dygraph/layers.py", line 1455, in _check_match
state = state_dict.get(key, None)
AttributeError: 'Tensor' object has no attribute 'get'

when i run the same code to load a model trained by myself according to the tutorial, it load the model parameters successfully, and the model_dict is a very big dict. What could be causing this?

The code is run in the official docker container (paddlecloud/paddlespeech:develop-gpu-cuda11.2-cudnn8-latest)
paddlepaddle-gpu 2.3.0.post112
paddleslim 2.4.1
paddlespeech 0.0.0
paddlespeech-ctcdecoders 0.2.1

@firdota
Copy link
Author

firdota commented May 27, 2024

anyone could help?

@Ray961123
Copy link

Hello developers, thank you for paying attention to PaddleSpeech open source project, sorry for bringing you a bad development experience, the current open source project maintenance manpower is limited, you can try to modify the PaddleSpeech source code by yourself, or ask other developers in the open source community to help. Communication channel::飞桨AI Studio星河社区-人工智能学习与实训社区

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants