SelfHostedHuggingFaceInstructEmbeddings(
self,
**kwargs: Any = {},
)Keyword arguments to pass to the model load function.
Inference function to extract the embeddings.
Remote hardware to send the inference function to.
Function to load the model remotely on the server.
Keyword arguments to pass to the model load function.
Allow deserialization using pickle which can be dangerous if
HuggingFace InstructEmbedding models on self-hosted remote hardware.
Supported hardware includes auto-launched instances on AWS, GCP, Azure, and Lambda, as well as servers specified by IP address and SSH credentials (such as on-prem, or another cloud like Paperspace, Coreweave, etc.).
To use, you should have the runhouse python package installed.
Example:
.. code-block:: python
from langchain_community.embeddings import SelfHostedHuggingFaceInstructEmbeddings import runhouse as rh model_name = "hkunlp/instructor-large" gpu = rh.cluster(name='rh-a10x', instance_type='A100:1') hf = SelfHostedHuggingFaceInstructEmbeddings( model_name=model_name, hardware=gpu)