Skip to content

Commit a4612e7

Browse files
committed
review comments
Signed-off-by: Roni Friedman-Melamed <[email protected]>
1 parent 495f62d commit a4612e7

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

src/instructlab/eval/unitxt.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class UnitxtEvaluator(MMLUBranchEvaluator):
2929
An evaluator class, running Unitxt evaluation
3030
3131
Attributes:
32-
model_path absolute path to or name of a huggingface model
32+
model_path Absolute path to or name of a huggingface model
3333
unitxt_recipe unitxt recipe (see unitxt.ai for more information)
3434
A Recipe holds a complete specification of a unitxt pipeline
3535
Example: card=cards.wnli,template=templates.classification.multi_class.relation.default,max_train_instances=5,loader_limit=20,num_demos=3,demos_pool_size=10
@@ -71,16 +71,20 @@ def remove_unitxt_files(self):
7171
shutil.rmtree(self.tasks_dir)
7272
else:
7373
logger.warning(
74-
"unitxt tasks dir did not start with '%s' and therefor was not deleted",
74+
"unitxt tasks dir '%s' did not start with '%s' prefix and therefore was not deleted",
75+
self.tasks_dir,
7576
TEMP_DIR_PREFIX,
7677
)
7778

7879
def run(self, server_url: str | None = None) -> tuple:
7980
"""
8081
Runs evaluation
8182
83+
Attributes:
84+
server_url(str|None) Model server endpoint (Ex: http://localhost:8000/v1) for the model being evaluated
85+
8286
Returns:
83-
overall_scores Average scores for the task group
87+
overall_scores Average scores for the task group
8488
individual_scores Individual scores for each task in the task group
8589
"""
8690
self.prepare_unitxt_files()
@@ -111,8 +115,8 @@ def run(self, server_url: str | None = None) -> tuple:
111115
return global_scores, instance_scores
112116

113117

114-
def create_unitxt_yaml(yaml_file, unitxt_recipe, task_name):
115-
data = {"task": f"{task_name}", "include": "unitxt", "recipe": f"{unitxt_recipe}"}
118+
def create_unitxt_yaml(yaml_file: str, unitxt_recipe: str, task_name: str) -> None:
119+
data = {"task": task_name, "include": "unitxt", "recipe": unitxt_recipe}
116120
with open(yaml_file, "w", encoding="utf-8") as file:
117121
yaml.dump(data, file, default_flow_style=False)
118122
logger.debug("task %s unitxt recipe written to %s", task_name, yaml_file)

tests/test_unitxt.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ def test_unitxt():
99
unitxt_recipe = "card=cards.wnli,template=templates.classification.multi_class.relation.default,max_train_instances=5,loader_limit=20,num_demos=3,demos_pool_size=10"
1010
unitxt = UnitxtEvaluator(model_path=model_path, unitxt_recipe=unitxt_recipe)
1111
overall_score, single_scores = unitxt.run()
12-
print(overall_score)
12+
print(f"Overall scores: {overall_score}")
1313
sample_score = "f1_micro,none"
1414
assert sample_score in overall_score
1515
assert overall_score[sample_score] > 0

0 commit comments

Comments
 (0)