File tree 1 file changed +5
-3
lines changed
1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change 20
20
21
21
logger = setup_logger (__name__ )
22
22
23
+ TEMP_DIR_PREFIX = 'unitxt_temp'
24
+
23
25
class UnitxtEvaluator (MMLUBranchEvaluator ):
24
26
"""
25
27
An evaluator class, running Unitxt evaluation
@@ -47,17 +49,17 @@ def __init__(
47
49
48
50
def prepare_unitxt_files (self , unitxt_recipe )-> tuple :
49
51
temp_task = str (uuid4 ())
50
- temp_tasks_dir = f'unitxt_temp_ { temp_task } '
52
+ temp_tasks_dir = f'{ TEMP_DIR_PREFIX } _ { temp_task } '
51
53
yaml_file = os .path .join (temp_tasks_dir ,f"{ temp_task } .yaml" )
52
54
create_unitxt_pointer (temp_tasks_dir )
53
55
create_unitxt_yaml (yaml_file = yaml_file , unitxt_recipe = unitxt_recipe , task_name = temp_task )
54
56
return temp_task ,temp_tasks_dir
55
57
56
58
def remove_temp_files (self ):
57
- if self .tasks_dir .startswith ('temp_' ): #to avoid unintended deletion if this class is inherited
59
+ if self .tasks_dir .startswith (TEMP_DIR_PREFIX ): #to avoid unintended deletion if this class is inherited
58
60
shutil .rmtree (self .tasks_dir )
59
61
else :
60
- logger .warning ("unitxt tasks dir did not start with 'temp_ ' and therefor was not deleted" )
62
+ logger .warning (f "unitxt tasks dir did not start with '{ TEMP_DIR_PREFIX } ' and therefor was not deleted" )
61
63
62
64
def run (self ,server_url : str | None = None ) -> tuple :
63
65
"""
You can’t perform that action at this time.
0 commit comments