Skip to content

Commit 1bd678e

Browse files
committed
done
1 parent b4a03e6 commit 1bd678e

File tree

1 file changed

+0
-8
lines changed

1 file changed

+0
-8
lines changed

tests/teleprompt/test_bootstrap_finetune.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
# Define a simple metric function for testing
99
def simple_metric(example, prediction, trace=None):
10-
# Simplified metric for testing: true if prediction matches expected output
1110
return example.output == prediction.output
1211

1312

@@ -41,20 +40,15 @@ def test_compile_with_predict_instances_no_explicit_lm():
4140
from unittest.mock import patch
4241

4342
# Create student and teacher modules without explicit LMs in predictors
44-
# This tests the fix: lm = pred.lm or settings.lm
4543
student = SimpleModule("input -> output")
4644
teacher = SimpleModule("input -> output")
4745

48-
# Set up LM in settings - this will be the fallback
4946
lm = DummyLM(["Initial thoughts", "Finish[blue]"])
5047
original_lm = dspy.settings.lm
5148
dspy.settings.configure(lm=lm)
5249

53-
5450
# Verify that the predictor doesn't have an explicit LM
5551
assert student.predictor.lm is None
56-
57-
# Initialize BootstrapFinetune - this should work without AttributeError
5852
bootstrap = BootstrapFinetune(metric=simple_metric)
5953

6054
# Mock all the components that would fail without proper setup
@@ -64,14 +58,12 @@ def test_compile_with_predict_instances_no_explicit_lm():
6458
patch.object(bootstrap, '_prepare_finetune_data', return_value=([], 'openai')), \
6559
patch.object(bootstrap, 'finetune_lms') as mock_finetune_lms:
6660

67-
# Mock the finetune_lms to return a mapping from training key to LM
6861
mock_finetune_lms.return_value = {(lm, None): lm}
6962

7063
# This should not raise AttributeError due to the fix
7164
compiled_student = bootstrap.compile(student, teacher=teacher, trainset=trainset)
7265

7366
assert compiled_student is not None, "Failed to compile student"
74-
# Verify that finetune_lms was called
7567
mock_finetune_lms.assert_called_once()
7668

7769

0 commit comments

Comments
 (0)