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

transform method handle a single document with provided embedidngs #2043

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

1jamesthompson1
Copy link

This PR is as discussed here: #2018

I added some tests just for some sanity checks. Looking at what tests you have it seems you would'nt want them moving forward?

Comment on lines +504 to +505
if len(documents) == 1 and isinstance(embeddings, np.ndarray) and embeddings.ndim == 1:
embeddings = embeddings.reshape(1,-1)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The embeddings that you can pass to .transform is typed as np.ndarray which is actually quite misleading (sorry!) as it can technically take the form of any iterable (but mostly just np.ndarray-like structures, such as a scipy sparse matrix). As such, doing something like embeddings.ndim == 1 might break here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants