99
1010@dataclass
1111class CepoConfig :
12- bestofn_n : int = 3
13- bestofn_temperature : float = 0.1
14- bestofn_max_tokens : int = 4096
15- bestofn_rating_type : Literal ["absolute" , "pairwise" ] = "absolute"
16- planning_n : int = 3
17- planning_m : int = 6
18- planning_temperature_step1 : float = 0.55
19- planning_temperature_step2 : float = 0.25
20- planning_temperature_step3 : float = 0.1
21- planning_temperature_step4 : float = 0
22- planning_max_tokens_step1 : int = 4096
23- planning_max_tokens_step2 : int = 4096
24- planning_max_tokens_step3 : int = 4096
25- planning_max_tokens_step4 : int = 4096
12+ bestofn_n : int
13+ bestofn_temperature : float
14+ bestofn_max_tokens : int
15+ bestofn_rating_type : Literal ["absolute" , "pairwise" ]
16+ planning_n : int
17+ planning_m : int
18+ planning_temperature_step1 : float
19+ planning_temperature_step2 : float
20+ planning_temperature_step3 : float
21+ planning_temperature_step4 : float
22+ planning_max_tokens_step1 : int
23+ planning_max_tokens_step2 : int
24+ planning_max_tokens_step3 : int
25+ planning_max_tokens_step4 : int
2626
2727
2828# given command line arguments which includes a yaml file path, initialize a CePO configuration
@@ -40,27 +40,9 @@ def init_cepo_config(cmd_line_args: dict) -> CepoConfig:
4040 with open (cmd_line_args ["cepo_config_file" ], "r" ) as yaml_file :
4141 cepo_config_yaml = yaml .safe_load (yaml_file )
4242
43- # check if any of the keys overlap, and if they do, error out
44- for key in cepo_config_yaml .keys ():
45- if key in cepo_args .keys ():
46- raise RuntimeError (f"Key { key } is found in both yaml file and command line arguments" )
47-
48- # if not, then we take both of them and add them to the cepo config
49- cepo_config = CepoConfig ()
50- cepo_attrs = [key for key , _ in cepo_config .__dict__ .items () if not key .startswith ('__' )]
51-
52- # add command line arguments
53- for key , value in cepo_args .items ():
54- # this assert should not be raised as the cli parser should catch this
55- assert key in cepo_attrs , f"Command line argument { key } is not found in CepoConfig"
56- setattr (cepo_config , key , value )
57-
58- # add yaml arguments
59- for key , value in cepo_config_yaml .items ():
60- assert key in cepo_attrs , f"Yaml argument { key } is not found in CepoConfig"
61- setattr (cepo_config , key , value )
62-
63- return cepo_config
43+ # merge cepo args from command line and yaml file, args from command line will overwrite the ones from yaml file
44+ cepo_args = {** cepo_config_yaml , ** cepo_args }
45+ return CepoConfig (** cepo_args )
6446
6547def extract_question_only (task : str ) -> str :
6648 """We noticed that sometimes if the task includes specific formatting instructions, they may interfere with the reasoning flow. This
0 commit comments