Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

AttributeError: 'HuggingFaceEmbedding' object has no attribute '_model' #53

Closed
JoepdeJong opened this issue May 18, 2024 · 2 comments · Fixed by #54
Closed

AttributeError: 'HuggingFaceEmbedding' object has no attribute '_model' #53

JoepdeJong opened this issue May 18, 2024 · 2 comments · Fixed by #54
Assignees
Labels
bug Something isn't working

Comments

@JoepdeJong
Copy link
Contributor

Due to recent updates in llama_index, the code breaks when using multiple workers (run-llama/llama_index#13497).

This can be temporary fixed by setting:

llama-index = "==0.10.30"
...
llama-index-core = "==0.10.30"

In the Pipfile.

@JoepdeJong JoepdeJong added the bug Something isn't working label May 18, 2024
@jonfairbanks jonfairbanks self-assigned this May 19, 2024
@jonfairbanks
Copy link
Owner

jonfairbanks commented May 19, 2024

Thanks for opening this. I'll also keep an eye on the bug thread as this was definitely working with values > 1 before the update.

@JoepdeJong
Copy link
Contributor Author

JoepdeJong commented May 20, 2024

I did some debugging. It seems that _model is missing the second time the VectorStoreIndex is used.

This index is initialized here:

index = create_index(_documents)

If you debug after this line, or print e.g. the following

print(hasattr(index._embed_model, "_model"))

you will see that the model is missing the second time: on file upload it exists, on chat, it isnt there.

It seems to be a problem in the caching:

@st.cache_data(show_spinner=False)

After removing @st.cache_data(show_spinner=False), it seems to work again.

Edit:
It is clearly the caching, even running

        index = create_index(_documents)
        print(
            hasattr(index._embed_model, "_model"),
        )
        index2 = create_index(_documents)
        print(
            hasattr(index2._embed_model, "_model"),
        )

loses the model attribute.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants