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

Dangerous floating point comparison #71

Closed
merrymercy opened this issue May 4, 2023 · 2 comments
Closed

Dangerous floating point comparison #71

merrymercy opened this issue May 4, 2023 · 2 comments
Assignees
Labels
bug Something isn't working good first issue Good for newcomers P1

Comments

@merrymercy
Copy link
Contributor

I noticed that we use conditions like this to check whether it is greedy sampling
https://github.com/WoosukKwon/cacheflow/blob/189ae231336857bcc4c6f6157bf7868cdf56fb5f/cacheflow/sampling_params.py#L45

However, I guess this will result in several problems

  1. It is not recommended to use == for floating point numbers
  2. A small temperature will result in inf/nan

I typically use something like this https://github.com/lm-sys/FastChat/blob/a94fd259a97128f7f4483ddb760690f467888d84/fastchat/serve/inference.py#L227

@WoosukKwon, @zhuohan123 What do you think? If you are happy, I can change all "==" to "<=".

@WoosukKwon
Copy link
Collaborator

Hi @merrymercy, thanks for letting us know. Please feel free to contribute.

@zhuohan123
Copy link
Member

Fixed by #285

yukavio pushed a commit to yukavio/vllm that referenced this issue Jul 3, 2024
SUMMARY:
Adds end to end model tests

TEST PLAN:
Compares logprobs of results from hf model vs vllm model at fp16 and
bfloat16

---------

Co-authored-by: Michael Goin <michael@neuralmagic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers P1
Projects
None yet
Development

No branches or pull requests

3 participants