Skip to content

Commit

Permalink
Merge pull request PaddlePaddle#60 from MyAngelAyase/fix_bus_for_mmlu
Browse files Browse the repository at this point in the history
fix bug for mmlu
  • Loading branch information
MyAngelAyase authored Oct 25, 2023
2 parents f183ccc + 7c03a44 commit cd754a2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions backends/npu/custom_op/llama_decoder_layer_parallel_op.cc
Original file line number Diff line number Diff line change
Expand Up @@ -255,13 +255,13 @@ std::vector<paddle::Tensor> LlamaDecoderLayerParallelOp(
std::vector<int32_t> layer_id_vec(1, 0);
custom_kernel::TensorFromVector(*dev_ctx, layer_id_vec,
*dev_ctx, &(g_llamaDecoderLayerParallelOp->layerIdTensor_));
g_llamaDecoderLayerParallelOp->output_ = std::make_shared<phi::DenseTensor>();
g_llamaDecoderLayerParallelOp->output_->Resize(phi::make_ddim(hidden.shape()));
dev_ctx->Alloc(g_llamaDecoderLayerParallelOp->output_.get(),
static_cast<const phi::DenseTensor *>(hidden.impl().get())->dtype());
}

if (executeCount % layer_num == 0) { // 每个token第一次进layer,更新stop flag
g_llamaDecoderLayerParallelOp->output_ = std::make_shared<phi::DenseTensor>();
g_llamaDecoderLayerParallelOp->output_->Resize(phi::make_ddim(hidden.shape()));
dev_ctx->Alloc(g_llamaDecoderLayerParallelOp->output_.get(),
static_cast<const phi::DenseTensor *>(hidden.impl().get())->dtype());
g_llamaDecoderLayerParallelOp->UpdateInputTensorAndParam(kv_seq_len);
}

Expand Down
8 changes: 4 additions & 4 deletions backends/npu/custom_op/llama_encoder_layer_parallel_op.cc
Original file line number Diff line number Diff line change
Expand Up @@ -221,13 +221,13 @@ std::vector<paddle::Tensor> LlamaEncoderLayerParallelOp(
std::vector<int32_t> layer_id_vec(1, 0);
custom_kernel::TensorFromVector(*dev_ctx, layer_id_vec,
*dev_ctx, &(g_llamaEncoderLayerParallelOp->layerIdTensor_));
g_llamaEncoderLayerParallelOp->output_ = std::make_shared<phi::DenseTensor>();
g_llamaEncoderLayerParallelOp->output_->Resize(phi::make_ddim(hidden.shape()));
dev_ctx->Alloc(g_llamaEncoderLayerParallelOp->output_.get(),
static_cast<const phi::DenseTensor *>(hidden.impl().get())->dtype());
}

if (executeCount % layer_num == 0) {
g_llamaEncoderLayerParallelOp->output_ = std::make_shared<phi::DenseTensor>();
g_llamaEncoderLayerParallelOp->output_->Resize(phi::make_ddim(hidden.shape()));
dev_ctx->Alloc(g_llamaEncoderLayerParallelOp->output_.get(),
static_cast<const phi::DenseTensor *>(hidden.impl().get())->dtype());
g_llamaEncoderLayerParallelOp->UpdateInputTensorAndParam(kv_seq_len);
}

Expand Down

0 comments on commit cd754a2

Please sign in to comment.