Closed panxiaohuan9 closed 10 months ago
Try running these codes to see if they work.
from sentence_transformers import SentenceTransformer
model = SentenceTransformer(model_name_or_path='../model/all-MiniLM-L12-v2')
@panxiaohuan9 hi I've just tried in linux and it works well:
Here are some suggestions:
../model/all-MiniLM-L12-v2
is valid in your linux.ops.sentence_embedding.sbert(model_name='../model/all-MiniLM-L12-v2').latest()
towhee 版本 1.1.1
It seems to be a network problem. Setting the environment variable TRANSFORMERS_OFFLINE=1 to use huggingface offline mode.
It seems to be a network problem. Setting the environment variable TRANSFORMERS_OFFLINE=1 to use huggingface offline mode.
The model_name parameter specifies the path to the locally downloaded model.
是本地模型路径
Do you have sbert folder under ~/.towhee/operators/sentence-embedding
?
没有找到,这个模型必须放到towhee/operators/这个路径吗?
No, you've checked the incorrect location. ~/.towhee
, which is usually under the user's home directory, is the towhee cache where operators are saved. An operator (e.g. ops.sentence_embedding.sbert) will be downloaded the first time you run it.
没有这个文件.towhee,使用ops方式,我在这个服务器上从来就没有下载模型成功过,都是网络错误
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. Rotten issues close after 30d of inactivity. Close the stale issues and pull requests after 7 days of inactivity. Reopen the issue with /reopen
.
Is there an existing issue for this?
Current Behavior
linux系统中将模型修改为本地下载好的模型,模型加载失败,同样的方法在window系统中可以加载成功 出错代码: self.sentence_embedding_pipe = ( pipe.input('sentence') .map('sentence', 'embedding', ops.sentence_embedding.sbert(model_name='../model/all-MiniLM-L12-v2')) .map('embedding', 'embedding', ops.towhee.np_normalize()) .output('embedding') )
错误信息: RuntimeError: Node-sentence-embedding/sbert-0 runs failed, error msg: Create sentence-embedding/sbert-0 operator sentence-embedding/sbert:main with args None and kws {'model_name': '../model/all-MiniLM-L12-v2'} failed, err: Load operator failed, Traceback (most recent call last): File "/soft/anaconda3/envs/qa/lib/python3.8/site-packages/towhee/runtime/nodes/node.py", line 88, in initialize self._op = self._op_pool.acquire_op( File "/soft/anaconda3/envs/qa/lib/python3.8/site-packages/towhee/runtime/operator_manager/operator_pool.py", line 106, in acquire_op op = self._op_loader.load_operator(hub_op_id, op_args, op_kws, tag, latest) File "/soft/anaconda3/envs/qa/lib/python3.8/site-packages/towhee/runtime/operator_manager/operator_loader.py", line 158, in load_operator raise RuntimeError('Load operator failed') RuntimeError: Load operator failed
Expected Behavior
No response
Steps To Reproduce
Environment
Anything else?
No response