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

2 commits: 1 bad, 1 good #569

Merged
Merged
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
24 changes: 16 additions & 8 deletions dspy/evaluate/evaluate.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
import threading
import types
import dsp

import tqdm
import pandas as pd
import tqdm

import threading
import dsp

try:
from IPython.display import HTML
from IPython.display import display as ipython_display
except ImportError:
ipython_display = print
def HTML(x): return x

def HTML(x):
return x


from concurrent.futures import ThreadPoolExecutor, as_completed

from dsp.evaluation.utils import *
Expand Down Expand Up @@ -127,7 +131,8 @@ def wrapped_program(example_idx, example):
try:
prediction = program(**example.inputs())
score = metric(
example, prediction
example,
prediction,
) # FIXME: TODO: What's the right order? Maybe force name-based kwargs!

# increment assert and suggest failures to program's attributes
Expand Down Expand Up @@ -156,7 +161,10 @@ def wrapped_program(example_idx, example):
wrapped_program, devset, display_progress)
else:
reordered_devset, ncorrect, ntotal = self._execute_multi_thread(
wrapped_program, devset, num_threads, display_progress
wrapped_program,
devset,
num_threads,
display_progress,
)
if return_outputs: # Handle the return_outputs logic
results = [(example, prediction, score)
Expand Down Expand Up @@ -260,14 +268,14 @@ def configure_dataframe_display(df, metric_name):
[
{"selector": "th", "props": [("text-align", "left")]},
{"selector": "td", "props": [("text-align", "left")]},
]
],
).set_properties(
**{
"text-align": "left",
"white-space": "pre-wrap",
"word-wrap": "break-word",
"max-width": "400px",
}
},
)


Expand Down
Loading