Skip to content

Commit

Permalink
Update from scorer to scorers dir, small tidy ups
Browse files Browse the repository at this point in the history
  • Loading branch information
morganmcg1 committed Oct 12, 2024
1 parent 831db85 commit a4920cf
Show file tree
Hide file tree
Showing 22 changed files with 25 additions and 7 deletions.
2 changes: 1 addition & 1 deletion examples/text-extract/evaluate.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import openai

import weave
from weave.flow.scorer import MultiTaskBinaryClassificationF1
from weave.scorers import MultiTaskBinaryClassificationF1


class TextExtractModel(weave.Model):
Expand Down
2 changes: 1 addition & 1 deletion examples/tutorial_scripts/05_eval_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ async def predict(self, sentence: str) -> dict:
]

import weave
from weave.flow.scorer import MultiTaskBinaryClassificationF1
from weave.scorers import MultiTaskBinaryClassificationF1


@weave.op()
Expand Down
2 changes: 1 addition & 1 deletion examples/tutorial_scripts/06_eval_pipeline_all.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import openai

import weave
from weave.flow.scorer import MultiTaskBinaryClassificationF1
from weave.scorers import MultiTaskBinaryClassificationF1

# We create a model class with one predict function.
# All inputs, predictions and parameters are automatically captured for easy inspection.
Expand Down
2 changes: 1 addition & 1 deletion tests/trace/test_evaluate.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import weave
from weave import Dataset, Evaluation, Model
from weave.flow.scorer import MultiTaskBinaryClassificationF1
from weave.scorers import MultiTaskBinaryClassificationF1

dataset_rows = [{"input": "1 + 2", "target": 3}, {"input": "2**4", "target": 15}]
dataset = Dataset(rows=dataset_rows)
Expand Down
2 changes: 1 addition & 1 deletion tests/trace/test_evaluations.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import weave
from tests.trace.util import AnyIntMatcher
from weave import Evaluation, Model
from weave.flow.scorer import Scorer
from weave.scorers import Scorer
from weave.trace_server import trace_server_interface as tsi


Expand Down
14 changes: 14 additions & 0 deletions weave/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,20 @@
from weave.trace.util import Thread as Thread
from weave.trace.util import ThreadPoolExecutor as ThreadPoolExecutor

from typing import TYPE_CHECKING

# Helper for IDEs
if TYPE_CHECKING:
from weave.flow import scorers

# Lazy import for the scorers module
def __getattr__(name):
if name == "scorers":
from weave.flow import scorers
globals()["scorers"] = scorers
return scorers
raise AttributeError(f"module {__name__} has no attribute {name}")

# Special object informing doc generation tooling which symbols
# to document & to associate with this module.
__docspec__ = [
Expand Down
2 changes: 1 addition & 1 deletion weave/flow/eval.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from weave.flow.dataset import Dataset
from weave.flow.model import Model, get_infer_method
from weave.flow.obj import Object
from weave.flow.scorer import (
from weave.scorers import (
Scorer,
auto_summarize,
get_scorer_attributes,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
from weave.flow.scorer.base_scorer import Scorer, auto_summarize, get_scorer_attributes
from weave.flow.scorer.base_scorer import (
Scorer,
auto_summarize,
get_scorer_attributes,
)
from weave.flow.scorer.classification_scorer import (
MultiTaskBinaryClassificationF1,
transpose,
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit a4920cf

Please sign in to comment.