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

Deepmind version's probability distribution #36

Open
YEOMJINSEOP opened this issue Nov 2, 2024 · 0 comments
Open

Deepmind version's probability distribution #36

YEOMJINSEOP opened this issue Nov 2, 2024 · 0 comments

Comments

@YEOMJINSEOP
Copy link

YEOMJINSEOP commented Nov 2, 2024

Hi, thanks for sharing codes.

I think the deepmind version code def speculative_sampling_v2 should be fixed.
because the way code implmented the part of comparing 's probability distribution and q's probability distribution is different to algorithm in the Deepmind paper.

[current code]
if r < torch.min(torch.tensor([1], device=q.device), p[:, prefix_len + i - 1, draft_token_idx] / q[:, prefix_len + i - 1, draft_token_idx]):

[correct code]
if r < torch.min(torch.tensor([1], device=q.device), q[:, prefix_len + i - 1, draft_token_idx] / p[:, prefix_len + i - 1, draft_token_idx]):

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

No branches or pull requests

1 participant