@@ -42,17 +42,17 @@ def nanotron(
4242 checkpoint_config_path : Annotated [
4343 str , Option (help = "Path to the nanotron checkpoint YAML or python config file, potentially on s3." )
4444 ],
45- lighteval_config_path : Annotated [str , Option (help = "Path to a YAML config to be used for the evaluation." )],
45+ lighteval_config_path : Annotated [str , Option (help = "Path to a YAML config to be used for the evaluation." )] = None ,
4646 cache_dir : Annotated [str , Option (help = "Cache directory for datasets and models." )] = CACHE_DIR ,
4747):
4848 """
4949 Evaluate models using nanotron as backend.
5050 """
5151 from nanotron .config import Config , get_config_from_file
52+ from nanotron .config .parallelism_config import ParallelismArgs
5253
53- from lighteval .config .lighteval_config import FullNanotronConfig , LightEvalConfig
54+ from lighteval .config .lighteval_config import FullNanotronConfig , LightEvalConfig , LightEvalLoggingArgs , LightEvalTasksArgs
5455 from lighteval .logging .evaluation_tracker import EvaluationTracker
55- from lighteval .logging .hierarchical_logger import htrack_block
5656 from lighteval .pipeline import ParallelismManager , Pipeline , PipelineParameters
5757 from lighteval .utils .imports import NO_NANOTRON_ERROR_MSG , is_nanotron_available
5858 from lighteval .utils .utils import EnvConfig
@@ -61,23 +61,38 @@ def nanotron(
6161
6262 if not is_nanotron_available ():
6363 raise ImportError (NO_NANOTRON_ERROR_MSG )
64+
65+ # Create nanotron config
66+ if not checkpoint_config_path .endswith (".yaml" ):
67+ raise ValueError ("The checkpoint path should point to a YAML file" )
68+
69+ model_config = get_config_from_file (
70+ checkpoint_config_path ,
71+ config_class = Config ,
72+ model_config_class = None ,
73+ skip_unused_config_keys = True ,
74+ skip_null_keys = True ,
75+ )
6476
65- with htrack_block ("Load nanotron config" ):
66- # Create nanotron config
67- if not checkpoint_config_path .endswith (".yaml" ):
68- raise ValueError ("The checkpoint path should point to a YAML file" )
69-
70- model_config = get_config_from_file (
71- checkpoint_config_path ,
72- config_class = Config ,
73- model_config_class = None ,
74- skip_unused_config_keys = True ,
75- skip_null_keys = True ,
76- )
77-
78- # We are getting an type error, because the get_config_from_file is not correctly typed,
77+ # Create or use default lighteval config
78+ if lighteval_config_path is not None :
7979 lighteval_config : LightEvalConfig = get_config_from_file (lighteval_config_path , config_class = LightEvalConfig ) # type: ignore
80- nanotron_config = FullNanotronConfig (lighteval_config , model_config )
80+ else :
81+ # Create default config with minimal required parameters
82+ default_logging = LightEvalLoggingArgs (
83+ output_dir = "./eval_results"
84+ )
85+ default_tasks = LightEvalTasksArgs (
86+ tasks = "lighteval|agieval:aqua-rat|5|0"
87+ )
88+ default_parallelism = ParallelismArgs (dp = 1 , pp = 1 , tp = 1 )
89+ lighteval_config = LightEvalConfig (
90+ logging = default_logging ,
91+ tasks = default_tasks ,
92+ parallelism = default_parallelism
93+ )
94+
95+ nanotron_config = FullNanotronConfig (lighteval_config , model_config )
8196
8297 evaluation_tracker = EvaluationTracker (
8398 output_dir = lighteval_config .logging .output_dir ,
0 commit comments