Skip to content

部署本地嵌入模型jina-embeddings-v3报错400 #5482

Description

@gzqy-hub

System Info / 系統信息

docker+wsl2+ubuntu22.04
CUDA13.3
python3.12.13

Running Xinference with Docker? / 是否使用 Docker 运行 Xinfernece?

  • docker / docker
  • pip install / 通过 pip install 安装
  • installation from source / 从源码安装

Version info / 版本信息

最新版本3.3.1

The command used to start Xinference / 用以启动 xinference 的命令

Image Image

Reproduction / 复现过程

配置上图参数后容器报错日志如下,“trust_remote_code=True”怎么设置?
2026-09-03T03:14:57.370Z ERROR xinference.api.restful_api pid:1 role:local address:0.0.0.0:9997 node:5fbe1d6d2bf3 [address=0.0.0.0:36367, pid=256] The model /data/xinference/modelscope/hub/models/jinaai/jina-embeddings-v3 references the module class 'custom_st.Transformer', which is not part of Sentence Transformers. Importing it executes third-party code. You can inspect the repository content at /data/xinference/modelscope/hub/models/jinaai/jina-embeddings-v3.

Please pass the argument trust_remote_code=True to allow custom code to be run.

Traceback (most recent call last):

File "/usr/local/lib/python3.12/dist-packages/xinference/api/restful_api.py", line 1229, in launch_model

model_uid = await (await self._get_supervisor_ref()).launch_builtin_model(

            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^  

File "/opt/inference/xinference/model/embedding/sentence_transformers/core.py", line 300, in load

self._model = SentenceTransformer(

^^^^^^^^^^^^^^^^^

File "/usr/local/lib/python3.12/dist-packages/sentence_transformers/util/decorators.py", line 46, in wrapper

return func(*args, **kwargs)

^^^^^^^^^^^^^^^^^

File "/usr/local/lib/python3.12/dist-packages/sentence_transformers/sentence_transformer/model.py", line 194, in init

super().__init__(

File "/usr/local/lib/python3.12/dist-packages/sentence_transformers/base/model.py", line 236, in init

modules, self.module_kwargs = self._load_modules(

^^^^^^^^^^^^^^^^^

File "/usr/local/lib/python3.12/dist-packages/sentence_transformers/base/model.py", line 1081, in _load_modules

return self._load_config_modules(model_name_or_path, **load_kwargs)

^^^^^^^^^^^^^^^^^

File "/usr/local/lib/python3.12/dist-packages/sentence_transformers/base/model.py", line 1213, in _load_config_modules

module_class: type[Module] = self._load_module_class_from_ref(

^^^^^^^^^^^^^^^^^

File "/usr/local/lib/python3.12/dist-packages/sentence_transformers/base/model.py", line 1466, in _load_module_class_from_ref

return import_module_class(

^^^^^^^^^^^^^^^^^

File "/usr/local/lib/python3.12/dist-packages/sentence_transformers/util/misc.py", line 228, in import_module_class

raise ValueError(

ValueError: [address=0.0.0.0:36367, pid=256] The model /data/xinference/modelscope/hub/models/jinaai/jina-embeddings-v3 references the module class 'custom_st.Transformer', which is not part of Sentence Transformers. Importing it executes third-party code. You can inspect the repository content at /data/xinference/modelscope/hub/models/jinaai/jina-embeddings-v3.

Please pass the argument trust_remote_code=True to allow custom code to be run.

2026-09-03T03:14:57.374Z INFO uvicorn.access pid:1 role:local address:0.0.0.0:9997 node:5fbe1d6d2bf3 172.17.0.1:46126 - "POST /v1/models HTTP/1.1" 400

Expected behavior / 期待表现

已经分别测试在环境变量中添加trust_remote_code=True和附加参数: sentence_transformers中添加trust_remote_code=True,两次启动部署报同样错误,请教正确的配置参数,谢谢!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions