Skip to content

transform method handle a single document with provided embedidngs#2043

Open
1jamesthompson1 wants to merge 1 commit intoMaartenGr:masterfrom
1jamesthompson1:make_transform_arguements_more_flexible
Open

transform method handle a single document with provided embedidngs#2043
1jamesthompson1 wants to merge 1 commit intoMaartenGr:masterfrom
1jamesthompson1:make_transform_arguements_more_flexible

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