Files
langchain/docs/modules/models/text_embedding/examples/modelscope_hub.ipynb
T
11c26ebb55 Harrison/modelscope (#5156)
Co-authored-by: thomas-yanxin <yx20001210@163.com>
Co-authored-by: Dev 2049 <dev.dev2049@gmail.com>
2023-05-24 08:06:45 -07:00

1.5 KiB

ModelScope

Let's load the ModelScope Embedding class.

In [ ]:
from langchain.embeddings import ModelScopeEmbeddings
In [ ]:
model_id = "damo/nlp_corom_sentence-embedding_english-base"
In [ ]:
embeddings = ModelScopeEmbeddings(model_id=model_id)
In [ ]:
text = "This is a test document."
In [ ]:
query_result = embeddings.embed_query(text)
In [ ]:
doc_results = embeddings.embed_documents(["foo"])