Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

cannot import name 'HuggingFaceEmbedding' from 'llama_index.embeddings' (unknown location) #1079

Closed
barmajahssr opened this issue Mar 2, 2024 · 6 comments

Comments

@barmajahssr
Copy link

really spent hours struggling with this issue. installing reinstalling, upgrading lamaindex,hugginface. it still throws this error when running memgpt: 🧬 Creating new agent...
-> 🤖 Using persona profile 'sam_pov'
-> 🧑 Using human profile 'basic'
Traceback (most recent call last):
File "/home/iiiymem/memgpt/memgptvenv/bin/memgpt", line 8, in
sys.exit(app())
^^^^^
File "/home/iiiymem/memgpt/memgptvenv/lib/python3.11/site-packages/typer/main.py", line 328, in call
raise e
File "/home/iiiymem/memgpt/memgptvenv/lib/python3.11/site-packages/typer/main.py", line 311, in call
return get_command(self)(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/iiiymem/memgpt/memgptvenv/lib/python3.11/site-packages/click/core.py", line 1157, in call
return self.main(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/iiiymem/memgpt/memgptvenv/lib/python3.11/site-packages/typer/core.py", line 778, in main
return _main(
^^^^^^
File "/home/iiiymem/memgpt/memgptvenv/lib/python3.11/site-packages/typer/core.py", line 216, in _main
rv = self.invoke(ctx)
^^^^^^^^^^^^^^^^
File "/home/iiiymem/memgpt/memgptvenv/lib/python3.11/site-packages/click/core.py", line 1688, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/iiiymem/memgpt/memgptvenv/lib/python3.11/site-packages/click/core.py", line 1434, in invoke
return ctx.invoke(self.callback, **ctx.params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/iiiymem/memgpt/memgptvenv/lib/python3.11/site-packages/click/core.py", line 783, in invoke
return __callback(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/iiiymem/memgpt/memgptvenv/lib/python3.11/site-packages/typer/main.py", line 683, in wrapper
return callback(**use_params) # type: ignore
^^^^^^^^^^^^^^^^^^^^^^
File "/home/iiiymem/memgpt/memgptvenv/lib/python3.11/site-packages/memgpt/cli/cli.py", line 668, in run
memgpt_agent = Agent(
^^^^^^
File "/home/iiiymem/memgpt/memgptvenv/lib/python3.11/site-packages/memgpt/agent.py", line 258, in init
self.persistence_manager = LocalStateManager(agent_state=self.agent_state)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/iiiymem/memgpt/memgptvenv/lib/python3.11/site-packages/memgpt/persistence_manager.py", line 56, in init
self.archival_memory = EmbeddingArchivalMemory(agent_state)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/iiiymem/memgpt/memgptvenv/lib/python3.11/site-packages/memgpt/memory.py", line 373, in init
self.embed_model = embedding_model(agent_state.embedding_config)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/iiiymem/memgpt/memgptvenv/lib/python3.11/site-packages/memgpt/embeddings.py", line 182, in embedding_model
return default_embedding_model()
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/iiiymem/memgpt/memgptvenv/lib/python3.11/site-packages/memgpt/embeddings.py", line 137, in default_embedding_model
from llama_index.embeddings import HuggingFaceEmbedding
ImportError: cannot import name 'HuggingFaceEmbedding' from 'llama_index.embeddings' (unknown location)

@quantumalchemy
Copy link

getting same on the 0.3.4 upgrade -- trying the pymemgpt[local]l embedding now that the : embeddings.memgpt.ai
is showing: ' error: inputs must have less than 512 tokens. ' So we are boxed out on any use of documents

@thefux
Copy link
Contributor

thefux commented Mar 3, 2024

to work around, for those who use the github repo:

pip install llama-index-embeddings-huggingface

and then replace the import as below:
from llama_index.embeddings import HuggingFaceEmbedding -> from llama_index.embeddings.huggingface import HuggingFaceEmbedding
this fixed the issue, for me at least

@Damian666
Copy link

same error for me, but happens when i try to run with persona and human

@quantumalchemy
Copy link

quantumalchemy commented Mar 4, 2024

to work around, for those who use the github repo:

pip install llama-index-embeddings-huggingface

and then replace the import as below: from llama_index.embeddings import HuggingFaceEmbedding -> from llama_index.embeddings.huggingface import HuggingFaceEmbedding this fixed the issue, for me at least

did you want to initiate a pull with that fix ?

@thefux
Copy link
Contributor

thefux commented Mar 4, 2024

to work around, for those who use the github repo:
pip install llama-index-embeddings-huggingface
and then replace the import as below: from llama_index.embeddings import HuggingFaceEmbedding -> from llama_index.embeddings.huggingface import HuggingFaceEmbedding this fixed the issue, for me at least

did you want to initiate a pull with that fix ?

yeah sure, will push later

@sarahwooders
Copy link
Collaborator

Closing since #1087 is merged, but please re-open if you keep having this issue!

@github-project-automation github-project-automation bot moved this from To triage to Done in 🐛 MemGPT issue tracker Mar 6, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants