Skip to content

armgit / dspy

Public Imported from GitHub
0

DSPy: The framework for programming—not prompting—language models

Python

revert patch safely (#8696)

Chen Qianc58c733bd8e0
diff --git a/dspy/teleprompt/bootstrap_trace.py b/dspy/teleprompt/bootstrap_trace.py
index d3c81db4a..9f1eff5db 100644
--- a/dspy/teleprompt/bootstrap_trace.py
+++ b/dspy/teleprompt/bootstrap_trace.py
@@ -107,7 +107,10 @@ def bootstrap_trace_data(
program.forward = MethodType(patched_forward, program)
- results = evaluator(program, metric=wrapped_metric).results
+ try:
+ results = evaluator(program, metric=wrapped_metric).results
+ finally:
+ program.forward = original_forward
data = []
for example_ind, (example, prediction, score) in enumerate(results):