Skip to content
New issue

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

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

Already on GitHub? # to your account

[Hackathon 7th] 修复 SoundClassifier 中输入维度的问题 #3931

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

megemini
Copy link
Contributor

@megemini megemini commented Dec 4, 2024

PR types

Bug fixes

PR changes

APIs

Describe

修复 SoundClassifier 中输入维度的问题 ~

错误日志:

  File "/home/aistudio/PaddleSpeech/paddlespeech/cls/exps/panns/deploy/predict.py", line 142, in <module>
    predictor = Predictor(args.model_dir, args.device, args.batch_size,
  File "/home/aistudio/PaddleSpeech/paddlespeech/cls/exps/panns/deploy/predict.py", line 130, in predict
    self.predictor.run()
RuntimeError: dimensions are invalid

目前在 esc50 中测试,可以训练,并加载新/旧模型 ~ (加载旧模型需要先 FLAGS_enable_pir_api=0)

以下为部分日志:

> CUDA_VISIBLE_DEVICES=0 ./run.sh 1 conf/panns.yaml
...
[2024-12-04 12:40:26,815] [   TRAIN] - Epoch=5/5, Step=20/50 loss=3.5615 acc=0.1094 lr=0.000050 step/sec=5.48 | ETA 00:00:49
[2024-12-04 12:40:28,635] [   TRAIN] - Epoch=5/5, Step=30/50 loss=3.6178 acc=0.1125 lr=0.000050 step/sec=5.49 | ETA 00:00:49
[2024-12-04 12:40:30,456] [   TRAIN] - Epoch=5/5, Step=40/50 loss=3.4752 acc=0.1406 lr=0.000050 step/sec=5.49 | ETA 00:00:49
[2024-12-04 12:40:32,270] [   TRAIN] - Epoch=5/5, Step=50/50 loss=3.4682 acc=0.1094 lr=0.000050 step/sec=5.51 | ETA 00:00:48
[2024-12-04 12:40:32,380] [    INFO] - Evaluation on validation dataset: \
[2024-12-04 12:40:32,521] [    INFO] - Evaluation on validation dataset: |
[2024-12-04 12:40:32,622] [    INFO] - Evaluation on validation dataset: /
[2024-12-04 12:40:32,723] [    INFO] - Evaluation on validation dataset: -
[2024-12-04 12:40:32,823] [    INFO] - Evaluation on validation dataset: \
[2024-12-04 12:40:32,924] [    INFO] - Evaluation on validation dataset: |
[2024-12-04 12:40:33,024] [    INFO] - Evaluation on validation dataset: /
[2024-12-04 12:40:33,125] [    INFO] - Evaluation on validation dataset: -
[2024-12-04 12:40:33,225] [    INFO] - Evaluation on validation dataset: \
[2024-12-04 12:40:33,326] [    INFO] - Evaluation on validation dataset: |
[2024-12-04 12:40:33,370] [    EVAL] - [Evaluation result] dev_acc=0.3600
[2024-12-04 12:40:33,371] [    INFO] - Saving model checkpoint to ./checkpoint/epoch_5
LAUNCH INFO 2024-12-04 12:40:44,445 Pod completed
LAUNCH INFO 2024-12-04 12:40:44,446 Exit code 0


> CUDA_VISIBLE_DEVICES=0 ./run.sh 2 conf/panns.yaml
W1204 12:40:59.771448 62713 gpu_resources.cc:119] Please NOTE: device: 0, GPU Compute Capability: 7.0, Driver API Version: 12.0, Runtime API Version: 11.8
W1204 12:40:59.772363 62713 gpu_resources.cc:164] device: 0, cuDNN Version: 8.9.
[2024-12-04 12:41:04,915] [    INFO] - [~/datasets/5-9032-A-0.wav]
Sneezing: 0.064747653901577
Crackling fire: 0.0647040382027626
Dog: 0.03946595638990402
Water drops: 0.03319902345538139
Crying baby: 0.032121408730745316
Snoring: 0.029411744326353073
Cat: 0.029175998643040657
Coughing: 0.028498642146587372
Brushing teeth: 0.028278758749365807
Breathing: 0.025568483397364616


> CUDA_VISIBLE_DEVICES=0 ./run.sh 3 ./checkpoint/epoch_5/model.pdparams ./export
W1204 12:42:25.195297 62986 gpu_resources.cc:119] Please NOTE: device: 0, GPU Compute Capability: 7.0, Driver API Version: 12.0, Runtime API Version: 11.8
W1204 12:42:25.196277 62986 gpu_resources.cc:164] device: 0, cuDNN Version: 8.9.

> CUDA_VISIBLE_DEVICES=0 ./run.sh 4 cpu ./export ~/datasets/5-9032-A-0.wav
--- Running PIR pass [add_shadow_output_after_dead_parameter_pass]
I1204 12:44:09.271708 63491 print_statistics.cc:50] --- detected [2] subgraphs!
--- Running PIR pass [delete_quant_dequant_linear_op_pass]
--- Running PIR pass [delete_weight_dequant_linear_op_pass]
--- Running PIR pass [common_subexpression_elimination_pass]
I1204 12:44:09.272926 63491 print_statistics.cc:50] --- detected [10] subgraphs!
--- Running PIR pass [constant_folding_pass]
I1204 12:44:09.274359 63491 pir_interpreter.cc:1586] New Executor is Running ...
I1204 12:44:09.274610 63491 pir_interpreter.cc:1610] pir interpreter is running by multi-thread mode ...
I1204 12:44:09.281364 63491 print_statistics.cc:44] --- detected [6, 143] subgraphs!
--- Running PIR pass [dead_code_elimination_pass]
--- Running PIR pass [replace_fetch_with_shadow_output_pass]
I1204 12:44:09.281674 63491 print_statistics.cc:50] --- detected [1] subgraphs!
--- Running PIR pass [remove_shadow_feed_pass]
--- Running PIR pass [inplace_pass]
I1204 12:44:09.289299 63491 print_statistics.cc:50] --- detected [4] subgraphs!
I1204 12:44:09.289384 63491 analysis_predictor.cc:1097] ======= pir optimization completed =======
W1204 12:44:09.294306 63491 gpu_resources.cc:119] Please NOTE: device: 0, GPU Compute Capability: 7.0, Driver API Version: 12.0, Runtime API Version: 11.8
W1204 12:44:09.295300 63491 gpu_resources.cc:164] device: 0, cuDNN Version: 8.9.
I1204 12:44:12.108461 63491 pir_interpreter.cc:1607] pir interpreter is running by trace mode ...
Wav: /home/aistudio/datasets/5-9032-A-0.wav      Label: Sneezing


> FLAGS_enable_pir_api=0 CUDA_VISIBLE_DEVICES=0 ./run.sh 4 cpu old_checkpoint/panns_cnn6_static ~/datasets/5-9032-A-0.wav
--- Running analysis [ir_graph_build_pass]
I1204 12:45:33.673135 63852 executor.cc:183] Old Executor is Running.
--- Running analysis [ir_analysis_pass]
--- Running IR pass [simplify_with_basic_ops_pass]
--- Running IR pass [layer_norm_fuse_pass]
--- Running IR pass [attention_lstm_fuse_pass]
--- Running IR pass [seqconv_eltadd_relu_fuse_pass]
--- Running IR pass [seqpool_cvm_concat_fuse_pass]
--- Running IR pass [mul_lstm_fuse_pass]
--- Running IR pass [fc_gru_fuse_pass]
--- Running IR pass [mul_gru_fuse_pass]
--- Running IR pass [seq_concat_fc_fuse_pass]
--- Running IR pass [gpu_cpu_squeeze2_matmul_fuse_pass]
--- Running IR pass [gpu_cpu_reshape2_matmul_fuse_pass]
--- Running IR pass [gpu_cpu_flatten2_matmul_fuse_pass]
--- Running IR pass [matmul_v2_scale_fuse_pass]
--- Running IR pass [gpu_cpu_map_matmul_v2_to_mul_pass]
I1204 12:45:33.696380 63852 fuse_pass_base.cc:59] ---  detected 2 subgraphs
--- Running IR pass [gpu_cpu_map_matmul_v2_to_matmul_pass]
--- Running IR pass [matmul_scale_fuse_pass]
--- Running IR pass [gpu_cpu_map_matmul_to_mul_pass]
--- Running IR pass [fc_fuse_pass]
I1204 12:45:33.699100 63852 fuse_pass_base.cc:59] ---  detected 2 subgraphs
--- Running IR pass [repeated_fc_relu_fuse_pass]
--- Running IR pass [squared_mat_sub_fuse_pass]
--- Running IR pass [conv_bn_fuse_pass]
I1204 12:45:33.704993 63852 fuse_pass_base.cc:59] ---  detected 4 subgraphs
--- Running IR pass [conv_eltwiseadd_bn_fuse_pass]
--- Running IR pass [conv_transpose_bn_fuse_pass]
--- Running IR pass [conv_transpose_eltwiseadd_bn_fuse_pass]
--- Running IR pass [is_test_pass]
--- Running IR pass [constant_folding_pass]
--- Running analysis [ir_params_sync_among_devices_pass]
--- Running analysis [adjust_cudnn_workspace_size_pass]
--- Running analysis [inference_op_replace_pass]
--- Running analysis [save_optimized_model_pass]
--- Running analysis [ir_graph_to_program_pass]
I1204 12:45:33.715626 63852 analysis_predictor.cc:2095] ======= ir optimization completed =======
I1204 12:45:33.715848 63852 naive_executor.cc:207] ---  skip [feed], feed -> x
I1204 12:45:33.716508 63852 naive_executor.cc:207] ---  skip [sigmoid_0.tmp_0], fetch -> fetch
W1204 12:45:33.720858 63852 gpu_resources.cc:119] Please NOTE: device: 0, GPU Compute Capability: 7.0, Driver API Version: 12.0, Runtime API Version: 11.8
W1204 12:45:33.721858 63852 gpu_resources.cc:164] device: 0, cuDNN Version: 8.9.
Wav: /home/aistudio/datasets/5-9032-A-0.wav      Label: Dog

@zxcd @Liyulingyue @GreatV

Copy link

paddle-bot bot commented Dec 4, 2024

Thanks for your contribution!

Copy link

mergify bot commented Dec 5, 2024

This pull request is now in conflict :(

@mergify mergify bot added the conflicts label Dec 5, 2024
@mergify mergify bot removed the conflicts label Dec 5, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant