Skip to content

Commit e87ca03

Browse files
authored
Merge pull request #180 from SinclairHudson/metrics-rename
renaming metrics from tests to metrics
2 parents 4a20cb2 + 8a192c3 commit e87ca03

File tree

10 files changed

+17
-11
lines changed

10 files changed

+17
-11
lines changed

CONTRIBUTING.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ pip install -e .
6565

6666
1. Use `ruff check --fix` to check and fix lint errors
6767
2. Use `ruff format` to apply formatting
68+
3. Run `pytest` at the top level directory to run unit tests
6869

6970
NOTE: Ruff linting and formatting checks are done when PR is raised via Git Action. Before raising a PR, it is a good practice to check and fix lint errors, as well as apply formatting.
7071

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ lora:
157157

158158
```yaml
159159
qa:
160-
llm_tests:
160+
llm_metrics:
161161
- length_test
162162
- word_overlap_test
163163
```

llmtune/cli/toolkit.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,12 @@ def run_one_experiment(config: Config, config_path: Path) -> None:
8686
else:
8787
RichUI.results_found(results_path)
8888

89+
# Quality Assurance -------------------------
8990
RichUI.before_qa()
9091
qa_file_path = dir_helper.save_paths.qa_file
9192
if not qa_file_path.exists():
92-
llm_tests = config.qa.llm_tests
93-
tests = QaTestRegistry.create_tests_from_list(llm_tests)
93+
llm_metrics = config.qa.llm_metrics
94+
tests = QaTestRegistry.create_tests_from_list(llm_metrics)
9495
test_suite = LLMTestSuite.from_csv(results_file_path, tests)
9596
test_suite.save_test_results(qa_file_path)
9697
test_suite.print_test_results()

llmtune/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ inference:
7777
temperature: 0.8
7878

7979
qa:
80-
llm_tests:
80+
llm_metrics:
8181
- jaccard_similarity
8282
- dot_product
8383
- rouge_score

llmtune/pydantic_models/config_model.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010

1111
class QaConfig(BaseModel):
12-
llm_tests: Optional[List[str]] = Field([], description="list of tests that needs to be connected")
12+
llm_metrics: Optional[List[str]] = Field([], description="list of metrics that needs to be connected")
1313

1414

1515
class DataConfig(BaseModel):

llmtune/qa/generics.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ def print_test_results(self):
7070
median_values = {key: statistics.median(column_data[key]) for key in column_data}
7171
stdev_values = {key: statistics.stdev(column_data[key]) for key in column_data}
7272
# Use the RichUI class to display the table
73-
RichUI.qa_display_table(result_dictionary, mean_values, median_values, stdev_values)
73+
RichUI.qa_display_metric_table(result_dictionary, mean_values, median_values, stdev_values)
7474

7575
def save_test_results(self, path: str):
7676
# TODO: save these!

llmtune/ui/generics.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,5 +112,5 @@ def qa_found(cls):
112112
pass
113113

114114
@abstractstaticmethod
115-
def qa_display_table(cls):
115+
def qa_display_metric_table(cls):
116116
pass

llmtune/ui/rich_ui.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,9 +182,9 @@ def qa_found():
182182
pass
183183

184184
@staticmethod
185-
def qa_display_table(result_dictionary, mean_values, median_values, stdev_values):
185+
def qa_display_metric_table(result_dictionary, mean_values, median_values, stdev_values):
186186
# Create a table
187-
table = Table(show_header=True, header_style="bold", title="Test Results")
187+
table = Table(show_header=True, header_style="bold", title="Test Set Metric Results")
188188

189189
# Add columns to the table
190190
table.add_column("Metric", style="cyan")

test_utils/test_config.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
"""
2+
Defines a configuration that can be used for unit testing.
3+
"""
4+
15
from llmtune.pydantic_models.config_model import (
26
AblationConfig,
37
BitsAndBytesConfig,
@@ -72,7 +76,7 @@ def get_sample_config():
7276
train_test_split_seed=42,
7377
),
7478
qa=QaConfig(
75-
llm_tests=[
79+
llm_metrics=[
7680
"jaccard_similarity",
7781
"dot_product",
7882
"rouge_score",

tests/qa/test_generics.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def test_save_test_results(mock_csv, mock_tests, mocker):
6060
# def test_print_test_results(mock_csv, mock_tests, mock_rich_ui):
6161
# test_suite = LLMTestSuite.from_csv("dummy_path.csv", mock_tests)
6262
# test_suite.print_test_results()
63-
# assert mock_rich_ui.qa_display_table.called
63+
# assert mock_rich_ui.qa_display_metric_table.called
6464

6565

6666
def test_print_test_results(capfd, example_data):

0 commit comments

Comments
 (0)