Closed Huanyongji closed 1 year ago
指定模型路径为下载后的绝对路径。
from torch.hub import _get_torch_home
_get_torch_home()
'/root/.cache/torch'
from langchain.embeddings import HuggingFaceInstructEmbeddings
instructor_embeddings = HuggingFaceInstructEmbeddings(model_name="/root/.cache/torch/sentence_transformers/GanymedeNil_text2vec-large-chinese",
# local_files_only=True,
model_kwargs={"device": "cuda"})
Sources: https://api.python.langchain.com/en/latest/_modules/langchain/embeddings/huggingface.html#HuggingFaceInstructEmbeddings https://github.com/UKPLab/sentence-transformers/blob/master/sentence_transformers/SentenceTransformer.py
Describe the Question
如题,下载的模型如何在不联网的情况下使用呢?我现在已经把模型下载到本地,但是加载模型的时候要进行联网操作,机器又没法联网,请问这块该怎么解决呢?谢谢