Skip to content

Conversation

@Galaxy1458
Copy link
Contributor

@Galaxy1458 Galaxy1458 commented Apr 28, 2024

PR types

Performance optimization

PR changes

Models

Description

优化NPU下跑llama模型时使用is_casual_mask 对ppt, lora ,sft策略选择问题

@paddle-bot
Copy link

paddle-bot bot commented Apr 28, 2024

Thanks for your contribution!

Copy link
Contributor

@SylarTiaNII SylarTiaNII left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

# masked_lm_loss = masked_lm_loss[masked_lm_loss > 0]
# loss = paddle.mean(masked_lm_loss)
binary_sequence = paddle.where(masked_lm_loss > 0, paddle.ones_like(masked_lm_loss), paddle.zeros_like(masked_lm_loss))
loss = paddle.sum(masked_lm_loss * binary_sequence) / paddle.sum(binary_sequence)
Copy link
Contributor

@wawltor wawltor Apr 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

paddle.sum(binary_sequence) 中binary_sequence有可能全为0,导致sum后0;这里loss会有异常

之前的业务遇到过这个问题

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

同时对GPU性能的影响是什么

@wawltor wawltor requested a review from ZHUI April 30, 2024 05:06
Copy link
Contributor

@ZHUI ZHUI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants