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

encoding_kwargs for InstructEmbeddings #5450

Merged
merged 1 commit into from
May 30, 2023
Merged

encoding_kwargs for InstructEmbeddings #5450

merged 1 commit into from
May 30, 2023

Conversation

Xmaster6y
Copy link
Contributor

@Xmaster6y Xmaster6y commented May 30, 2023

What does this PR do?

Bring support of encode_kwargs for HuggingFaceInstructEmbeddings, change the docstring example and add a test to illustrate with normalize_embeddings.

Fixes #3605
(Similar to #3914)

Use case:

from langchain.embeddings import HuggingFaceInstructEmbeddings

model_name = "hkunlp/instructor-large"
model_kwargs = {'device': 'cpu'}
encode_kwargs = {'normalize_embeddings': True}
hf = HuggingFaceInstructEmbeddings(
    model_name=model_name,
    model_kwargs=model_kwargs,
    encode_kwargs=encode_kwargs
)

Before submitting

  • Tests were added and passed
  • Actions are passed

Who can review?

Community members can review the PR once tests pass. Tag maintainers/contributors who might be interested:

Models

@dev2049 dev2049 added the lgtm PR looks good. Use to confirm that a PR is ready for merging. label May 30, 2023
@dev2049
Copy link
Contributor

dev2049 commented May 30, 2023

thanks @Xmaster6y!

@dev2049 dev2049 merged commit c1807d8 into langchain-ai:master May 30, 2023
vowelparrot pushed a commit that referenced this pull request May 31, 2023
# What does this PR do?

Bring support of `encode_kwargs` for ` HuggingFaceInstructEmbeddings`,
change the docstring example and add a test to illustrate with
`normalize_embeddings`.

Fixes #3605
(Similar to #3914)

Use case:
```python
from langchain.embeddings import HuggingFaceInstructEmbeddings

model_name = "hkunlp/instructor-large"
model_kwargs = {'device': 'cpu'}
encode_kwargs = {'normalize_embeddings': True}
hf = HuggingFaceInstructEmbeddings(
    model_name=model_name,
    model_kwargs=model_kwargs,
    encode_kwargs=encode_kwargs
)
```
@danielchalef danielchalef mentioned this pull request Jun 5, 2023
Undertone0809 pushed a commit to Undertone0809/langchain that referenced this pull request Jun 19, 2023
# What does this PR do?

Bring support of `encode_kwargs` for ` HuggingFaceInstructEmbeddings`,
change the docstring example and add a test to illustrate with
`normalize_embeddings`.

Fixes langchain-ai#3605
(Similar to langchain-ai#3914)

Use case:
```python
from langchain.embeddings import HuggingFaceInstructEmbeddings

model_name = "hkunlp/instructor-large"
model_kwargs = {'device': 'cpu'}
encode_kwargs = {'normalize_embeddings': True}
hf = HuggingFaceInstructEmbeddings(
    model_name=model_name,
    model_kwargs=model_kwargs,
    encode_kwargs=encode_kwargs
)
```
This was referenced Jun 25, 2023
@Xmaster6y Xmaster6y deleted the encode_kwargs branch February 9, 2024 19:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm PR looks good. Use to confirm that a PR is ready for merging.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Embeddings normalization and similarity metric
2 participants