dspy icon indicating copy to clipboard operation
dspy copied to clipboard

[Bug] GEPA cannot save DSPy programs created from base modules like Predict and ChainOfThought

Open LakshyAAAgrawal opened this issue 2 months ago • 3 comments

What happened?

Context:https://discord.com/channels/1161519468141355160/1161519642985111593/1423740373334888498

Steps to reproduce

N/A

DSPy version

3.0.4

LakshyAAAgrawal avatar Oct 06 '25 06:10 LakshyAAAgrawal

@LakshyAAAgrawal I also replied to the discord thread, but for GEPA optimization saving checkpoint to a json file is a better choice than pickle.

chenmoneygithub avatar Oct 07 '25 21:10 chenmoneygithub

I also have this problem. Trying to optimize a submodule of a program.

Edit: This helped work around:

GEPA(
    track_best_outputs=False,
)

heyalexchoi avatar Oct 15 '25 22:10 heyalexchoi

GEPA recently added support for cloudpickle, which should solve this issue. You can use it by `dspy.GEPA(..., gepa_kwargs={'use_cloudpickle': True}). Once this can be confirmed to work, I can enable it by default.

@chenmoneygithub, I am also happy to just use json based saving. One potential issue with that is the program class is still required, is that right?

LakshyAAAgrawal avatar Nov 09 '25 04:11 LakshyAAAgrawal