源代码
from langchain_community.embeddings import ModelScopeEmbeddings
model_id = "damo/nlp_corom_sentence-embedding_chinese-base"
embeddings = ModelScopeEmbeddings(model_id=model_id)
查看报错代码
错误处
try:
from modelscope.pipelines import pipeline
from modelscope.utils.constant import Tasks
except ImportError as e:
raise ImportError(
"Could not import some python packages."
"Please install it with `pip install modelscope`."
) from e
将导包代码单独运行,那个模块没有就下载那个
from modelscope.pipelines import pipeline
from modelscope.utils.constant import Tasks
然后再到运行代码