-
Notifications
You must be signed in to change notification settings - Fork 95
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
What does this implement/fix? Explain your changes. --------------------------------------------------- This PR moves the lighteval config to lighteval codebase. - Enforces the lighteval_config_path as the only way to read the lighteval config. The nanotron part is ignore, this way the breaking changes won't be as breaking. - Some typing corrections --------- Co-authored-by: Nathan Habib <30601243+NathanHB@users.noreply.github.com> Co-authored-by: Nathan Habib <nathan.habib@huggingface.co> Co-authored-by: Hynek Kydlicek <kydlicek.hynek@huggingface.co>
- Loading branch information
1 parent
21934d5
commit aaa8bbf
Showing
11 changed files
with
163 additions
and
76 deletions.
There are no files selected for viewing
This file contains 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 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 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,100 @@ | ||
# MIT License | ||
|
||
# Copyright (c) 2024 The HuggingFace Team | ||
|
||
# Permission is hereby granted, free of charge, to any person obtaining a copy | ||
# of this software and associated documentation files (the "Software"), to deal | ||
# in the Software without restriction, including without limitation the rights | ||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
# copies of the Software, and to permit persons to whom the Software is | ||
# furnished to do so, subject to the following conditions: | ||
|
||
# The above copyright notice and this permission notice shall be included in all | ||
# copies or substantial portions of the Software. | ||
|
||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
# SOFTWARE. | ||
|
||
from dataclasses import dataclass | ||
from typing import Dict, Optional, Union | ||
|
||
from nanotron.config import Config | ||
from nanotron.config.parallelism_config import ParallelismArgs | ||
from nanotron.generation.sampler import SamplerType | ||
from nanotron.logging import get_logger | ||
|
||
|
||
logger = get_logger(__name__) | ||
|
||
DEFAULT_GENERATION_SEED = 42 | ||
|
||
|
||
@dataclass | ||
class GenerationArgs: | ||
sampler: Optional[Union[str, SamplerType]] = None | ||
temperature: Optional[float] = None | ||
top_k: Optional[int] = None | ||
top_p: Optional[float] = None | ||
n_samples: Optional[int] = None | ||
eos: Optional[str] = None | ||
seed: Optional[int] = None | ||
use_cache: Optional[bool] = False | ||
|
||
def __post_init__(self): | ||
if isinstance(self.sampler, str): | ||
self.sampler = SamplerType[self.sampler.upper()] | ||
if self.seed is None: | ||
self.seed = DEFAULT_GENERATION_SEED | ||
|
||
|
||
@dataclass | ||
class LightEvalLoggingArgs: | ||
"""Arguments related to logging for LightEval""" | ||
|
||
output_dir: str | ||
save_details: bool = True | ||
push_results_to_hub: bool = False | ||
push_details_to_hub: bool = False | ||
push_results_to_tensorboard: bool = False | ||
public_run: bool = False | ||
results_org: str | None = None | ||
tensorboard_metric_prefix: str = "eval" | ||
|
||
|
||
@dataclass | ||
class LightEvalTasksArgs: | ||
"""Arguments related to tasks for LightEval""" | ||
|
||
tasks: str | ||
custom_tasks: Optional[str] = None | ||
max_samples: Optional[int] = None | ||
num_fewshot_seeds: Optional[int] = None | ||
|
||
dataset_loading_processes: int = 8 | ||
multichoice_continuations_start_space: Optional[bool] = None | ||
|
||
|
||
@dataclass | ||
class LightEvalConfig: | ||
"""Arguments related to running LightEval on checkpoints. | ||
All is optional because you can also use this class to later supply arguments to override | ||
the saved config when running LightEval after training. | ||
""" | ||
|
||
logging: LightEvalLoggingArgs | ||
tasks: LightEvalTasksArgs | ||
parallelism: ParallelismArgs | ||
batch_size: int = 0 | ||
generation: Optional[Union[GenerationArgs, Dict[str, GenerationArgs]]] = None | ||
|
||
|
||
@dataclass | ||
class FullNanotronConfig: | ||
lighteval_config: LightEvalConfig | ||
nanotron_config: Config |
This file contains 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 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 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 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.