PaddleSpeech icon indicating copy to clipboard operation
PaddleSpeech copied to clipboard

unexpected result when loading baidu_en8k

Open firdota opened this issue 1 year ago • 2 comments

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 avatar May 25 '24 07:05 firdota

anyone could help?

firdota avatar May 27 '24 03:05 firdota

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星河社区-人工智能学习与实训社区

Ray961123 avatar May 28 '24 09:05 Ray961123

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Apr 26 '25 04:04 stale[bot]