ValueError: For 'MatMul' the input dimensions must be equal, but got 'x1_col': 5120 and 'x2_row': 640.
收藏回复举报
ValueError: For 'MatMul' the input dimensions must be equal, but got 'x1_col': 5120 and 'x2_row': 640.
t('forum.solved') 已解决
发表于2024-08-05 18:02:00
0 查看

报错信息

Traceback (most recent call last): 

  File "/home/ma-user/modelarts/user-job-dir/pangu_am_deploy-release-v26.2/mslite_deploy/sample/ckpt_eval.py", line 374, in <module> 

    main() 

  File "/home/ma-user/modelarts/user-job-dir/pangu_am_deploy-release-v26.2/mslite_deploy/sample/ckpt_eval.py", line 344, in main 

    run_predict(model_predict, pangu_config, args_opt) 

  File "/home/ma-user/modelarts/user-job-dir/pangu_am_deploy-release-v26.2/mslite_deploy/sample/ckpt_eval.py", line 161, in run_predict 

    infer_single_file(input_file_path, save_file_path) 

  File "/home/ma-user/modelarts/user-job-dir/pangu_am_deploy-release-v26.2/mslite_deploy/sample/ckpt_eval.py", line 110, in infer_single_file 

    output_ids = generate_increment(model_predict, i/batch_size, input_ids, expert_ids, input_mask, position_ids, 

  File "/home/ma-user/modelarts/user-job-dir/pangu_am_deploy-release-v26.2/tools/model_backbone/src/generation/generate.py", line 95, in generate_increment 

    logits = model.predict(input_ids, expert_ids, input_mask, position_ids, init, batch_valid_length, lora_ids, 

  File "/home/ma-user/anaconda3/envs/MindSpore/lib/python3.9/site-packages/mindspore/train/model.py", line 1727, in predict 

    result = self._predict_network(*predict_data) 

  File "/home/ma-user/anaconda3/envs/MindSpore/lib/python3.9/site-packages/mindspore/nn/cell.py", line 675, in __call__ 

    out = self.compile_and_run(*args, **kwargs) 

  File "/home/ma-user/anaconda3/envs/MindSpore/lib/python3.9/site-packages/mindspore/nn/cell.py", line 994, in compile_and_run 

    self.compile(*args, **kwargs) 

  File "/home/ma-user/anaconda3/envs/MindSpore/lib/python3.9/site-packages/mindspore/nn/cell.py", line 977, in compile 

    _cell_graph_executor.compile(self, *self._compile_args, phase=self.phase, 

  File "/home/ma-user/anaconda3/envs/MindSpore/lib/python3.9/site-packages/mindspore/common/api.py", line 1590, in compile 

    result = self._graph_executor.compile(obj, args, kwargs, phase, self._use_vm_mode()) 

ValueError: For 'MatMul' the input dimensions must be equal, but got 'x1_col': 5120 and 'x2_row': 640.

matmul算子编译报错,两个矩阵维度对不上

x = matmul(x, weight) 

其中,x.shape=(-1,5120),weight.shape=(5120, 5120)

算子matmul的并行策略为:

self.matmul.shard(((1,8), (8,1)), out_strategy=((1,1),))

看报错信息,貌似是没有对x按策略进行切分

环境

910 单机8卡推理

mindspore 2.3.0RC1

本帖最后由 匿名用户2024/08/06 10:01:46 编辑

我要发帖子