-
Notifications
You must be signed in to change notification settings - Fork 32
Adds lm_eval to evaluations #282
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
Open
bigximik
wants to merge
49
commits into
main
Choose a base branch
from
denis/lm_eval
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 29 commits
Commits
Show all changes
49 commits
Select commit
Hold shift + click to select a range
cb744b2
copy from sandbox
bigximik 0967483
changes for loss test for new tests structure
bigximik 71ff61a
lm_eval integration changes for the new api
bigximik 79fd43e
made lm_eval dependency lazy imported for optional dependency
bigximik 2d9f479
removed hard coded batch size
bigximik 7c62100
remved unncecessary set to evaluatation
bigximik c89d269
commit wandb step after finishing logging
bigximik 9455cd5
support for env varieables for lm_eval integration
bigximik 69180a3
merge from main
bigximik c9a3b18
user guide for evaluators added
bigximik 426b5e3
fix tensor concatination for logits from different gpus
bigximik 0bf8282
docs update
bigximik 68f524b
removed manual test configs
bigximik a36e0be
added debug prints
bigximik 9baa512
fix for gather_list and remove debug print
bigximik 21678ab
removed debug print
bigximik 7cccf9a
moved returned logits to cpu in lm_eval wrapper
bigximik 7cd681a
fix to move all logits computations to cpu
bigximik 59ff1e5
Merge branch 'main' of github.com:ServiceNow/Fast-LLM into denis/lm_eval
bigximik 27e5de8
Merge branch 'main' of github.com:ServiceNow/Fast-LLM into denis/lm_eval
bigximik 88faca0
fix typo
bigximik e3a4a6e
removed commented code, obsolete todo
bigximik 89e67d2
changes to wrapper
bigximik 6871359
refactorred lm_eval integration
bigximik 6b74739
import change
bigximik c398444
zero stage 3 inference warning added and TODO
bigximik 62846d2
removed docstrings
bigximik e61cc3e
removed unused fields, change generate call
bigximik 6a2ab35
changed to all fields to be private, removed properties which are useβ¦
bigximik 6e1704f
Simplify scatter/gather
jlamypoirier 2499b4e
clean up, more comments
bigximik 44aa138
fixed tipo
bigximik f81a673
moved setting of NUMEXPR_MAX_THREADS
bigximik d56ce57
Evaluators renames
bigximik b32c91f
return change
bigximik 93091dd
change local function to lambda
bigximik 50e65ee
somme speedup
bigximik d32258e
fix not to log absent head output
bigximik 98d1d77
added lm_eval integration tests
bigximik 9f2de97
fix not removal comment for import
bigximik b451543
docs update
bigximik 910d54e
scatter fix
bigximik 077f2ac
fix offset normalization in validation
bigximik ac9025d
tests polishing
bigximik 30d85df
more tests polishing
bigximik f60fa35
fixes
jlamypoirier ada41ca
Merge branch 'main' of github.com:ServiceNow/Fast-LLM into denis/lm_eval
bigximik 2f5d2d0
changed prepare funciton to just copy traning runs
bigximik f05db2c
disabled test
bigximik File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
# Evaluations | ||
|
||
Fast-LLM allows you to perform various evaluations during training or as a separate evaluation step. In both cases, you need to use your training config with `training.evaluators` specified. | ||
|
||
For evaluators used during training, both `interval` and `offset` must be specified. Then, start training as usual with: | ||
|
||
`fast-llm train gpt --config path/to/training/config.yaml` | ||
|
||
To perform evaluation as a separate step, use the same training config. Depending on the training progress, either the start model or the latest checkpoint will be loaded, and `interval` and `offset` will be ignored. To start evaluation: | ||
|
||
`fast-llm evaluate gpt --config path/to/training/config.yaml` | ||
|
||
## Currently Supported Evaluators | ||
|
||
- `loss` | ||
- `lm_eval` | ||
|
||
## Loss Evaluator | ||
|
||
To set up loss evaluation, specify a dataset to be used in the `data.datasets` section of the config. You must also define the loss evaluator in the `training.evaluators` config section. See example below. | ||
|
||
```yaml | ||
training: | ||
evaluations: | ||
stack_3b: | ||
interval: 10 | ||
evaluator: | ||
type: loss | ||
iterations: 10 | ||
dataset_name: stack_3b | ||
fineweb: | ||
evaluator: | ||
type: loss | ||
iterations: 10 | ||
dataset_name: stack_3b | ||
interval: 10 | ||
data: | ||
datasets: | ||
stack_3b: | ||
type: memmap | ||
path: path/to/memmap/dataset | ||
fineweb: | ||
type: memmap | ||
path: path/to/memmap/dataset1 | ||
``` | ||
|
||
## Evaluation Harness (`lm_eval`) Evaluator | ||
|
||
**Note:** Only data parallelism is currently supported for the `lm_eval` evaluator. | ||
|
||
To run `lm_eval` evaluations, version `0.4.9` of `lm_eval` must be installed along with all dependencies required for your evaluation tasks. | ||
|
||
The following environment variables may need to be set: | ||
|
||
- `HF_HOME`: Path for Hugging Face data caching | ||
- `WANDB_API_KEY_PATH`: Path to a file containing your Weights & Biases API key (if logging to W&B) | ||
- `HUGGINGFACE_API_KEY_PATH`: Path to a file containing your Hugging Face hub token | ||
- `NLTK_DATA`: Path to a directory that will contain downloaded NLTK packages (needed for some tasks) | ||
- `HF_ALLOW_CODE_EVAL=1`: Required for some evaluation tasks | ||
|
||
You may need to specify additional environment variables depending on the `lm_eval` tasks you want to run. | ||
|
||
To specify an `lm_eval` task, the evaluator config includes the following fields: | ||
|
||
### Model Config | ||
|
||
The model instantiated for training is reused for evaluation, so you don't need to specify it separately. However, there are some parameters specific to `lm_eval`. See `fast_llm/engine/evaluation/config.EvaluatorLmEvalConfig` for details. | ||
|
||
### CLI Parameters for `lm_eval` | ||
|
||
All other parameters are specified as if you were calling the `lm_eval` CLI, using a list of strings. Some CLI parameters are ignored or restrictedβspecifically those related to model loading, W&B, batch sizes, and device setup, as these are managed by the rest of the Fast-LLM configuration. | ||
|
||
Also, the tokenizer must be specified in `data.tokenizer`. If the tokenizer does not have a `bos_token`, it must be specified explicitly in `data.tokenizer.bos_token`. Although `lm_eval` does not use the `bos_token` directly, it is still required because the same tokenizer is used by other Fast-LLM components. | ||
|
||
Below is an example of the config: | ||
|
||
```yaml | ||
training: | ||
evaluations: | ||
lm_eval_tasks1: | ||
interval: 10 | ||
evaluator: | ||
type: lm_eval | ||
cli_args: | ||
- --tasks | ||
- gsm8k,xnli_en,wikitext,ifeval | ||
- --output_path | ||
- /path/to/lm_eval/output | ||
data: | ||
tokenizer: | ||
path: path/to/the/tokenizer | ||
``` |
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.