Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 25 additions & 15 deletions doc/source/gen_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,13 @@ def _can_use_transformers_legacy(model, model_spec):
abilities = set(model.get("model_ability", []))
return "chat" in abilities or "generate" in abilities

def _extract_primary_model_src(model):
if model.get("model_specs"):
for spec in model["model_specs"]:
if isinstance(spec, dict) and "model_src" in spec:
return spec["model_src"]
return model.get("model_src")

def main():
template_dir = '../templates'
env = Environment(loader=FileSystemLoader(template_dir))
Expand Down Expand Up @@ -456,9 +463,10 @@ def main():

for model in sorted_models:
# Process model_src for template compatibility
if 'model_src' in model:
if 'huggingface' in model['model_src']:
hf_src = model['model_src']['huggingface']
model_src = _extract_primary_model_src(model)
if model_src:
if 'huggingface' in model_src:
hf_src = model_src['huggingface']
model['model_id'] = hf_src['model_id']
# Handle GGUF related fields
if 'gguf_model_id' in hf_src:
Expand All @@ -470,8 +478,8 @@ def main():
model['lightning_model_id'] = hf_src['lightning_model_id']
if 'lightning_versions' in hf_src:
model['lightning_versions'] = ", ".join(hf_src['lightning_versions'])
elif 'modelscope' in model['model_src']:
model['model_id'] = model['model_src']['modelscope']['model_id']
elif 'modelscope' in model_src:
model['model_id'] = model_src['modelscope']['model_id']

available_controlnet = [cn["model_name"] for cn in model.get("controlnet", [])]
if not available_controlnet:
Expand Down Expand Up @@ -502,11 +510,12 @@ def main():

for model in sorted_models:
# Process model_src for template compatibility
if 'model_src' in model:
if 'huggingface' in model['model_src']:
model['model_id'] = model['model_src']['huggingface']['model_id']
elif 'modelscope' in model['model_src']:
model['model_id'] = model['model_src']['modelscope']['model_id']
model_src = _extract_primary_model_src(model)
if model_src:
if 'huggingface' in model_src:
model['model_id'] = model_src['huggingface']['model_id']
elif 'modelscope' in model_src:
model['model_id'] = model_src['modelscope']['model_id']

rendered = env.get_template('audio.rst.jinja').render(model)
output_file_path = os.path.join(output_dir, f"{model['model_name'].lower()}.rst")
Expand All @@ -527,11 +536,12 @@ def main():

for model in sorted_models:
# Process model_src for template compatibility
if 'model_src' in model:
if 'huggingface' in model['model_src']:
model['model_id'] = model['model_src']['huggingface']['model_id']
elif 'modelscope' in model['model_src']:
model['model_id'] = model['model_src']['modelscope']['model_id']
model_src = _extract_primary_model_src(model)
if model_src:
if 'huggingface' in model_src:
model['model_id'] = model_src['huggingface']['model_id']
elif 'modelscope' in model_src:
model['model_id'] = model_src['modelscope']['model_id']

model["model_ability"] = ', '.join(model.get("model_ability"))
rendered = env.get_template('video.rst.jinja').render(model)
Expand Down
50 changes: 40 additions & 10 deletions xinference/model/image/model_spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -998,18 +998,48 @@
"#system_numpy#"
]
},
"model_src": {
"huggingface": {
"model_id": "deepseek-ai/DeepSeek-OCR",
"model_revision": "main"
"model_specs": [
{
"model_format": "pytorch",
"model_src": {
"huggingface": {
"model_id": "deepseek-ai/DeepSeek-OCR",
"model_revision": "main"
},
"modelscope": {
"model_id": "deepseek-ai/DeepSeek-OCR",
"model_revision": "master"
}
}
},
"modelscope": {
"model_id": "deepseek-ai/DeepSeek-OCR",
"model_revision": "master"
{
"model_format": "mlx",
"model_src": {
"huggingface": {
"model_id": "mlx-community/DeepSeek-OCR-{quantization}",
"model_revision": "main",
"quantizations": [
"8bit",
"6bit",
"5bit",
"4bit"
]
},
"modelscope": {
"model_id": "mlx-community/DeepSeek-OCR-{quantization}",
"model_revision": "master",
"quantizations": [
"8bit",
"6bit",
"5bit",
"4bit"
]
}
}
}
},
"updated_at": 1766387624,
"featured": false
],
"featured": false,
"updated_at": 1767691154
},
{
"version": 2,
Expand Down