-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
df82bf2
commit a8f00a9
Showing
6 changed files
with
93 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
name: check_metrics | ||
|
||
on: | ||
push: | ||
branches: | ||
- dev | ||
- master | ||
- test/** | ||
pull_request: | ||
branches: | ||
- dev | ||
workflow_dispatch: | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: ${{ github.ref != 'refs/heads/dev' && github.ref != 'refs/heads/master' }} | ||
|
||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: set up python 3.9 | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: 3.9 | ||
|
||
- name: setup poetry and install dependencies | ||
run: | | ||
python -m pip install --upgrade pip poetry | ||
python -m poetry install --with lint --no-ansi --no-interaction | ||
- name: run metrics check | ||
run: | | ||
python -m poetry run poe metrics |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import json | ||
|
||
def _run_check(): | ||
with open("dev_packages/chatsky_llm_autoconfig/chatsky_llm_autoconfig/autometrics/results/results.json") as f: | ||
metrics_data = json.load(f) | ||
|
||
current_date = list(metrics_data.keys())[-1] | ||
current_metrics = metrics_data.get(current_date, {}) | ||
previous_date = list(metrics_data.keys())[-2] | ||
previous_metrics = metrics_data.get(previous_date, {}) | ||
|
||
differences = {} | ||
for algorithm, metrics in current_metrics.items(): | ||
if algorithm in previous_metrics: | ||
differences[algorithm] = { | ||
"all_paths_sampled_diff": metrics.get("all_paths_sampled_avg", 0) - previous_metrics[algorithm].get("all_paths_sampled_avg", 0), | ||
"all_utterances_present_diff": metrics.get("all_utterances_present_avg", 0) - previous_metrics[algorithm].get("all_utterances_present_avg", 0), | ||
"all_roles_correct_diff": metrics.get("all_roles_correct_avg", 0) - previous_metrics[algorithm].get("all_roles_correct_avg", 0), | ||
"is_correct_length_diff": metrics.get("is_correct_lenght_avg", 0) - previous_metrics[algorithm].get("is_correct_lenght_avg", 0), | ||
"total_diff": ( | ||
metrics.get("all_paths_sampled_avg", 0) + | ||
metrics.get("all_utterances_present_avg", 0) + | ||
metrics.get("all_roles_correct_avg", 0) + | ||
metrics.get("is_correct_lenght_avg", 0) | ||
) - ( | ||
previous_metrics[algorithm].get("all_paths_sampled_avg", 0) + | ||
previous_metrics[algorithm].get("all_utterances_present_avg", 0) + | ||
previous_metrics[algorithm].get("all_roles_correct_avg", 0) + | ||
previous_metrics[algorithm].get("is_correct_lenght_avg", 0) | ||
) | ||
} | ||
|
||
for algorithm, diff in differences.items(): | ||
print(f"Algorithm: {algorithm}") | ||
print(f"Differences: {diff}") | ||
if diff["total_diff"] < 0: | ||
raise ValueError(f"Total difference for {algorithm} is negative: {diff['total_diff']}") | ||
|
||
print("Everything is fine.") |