From 1fe814f316f5e086808a3a08bb40b490fb854cc4 Mon Sep 17 00:00:00 2001 From: Xuechen Li <12689993+lxuechen@users.noreply.github.com> Date: Wed, 14 Jun 2023 21:31:14 -0700 Subject: [PATCH] fix import; resolves #46 (#47) * fix import issues. * bump version. --- src/alpaca_farm/__init__.py | 2 +- src/alpaca_farm/auto_annotations/__init__.py | 4 ++-- src/alpaca_farm/auto_annotations/eval.py | 10 ++++------ 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/alpaca_farm/__init__.py b/src/alpaca_farm/__init__.py index 57496add..c2abbeee 100644 --- a/src/alpaca_farm/__init__.py +++ b/src/alpaca_farm/__init__.py @@ -12,4 +12,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -__version__ = "0.1.4" +__version__ = "0.1.5" diff --git a/src/alpaca_farm/auto_annotations/__init__.py b/src/alpaca_farm/auto_annotations/__init__.py index 2c2a5a88..6362db4a 100644 --- a/src/alpaca_farm/auto_annotations/__init__.py +++ b/src/alpaca_farm/auto_annotations/__init__.py @@ -12,5 +12,5 @@ # See the License for the specific language governing permissions and # limitations under the License. -from .eval import * -from .pairwise_annotators import * +from .eval import alpaca_leaderboard +from .pairwise_annotators import PairwiseAutoAnnotator diff --git a/src/alpaca_farm/auto_annotations/eval.py b/src/alpaca_farm/auto_annotations/eval.py index 1772622d..3891a1a9 100644 --- a/src/alpaca_farm/auto_annotations/eval.py +++ b/src/alpaca_farm/auto_annotations/eval.py @@ -5,10 +5,8 @@ import datasets import pandas as pd -from alpaca_farm import constants -from alpaca_farm.auto_annotations import PairwiseAutoAnnotator -from alpaca_farm.auto_annotations.analysis import head2head_to_metrics - +from .. import constants +from . import analysis, pairwise_annotators from . import utils as ann_utils __all__ = ["alpaca_leaderboard"] @@ -133,9 +131,9 @@ def alpaca_leaderboard( We are computing the metrics on all examples you gave.""" ) - annotator = PairwiseAutoAnnotator(annotators_config=annotators_config, **kwargs) + annotator = pairwise_annotators.PairwiseAutoAnnotator(annotators_config=annotators_config, **kwargs) annotated = annotator.annotate_head2head(outputs_1=outputs_baseline, outputs_2=all_outputs) - all_metrics[name] = head2head_to_metrics(preferences=[a["preference"] for a in annotated]) + all_metrics[name] = analysis.head2head_to_metrics(preferences=[a["preference"] for a in annotated]) df_results = pd.DataFrame(all_metrics).T.sort_values(by="win_rate", ascending=False)