Batched and distributed eval (with full determinism feature) #11
Open
TonyChen06 wants to merge 2 commits intoELM-Research:mainfrom
Open
Batched and distributed eval (with full determinism feature) #11TonyChen06 wants to merge 2 commits intoELM-Research:mainfrom
TonyChen06 wants to merge 2 commits intoELM-Research:mainfrom
Conversation
Contributor
Author
|
Casting into float32 instead of float64 is a much more efficient way to get deterministic results (it is exponentially faster), and it works 99.9% of the time but occasionally a sample or two will differ when batch sizes are vastly different. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds batched eval and distributed eval options.
Both the process of batching and distributing across GPUs themselves are fully deterministic and produces identical results as single GPU non-batched inferencing. (This is tested for 1-2 gpus, 1-8 batch size, and for ptbqa and instuct45k).
The two sources of nondeterminism are confirmed to be 1. RNG conditions changing when batching which leads to different logit choices for do_sample, and 2. slight bfloat16 calculation imprecisions that become apparent when batching and distributing are done since the GPU conditions slightly change.
This version of the PR contains a flag called --full_determinism that allows for fully deterministic inference (as in the results across gpu count and batch size will be identical when the flag is enabled). What it does is simply cast bfloat16 into float64 and set do_sample=false. This is not really too efficient for actual use because of the memory costs for float64 but may be nice if you want to confirm the problem is really there yourself.
The other version of the same PR doesn't contain this flag and is much simpler. Choose whichever one is preferable.