OmniThink icon indicating copy to clipboard operation
OmniThink copied to clipboard

AttributeError: module 'dspy.dsp' has no attribute 'lm'

Open wuhang03 opened this issue 1 year ago • 8 comments

Thank you for your excellent work and clean code!

When I run the command sh run.sh, an error raises as below, which seems to be some attribute errors of dspy. I'd appreciate it a lot if you can give me some tips about how to solve this.

Thank you in advance for your assistance!

Traceback (most recent call last): File "<frozen runpy>", line 198, in _run_module_as_main File "<frozen runpy>", line 88, in _run_code File "/root/OmniThink/examples/gpt4o.py", line 4, in <module> from src.tools.lm import OpenAIModel_dashscope File "/root/OmniThink/src/__init__.py", line 3, in <module> from .actions import * File "/root/OmniThink/src/actions/__init__.py", line 1, in <module> from .article_generation import * File "/root/OmniThink/src/actions/article_generation.py", line 14, in <module> class ArticleGenerationModule(): File "/root/OmniThink/src/actions/article_generation.py", line 21, in ArticleGenerationModule article_gen_lm=Union[dspy.dsp.lm, dspy.dsp.HFModel], ^^^^^^^^^^^ AttributeError: module 'dspy.dsp' has no attribute 'lm'

wuhang03 avatar Feb 11 '25 02:02 wuhang03

It looks like there might be an issue with the version of your dspy library. Could you please check if dspy_ai is version 2.4.9?

XeeKee avatar Feb 11 '25 09:02 XeeKee

I also met this error. Here is my version

dspy                      2.6.2                    pypi_0    pypi 
dspy-ai                   2.4.9                    pypi_0    pypi

Z-ZHHH avatar Feb 12 '25 09:02 Z-ZHHH

I downgrade the dspy to 2.5.9. The error disappear, but

MindMap initialized
root : ERROR    : Error occurs when searching query 电影哪吒2: 'results'
root : WARNING  :       *** In DSPy 2.5, all LM clients except `dspy.LM` are deprecated. ***
                You are using the client QwenModel, which will be removed in DSPy 2.6.
                Changing the client is straightforward and will let you use new features (Adapters) that improve the consistency of LM outputs, especially when using chat LMs. 

                Learn more about the changes and how to migrate at
                https://github.com/stanfordnlp/dspy/blob/main/examples/migration.ipynb

Z-ZHHH avatar Feb 12 '25 09:02 Z-ZHHH

It seems that there may be an issue with your Search API. Could you please check if your search engine is functioning properly?

XeeKee avatar Feb 12 '25 09:02 XeeKee

ok

Z-ZHHH avatar Feb 13 '25 01:02 Z-ZHHH

We sincerely apologize for the inconvenience caused. We have now fixed the versions of the libraries that could affect our final results. If you encounter any version compatibility issues, please feel free to contact me promptly.

XeeKee avatar Feb 21 '25 17:02 XeeKee

hi, do you have any further questions?

zxlzr avatar Feb 22 '25 05:02 zxlzr

Thank you for your patient assistance. I have solved the problem and have no further questions.

wuhang03 avatar Feb 22 '25 06:02 wuhang03