Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

[Bug]top_p_sampling 算子精度问题 #59485

Closed
wj-Mcat opened this issue Nov 29, 2023 · 1 comment
Closed

[Bug]top_p_sampling 算子精度问题 #59485

wj-Mcat opened this issue Nov 29, 2023 · 1 comment
Assignees
Labels
PFCC Paddle Framework Contributor Club,https://github.com/PaddlePaddle/community/tree/master/pfcc status/close 已关闭 type/bug-fixed bug已修复

Comments

@wj-Mcat
Copy link
Contributor

wj-Mcat commented Nov 29, 2023

bug描述 Describe the Bug

  • 安装最新版本的 paddle

直接在官网上面安装就行了,尽量保证一周之内的 paddle 版本: https://www.paddlepaddle.org.cn/install/quick?docurl=/documentation/docs/zh/develop/install/pip/linux-pip.html

  • 复现代码
import paddle
inputs = paddle.randn([3, 10000], dtype='float32')
tokens_res = []
for i in range(10):
    # 这里加不加 seed 作用都是一样的
    _, next_tokens = paddle.tensor.top_p_sampling(inputs, paddle.full([3,1], 0.9, dtype="float32"))
    tokens_res.append(next_tokens.reshape([-1]).numpy().tolist())

for i in range(1, len(tokens_res)):
    assert tokens_res[i] == tokens_res[i-1]

其他补充信息 Additional Supplementary Information

No response

@wj-Mcat wj-Mcat changed the title top_p_sampling 算子精度问题 [Bug]top_p_sampling 算子精度问题 Nov 29, 2023
@carryyu
Copy link
Contributor

carryyu commented Nov 29, 2023

修复PR见:59494,待合入。

需要注意,当前top_p_sampling中的seed在不指定random_seed时,会根据时间戳产生,因此验证多次调用的随机性时,请sleep(1)。

@paddle-bot paddle-bot bot added the PFCC Paddle Framework Contributor Club,https://github.com/PaddlePaddle/community/tree/master/pfcc label Nov 29, 2023
@carryyu carryyu closed this as completed Nov 30, 2023
@paddle-bot paddle-bot bot added status/deferred 延期修复 type/bug-fixed bug已修复 status/close 已关闭 labels Dec 1, 2023
@paddle-bot paddle-bot bot reopened this Dec 1, 2023
@paddle-bot paddle-bot bot closed this as completed Dec 1, 2023
@paddle-bot paddle-bot bot removed the status/deferred 延期修复 label Dec 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PFCC Paddle Framework Contributor Club,https://github.com/PaddlePaddle/community/tree/master/pfcc status/close 已关闭 type/bug-fixed bug已修复
Projects
None yet
Development

No branches or pull requests

3 participants