System Info / 系統信息
Any. Reproduced on python:3.12-slim with a clean pip install xinference==3.2.0.
Running Xinference with Docker? / 是否使用 Docker 运行 Xinfernece?
Version info / 版本信息
xinference 3.2.0 (from PyPI)
The command used to start Xinference / 用以启动 xinference 的命令
xinference-local -H 0.0.0.0 -p 9997
Any entrypoint fails identically, because the error happens at import time.
Reproduction / 复现过程
pip install xinference==3.2.0
xinference-local -H 0.0.0.0 -p 9997
File ".../xinference/model/__init__.py", line 25, in _install
llm_install()
File ".../xinference/model/llm/__init__.py", line 273, in _install
load_model_family_from_json("llm_family.json", BUILTIN_LLM_FAMILIES)
File ".../xinference/model/llm/__init__.py", line 187, in load_model_family_from_json
for spec in json_obj["model_specs"]:
~~~~~~~~^^^^^^^^^^^^^^^
KeyError: 'model_specs'
Cause
The published wheel's xinference/model/llm/llm_family.json contains one entry that is not an LLM
family and has no model_specs key:
import json
d = json.load(open('.../site-packages/xinference/model/llm/llm_family.json'))
print(len(d))
print([e['model_name'] for e in d if 'model_specs' not in e])
167
['speech_campplus_sv_zh-cn_16k-common']
That entry is an audio model. It is byte-for-byte identical to the entry of the same name in
xinference/model/audio/model_spec.json, where it also correctly appears.
This looks like a release-pipeline problem rather than a source problem. The v3.2.0 git tag is
clean:
| Artifact |
entries in llm_family.json |
entries missing model_specs |
v3.2.0 git tag |
166 |
none |
xinference-3.2.0-py3-none-any.whl from PyPI |
167 |
1 (speech_campplus_sv_zh-cn_16k-common) |
So the audio entry is being appended to the LLM family JSON somewhere between tagging and
publishing, most likely by whatever merges the model JSON updates at build time.
Expected behavior / 期待表现
pip install xinference==3.2.0 should produce a working install. Right now every xinference-*
entrypoint raises KeyError: 'model_specs' on import, so the release is unusable without editing
the packaged JSON by hand.
Workaround
import json
p = '<site-packages>/xinference/model/llm/llm_family.json'
json.dump([x for x in json.load(open(p)) if 'model_specs' in x], open(p, 'w'))
Suggested fix
Two things, independent of each other:
- Fix whatever appends non-LLM entries to
llm_family.json during the release build.
- Make
load_model_family_from_json fail loudly with the offending model name rather than a bare
KeyError, and consider skipping entries that do not match the expected shape, so one bad entry
cannot make the whole package unimportable:
for json_obj in json.load(codecs.open(json_path, "r", encoding="utf-8")):
if "model_specs" not in json_obj:
raise ValueError(
f"{json_filename}: entry {json_obj.get('model_name')!r} has no 'model_specs'"
)
System Info / 系統信息
Any. Reproduced on
python:3.12-slimwith a cleanpip install xinference==3.2.0.Running Xinference with Docker? / 是否使用 Docker 运行 Xinfernece?
Version info / 版本信息
xinference 3.2.0 (from PyPI)
The command used to start Xinference / 用以启动 xinference 的命令
Any entrypoint fails identically, because the error happens at import time.
Reproduction / 复现过程
Cause
The published wheel's
xinference/model/llm/llm_family.jsoncontains one entry that is not an LLMfamily and has no
model_specskey:That entry is an audio model. It is byte-for-byte identical to the entry of the same name in
xinference/model/audio/model_spec.json, where it also correctly appears.This looks like a release-pipeline problem rather than a source problem. The
v3.2.0git tag isclean:
llm_family.jsonmodel_specsv3.2.0git tagxinference-3.2.0-py3-none-any.whlfrom PyPIspeech_campplus_sv_zh-cn_16k-common)So the audio entry is being appended to the LLM family JSON somewhere between tagging and
publishing, most likely by whatever merges the model JSON updates at build time.
Expected behavior / 期待表现
pip install xinference==3.2.0should produce a working install. Right now everyxinference-*entrypoint raises
KeyError: 'model_specs'on import, so the release is unusable without editingthe packaged JSON by hand.
Workaround
Suggested fix
Two things, independent of each other:
llm_family.jsonduring the release build.load_model_family_from_jsonfail loudly with the offending model name rather than a bareKeyError, and consider skipping entries that do not match the expected shape, so one bad entrycannot make the whole package unimportable: