Skip to content

Commit c58c733

Browse files
revert patch safely (#8696)
1 parent 6401569 commit c58c733

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

dspy/teleprompt/bootstrap_trace.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,10 @@ def patched_forward(program_to_use: Module, **kwargs):
107107

108108
program.forward = MethodType(patched_forward, program)
109109

110-
results = evaluator(program, metric=wrapped_metric).results
110+
try:
111+
results = evaluator(program, metric=wrapped_metric).results
112+
finally:
113+
program.forward = original_forward
111114

112115
data = []
113116
for example_ind, (example, prediction, score) in enumerate(results):

0 commit comments

Comments
 (0)