@@ -42,17 +42,17 @@ def nanotron(
42
42
checkpoint_config_path : Annotated [
43
43
str , Option (help = "Path to the nanotron checkpoint YAML or python config file, potentially on s3." )
44
44
],
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 ,
46
46
cache_dir : Annotated [str , Option (help = "Cache directory for datasets and models." )] = CACHE_DIR ,
47
47
):
48
48
"""
49
49
Evaluate models using nanotron as backend.
50
50
"""
51
51
from nanotron .config import Config , get_config_from_file
52
+ from nanotron .config .parallelism_config import ParallelismArgs
52
53
53
- from lighteval .config .lighteval_config import FullNanotronConfig , LightEvalConfig
54
+ from lighteval .config .lighteval_config import FullNanotronConfig , LightEvalConfig , LightEvalLoggingArgs , LightEvalTasksArgs
54
55
from lighteval .logging .evaluation_tracker import EvaluationTracker
55
- from lighteval .logging .hierarchical_logger import htrack_block
56
56
from lighteval .pipeline import ParallelismManager , Pipeline , PipelineParameters
57
57
from lighteval .utils .imports import NO_NANOTRON_ERROR_MSG , is_nanotron_available
58
58
from lighteval .utils .utils import EnvConfig
@@ -61,23 +61,38 @@ def nanotron(
61
61
62
62
if not is_nanotron_available ():
63
63
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
+ )
64
76
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 :
79
79
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 )
81
96
82
97
evaluation_tracker = EvaluationTracker (
83
98
output_dir = lighteval_config .logging .output_dir ,
0 commit comments