SuperDuperDB / superduperdb

🔮 SuperDuperDB: Bring AI to your database! Build, deploy and manage any AI application directly with your existing data infrastructure, without moving your data. Including streaming inference, scalable model training and vector search.
https://superduperdb.com
Apache License 2.0
4.55k stars 445 forks source link

[DOC]: ImportError: cannot import name 'LLM' from 'superduperdb.ext.transformers' #2122

Closed YuriyGavrilov closed 2 weeks ago

YuriyGavrilov commented 1 month ago

What's wrong?

Hi

Trying to follow this https://docs.superduperdb.com/docs/reusable_snippets/build_llm with installation everything ok


pip install transformers datasets bitsandbytes accelerate
from superduperdb.ext.transformers import LLM

llm = LLM.from_pretrained("mistralai/Mistral-7B-Instruct-v0.2", load_in_8bit=True, device_map="cuda", identifier="llm", predict_kwargs=dict(max_new_tokens=128))        

but receiving this

Python 3.11.6 (main, Oct  2 2023, 13:45:54) [GCC 11.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from superduperdb.ext.transformers import LLM
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: cannot import name 'LLM' from 'superduperdb.ext.transformers' (/venv/lib/python3.11/site-packages/superduperdb/ext/transformers/__init__.py)

there is also error here: https://docs.superduperdb.com/docs/ai_integrations/transformers/


from superduperdb.ext.transformers import LLM
llm = LLM(model_name_or_path="facebook/opt-350m")
llm.predict_one("What are we having for dinner?")

>> from superduperdb.ext.transformers import LLM
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: cannot import name 'LLM' from 'superduperdb.ext.transformers' 

How could it be better?

Don't know yet

blythed commented 1 month ago

Hi @YuriyGavrilov - can you try from superduperdb.ext.transformers.model import LLM? We need to add this to the __init__.py of the subpackage.

YuriyGavrilov commented 1 month ago

Hi @YuriyGavrilov - can you try from superduperdb.ext.transformers.model import LLM? We need to add this to the __init__.py of the subpackage.

from superduperdb.ext.transformers.model import LLM Traceback (most recent call last): File "", line 1, in ImportError: cannot import name 'LLM' from 'superduperdb.ext.transformers.model'

Thx for helping but still not working

maybe I need to install somehow LLM?

jieguangzhou commented 1 month ago

@YuriyGavrilov Hi, which version of SuperDuperDB are you using? The documentation corresponds to the latest version 0.2, which will be released soon. After 0.2, we will support these new features.

YuriyGavrilov commented 1 month ago

@jieguangzhou thx, may be this is a reason. I am using same as default pip install set up, actually don't know but will check it today. Thanx for helping 🙏

jieguangzhou commented 1 month ago

@jieguangzhou thx, may be this is a reason. I am using same as default pip install set up, actually don't know but will check it today. Thanx for helping 🙏

Good! If there are any issues, please feel free to ping me and let me know.

YuriyGavrilov commented 1 month ago

used Version: 0.1.1 as pip install suggest.

fnikolai commented 1 month ago

Hi @YuriyGavrilov

As @jieguangzhou pointed out, the v0.2 will be officially released soon (hopefully in a couple of days).

After the release, you will be able to install v0.2 from pypi using pip install superduperdb.

Until then, you can install v0.2 directly from the repo.

git clone git@github.com:SuperDuperDB/superduperdb.git
cd superduperdb
pip install ./
YuriyGavrilov commented 1 month ago

@fnikolai thanks, will try to install

some interesting finding

ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
superduperdb 0.1.1 requires sqlalchemy>=2.0.28, but you have sqlalchemy 2.0.0 which is incompatible.
snowflake-sqlalchemy 1.5.3 requires sqlalchemy<2.0.0,>=1.4.19, but you have sqlalchemy 2.0.0 which is incompatible. 

will try to run without snowflake ...

git clone git@github.com:SuperDuperDB/superduperdb.git
git@github.com: Permission denied 

I will wait %)

fnikolai commented 1 month ago

Right.

The first problem is probably a side-effect from your previous superduperdb installation. try to do pip uninstall superduperdb and then repeat the steps.

The second problem is related to github requiring ssh to be configured from your side. You can try using https instead.

Overall:

pip uninstall superduperdb
git clone https://github.com/SuperDuperDB/superduperdb.git
cd superduperdb
pip install ./
blythed commented 2 weeks ago

Solved in main.