-
Notifications
You must be signed in to change notification settings - Fork 66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: implement funtions to retrieve metrics and examples #687
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor comment
finetuner/run.py
Outdated
def example_results(self) -> Dict: | ||
"""Get the results of example queries from the evaluation data of the | ||
:class:`Run`. | ||
|
||
:return: dictionary with results before and after fine-tuning. | ||
""" | ||
self._check_run_status_finished() | ||
return self._client.get_run_examples( | ||
experiment_name=self._experiment_name, run_name=self._name | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if we can make this function more user friendly, would be even better. For example, 2 colums compare, if it is image/mesh, try to display
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two small things
finetuner/console.py
Outdated
for i, match in enumerate(results[query]): | ||
if i >= k: | ||
break |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for i, match in enumerate(results[query]): | |
if i >= k: | |
break | |
for i, match in enumerate(results[query])[:k]: |
You can retrieve them with the {func}`~Run.example_results()` function. | ||
Alternatively, you can use the {func}`~Run.display_metrics()` function to display a table of the Top-K results before and after fine-tuning to the console. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe explain what K is in this context and how to set it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok I mention what Top-K means, how to set k
is explained in the developer documentation which you get when clicking on the link
### Show evaluation metrics | ||
|
||
During the fine-tuning process, the evaluation metrics are displayed in the logs, which you can retrieve via the {func}`~Run.logs()` function. | ||
After running the fine-tuning job has finished, the evaluation metrics can be retrieved from the cloud by calling the {func}`~Run.metrics()` function. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After running the fine-tuning job has finished, the evaluation metrics can be retrieved from the cloud by calling the {func}`~Run.metrics()` function. | |
After the fine-tuning job has finished, the evaluation metrics can be retrieved from the cloud by calling the {func}`~Run.metrics()` function. | |
If you want to compare the top-k retrieval results before and after fine-tuning, you can set the `gather_examples` parameter of the evaluation callback to `True`. | ||
In this case, the evaluation callback will store the top-k results for each query document before and after fine-tuning. | ||
You can retrieve them with the {func}`~Run.example_results()` function. | ||
Alternatively, you can use the {func}`~Run.display_metrics()` function to display a table of the Top-K results before and after fine-tuning to the console. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alternatively, you can use the {func}`~Run.display_metrics()` function to display a table of the Top-K results before and after fine-tuning to the console. | |
Alternatively, you can use the {func}`~Run.display_examples()` function to display a table of the Top-K results before and after fine-tuning to the console. | |
finetuner/run.py
Outdated
@@ -99,6 +99,45 @@ def stream_logs(self, interval: int = 5) -> Iterator[str]: | |||
experiment_name=self._experiment_name, run_name=self._name | |||
) | |||
|
|||
def metrics(self) -> Dict: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return type hint? Dict[str, float]
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no its Dicct[str, Dict[str, float]]
but yes I can add it
finetuner/run.py
Outdated
for stage in metrics: | ||
print_metrics(stage, metrics[stage]) | ||
|
||
def example_results(self) -> Dict: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
def example_results(self) -> Dict: | |
def example_results(self) -> Dict[str, str]: | |
```? |
📝 Docs are deployed on https://ft-feat-support-metrics-and-examples--jina-docs.netlify.app 🎉 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Implement functions to retrieve metrics and examples