Skip to content
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

fix: Evaluations no longer associate incorrect inputs with predictions #2676

Merged
merged 2 commits into from
Oct 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions tests/trace/test_evaluations.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,19 @@ def is_op_ref_with_name(val: Any, name: str):
expected_predict_ref = model_obj.val["predict"]
assert is_op_ref_with_name(expected_predict_ref, "MyModel.predict")

predict_and_score_calls = [
c
for (c, d) in flattened_calls
if op_name_from_ref(c.op_name) == "Evaluation.predict_and_score"
]
assert len(predict_and_score_calls) == 3

# Assert that all the inputs are unique
inputs = set()
for call in predict_and_score_calls:
inputs.add(call.inputs["example"])
assert len(inputs) == 3


@weave.op
def gpt_mocker(question: str):
Expand Down
2 changes: 1 addition & 1 deletion weave/trace/vals.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ def _local_iter_with_remote_fallback(self) -> Generator[dict, None, None]:

for ndx, row in enumerate(self._prefetched_rows):
next_id_future = wc.future_executor.defer(
lambda: cached_table_ref.row_digests[ndx]
lambda ndx_closure=ndx: cached_table_ref.row_digests[ndx_closure]
)
new_ref = self.ref.with_item(next_id_future)
val = self._prefetched_rows[ndx]
Expand Down
Loading