Skip to content

Commit f966713

Browse files
committed
format
1 parent 1bd678e commit f966713

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

dspy/teleprompt/bootstrap_finetune.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ def compile(
8383
data_pred_ind = None if self.multitask else pred_ind
8484
lm = pred.lm or settings.lm
8585
training_key = (lm, data_pred_ind)
86-
86+
8787
if training_key not in key_to_data:
8888
train_data, data_format = self._prepare_finetune_data(
8989
trace_data=trace_data, lm=lm, pred_ind=data_pred_ind

tests/teleprompt/test_bootstrap_finetune.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def forward(self, **kwargs):
3838
def test_compile_with_predict_instances_no_explicit_lm():
3939
"""Test BootstrapFinetune compile with predictors that don't have explicit LMs."""
4040
from unittest.mock import patch
41-
41+
4242
# Create student and teacher modules without explicit LMs in predictors
4343
student = SimpleModule("input -> output")
4444
teacher = SimpleModule("input -> output")
@@ -50,20 +50,20 @@ def test_compile_with_predict_instances_no_explicit_lm():
5050
# Verify that the predictor doesn't have an explicit LM
5151
assert student.predictor.lm is None
5252
bootstrap = BootstrapFinetune(metric=simple_metric)
53-
53+
5454
# Mock all the components that would fail without proper setup
55-
with patch('dspy.teleprompt.bootstrap_finetune.all_predictors_have_lms'), \
56-
patch('dspy.teleprompt.bootstrap_finetune.prepare_teacher', return_value=teacher), \
57-
patch('dspy.teleprompt.bootstrap_finetune.bootstrap_trace_data', return_value=[]), \
58-
patch.object(bootstrap, '_prepare_finetune_data', return_value=([], 'openai')), \
59-
patch.object(bootstrap, 'finetune_lms') as mock_finetune_lms:
60-
55+
with patch("dspy.teleprompt.bootstrap_finetune.all_predictors_have_lms"), \
56+
patch("dspy.teleprompt.bootstrap_finetune.prepare_teacher", return_value=teacher), \
57+
patch("dspy.teleprompt.bootstrap_finetune.bootstrap_trace_data", return_value=[]), \
58+
patch.object(bootstrap, "_prepare_finetune_data", return_value=([], "openai")), \
59+
patch.object(bootstrap, "finetune_lms") as mock_finetune_lms:
60+
6161
mock_finetune_lms.return_value = {(lm, None): lm}
62-
62+
6363
# This should not raise AttributeError due to the fix
6464
compiled_student = bootstrap.compile(student, teacher=teacher, trainset=trainset)
65-
65+
6666
assert compiled_student is not None, "Failed to compile student"
6767
mock_finetune_lms.assert_called_once()
68-
68+
6969

0 commit comments

Comments
 (0)