You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description
-----------
This PR introduces two minor updates:
- We want the users to use the `wandb.init` as context manager pattern,
- The `WandbDSPyCallback` can take in the `run` object or it defaults to
the global `wandb.run`.
This minor update is part of this PR:
wandb/wandb#10327 and should be merged once the
said PR is merged.
<!-- preview-links-comment -->
📄 **[View preview links for changed
pages](#1588 (comment)
---------
Co-authored-by: John Mulhausen <john.mulhausen@wandb.com>
program = dspy.ChainOfThought("question -> answer")
108
+
109
+
# Configure and run optimizer
110
+
optimizer = dspy.MIPROv2(
111
+
metric=dataset.metric,
112
+
auto="light",
113
+
num_threads=24,
114
+
teacher_settings=dict(lm=teacher_lm),
115
+
prompt_model=student_lm
116
+
)
117
+
118
+
optimized_program = optimizer.compile(
119
+
program,
120
+
trainset=dataset.train,
121
+
max_bootstrapped_demos=2,
122
+
max_labeled_demos=2
123
+
)
123
124
```
124
125
125
126
After running this code, you receive both a W&B Run URL and a Weave URL. W&B displays evaluation metrics over time, along with Tables that show the evolution of program signatures. The run's **Overview** tab includes links to Weave traces for detailed inspection.
126
127
128
+
If a `run` object is not passed to `WandbDSPyCallback`, the global `run` object is used.
129
+
127
130
{{< img src="/images/integrations/dspy_run_page.png" alt="DSPy optimization run in W&B" >}}
128
131
129
132
For comprehensive details about Weave tracing, evaluation, and optimization with DSPy, see the [Weave DSPy integration guide](https://weave-docs.wandb.ai/guides/integrations/dspy).
0 commit comments