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

[Bug] Missing documentation on creation of ndarray for serialization #245

Open
2 tasks done
SID262000 opened this issue Aug 2, 2023 · 3 comments
Open
2 tasks done
Labels
bug Something isn't working

Comments

@SID262000
Copy link

Is this a new bug?

  • I believe this is a new bug
  • I have searched the existing issues, and I could not find an existing issue for this bug

Current Behavior

The below line of code throws an error Type Error expected ndarray for serialization.

embeddings = model.encode(sentences)
embeddings.shape

Expected Behavior

We simply need to convert the model encoding to a list, which will resolve the above array.

Steps To Reproduce

Modify embeddings = model.encode(sentences) to embeddings = model.encode(sentences).tolist()

Relevant log output

No response

Environment

- **OS**:
- **Language version**:
- **Pinecone client version**:

Additional Context

Here's the link to the page which references the above issue: https://www.pinecone.io/learn/series/nlp/dense-vector-embeddings-nlp/

I'm happy to work on this issue and update the documentation as well, feel free to assign it to me

@SID262000 SID262000 added the bug Something isn't working label Aug 2, 2023
@SID262000
Copy link
Author

Cc @jamescalam for review, Thanks

@jamescalam
Copy link
Collaborator

hey @SID262000 — I don't know what exactly is causing the issue here. Performing model.encode(sentences) (assuming sentences is a normal python list) should work — and it would output a numpy array, which allows us to do embeddings.shape as shown. Maybe there is something wrong with the sentences data type here?

@SID262000
Copy link
Author

Hi @jamescalam,
sentences in the above context is a list of strings

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

No branches or pull requests

2 participants