stanfordnlp / dspy

DSPy: The framework for programming—not prompting—language models
https://dspy.ai
MIT License
19.27k stars 1.47k forks source link

use_legacy_loading exception when loading model json file which is saved by #1634

Closed wangyiav closed 1 month ago

wangyiav commented 1 month ago

In train.py, saving model json file (dspy-ai 2.5.10): optimized_cot = teleprompter.compile(****) optimized_cot.save(new_model_file)

In llm.py, loading model json file (dspy-ai 2.5.10): cot= xxxxWithAssertions().activate_assertions() cot.load(new_model_file) Got exception here: e=Retrieve.load_state() got an unexpected keyword argument 'use_legacy_loading'

wangyiav commented 1 month ago

More information, I verified no this issue on dspy-ai 2.5.5 In train.py, saving model json file (dspy-ai 2.5.10): optimized_cot = teleprompter.compile(****) optimized_cot.save(new_model_file)

In llm.py, loading model json file (dspy-ai 2.5.5): cot= xxxxWithAssertions().activate_assertions() cot.load(new_model_file)

okhat commented 1 month ago

Thank you @wangyiav ! Adding @chenmoneygithub

chenmoneygithub commented 1 month ago

@wangyiav Thanks for reporting the issue! The error is because use_legacy_loading gets accidentally passed to dspy.Retrieve module. Let me fix it.