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

hparam comparison uses memcpy for floating point comparison, which is in general a bad idea #3446

Merged
merged 5 commits into from
Oct 6, 2023

Conversation

l3utterfly
Copy link
Contributor

Tested by saving and loading a session using a llama2 model. Sometimes the hparam comparison check would fail. I think it's due to the floating point comparisons for eps_norm values etc.

Updated to use epsilon comparison method which should be more robust.

llama.cpp Outdated Show resolved Hide resolved
llama.cpp Show resolved Hide resolved
llama.cpp Outdated Show resolved Hide resolved
llama.cpp Outdated Show resolved Hide resolved
llama.cpp Outdated Show resolved Hide resolved
llama.cpp Outdated Show resolved Hide resolved
@ggerganov ggerganov merged commit 16820a5 into ggerganov:master Oct 6, 2023
32 checks passed
joelkuiper added a commit to vortext/llama.cpp that referenced this pull request Oct 6, 2023
…example

* 'master' of github.com:ggerganov/llama.cpp:
  kv cache slot search improvements (ggerganov#3493)
  prompts : fix editorconfig checks after ggerganov#3416
  parallel : add option to load external prompt file (ggerganov#3416)
  server : reuse llama_sample_token common util (ggerganov#3494)
  llama : correct hparams comparison (ggerganov#3446)
  ci : fix xcodebuild destinations (ggerganov#3491)
  convert : update Falcon script for new HF config (ggerganov#3448)
  build : use std::make_tuple() for compatibility with older GCC versions (ggerganov#3488)
  common : process escape sequences in reverse prompts (ggerganov#3461)
  CLBlast: Fix handling of on-device tensor data
  server : fix incorrect num_tokens_predicted (ggerganov#3480)
  swift : disable ACCELERATE_NEW_LAPACK (ggerganov#3481)
  ci : add swift build via xcodebuild (ggerganov#3482)
yusiwen pushed a commit to yusiwen/llama.cpp that referenced this pull request Oct 7, 2023
* fixed floating point comparison issues

* updated implementation for hparam comparison to handle inf and NaN

* fixed code review comments

* minor simplification

* rename is_float_eq -> is_float_close

---------

Co-authored-by: Cebtenzzre <cebtenzzre@gmail.com>
@l3utterfly l3utterfly deleted the hparam-compare branch October 7, 2023 14:23
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.

3 participants