kiapi 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- kiapi/__init__.py +3 -0
- kiapi/__main__.py +4 -0
- kiapi/api/__init__.py +26 -0
- kiapi/api/_constants/require_auth.py +14 -0
- kiapi/api/_helpers/build_job_responses.py +73 -0
- kiapi/api/_helpers/build_openapi.py +55 -0
- kiapi/api/_helpers/build_train_responses.py +21 -0
- kiapi/api/_helpers/get_accept.py +20 -0
- kiapi/api/_helpers/get_ctx.py +7 -0
- kiapi/api/_helpers/get_worker.py +7 -0
- kiapi/api/_helpers/register_capability_endpoints.py +70 -0
- kiapi/api/_helpers/submit_and_maybe_wait.py +113 -0
- kiapi/api/_settings.py +50 -0
- kiapi/api/_views/async_job_response.py +21 -0
- kiapi/api/_views/capability_model_spec.py +49 -0
- kiapi/api/app.py +150 -0
- kiapi/api/audio/acestep/_views/extract_response.py +57 -0
- kiapi/api/audio/acestep/_views/track_response.py +57 -0
- kiapi/api/audio/acestep/router.py +190 -0
- kiapi/api/audio/audiogen/_views/audio_response.py +46 -0
- kiapi/api/audio/audiogen/router.py +77 -0
- kiapi/api/chat/_views/chat_completion_response.py +71 -0
- kiapi/api/chat/router.py +253 -0
- kiapi/api/embedding/_views/embedding_response.py +35 -0
- kiapi/api/embedding/router.py +82 -0
- kiapi/api/files/_operations/get_file.py +14 -0
- kiapi/api/files/_operations/get_file_id.py +18 -0
- kiapi/api/files/_views/file_delete_response.py +14 -0
- kiapi/api/files/_views/file_list_response.py +15 -0
- kiapi/api/files/router.py +105 -0
- kiapi/api/health/_views/health_response.py +26 -0
- kiapi/api/health/router.py +28 -0
- kiapi/api/image/depthpro/_views/estimate_response.py +70 -0
- kiapi/api/image/depthpro/router.py +81 -0
- kiapi/api/image/ernie/_views/image_response.py +50 -0
- kiapi/api/image/ernie/router.py +181 -0
- kiapi/api/image/flux2/_views/image_response.py +53 -0
- kiapi/api/image/flux2/router.py +197 -0
- kiapi/api/image/ideogram4/_views/image_response.py +55 -0
- kiapi/api/image/ideogram4/router.py +87 -0
- kiapi/api/image/qwen/_views/image_response.py +47 -0
- kiapi/api/image/qwen/router.py +141 -0
- kiapi/api/image/seedvr2/_views/image_response.py +50 -0
- kiapi/api/image/seedvr2/router.py +83 -0
- kiapi/api/image/zimage/_views/image_response.py +49 -0
- kiapi/api/image/zimage/router.py +131 -0
- kiapi/api/jobs/_operations/get_job_id.py +18 -0
- kiapi/api/jobs/_views/job_delete_response.py +19 -0
- kiapi/api/jobs/_views/job_list_response.py +15 -0
- kiapi/api/jobs/router.py +62 -0
- kiapi/api/models/_schemas/openai_model_spec.py +26 -0
- kiapi/api/models/_views/model_list_response.py +15 -0
- kiapi/api/models/router.py +29 -0
- kiapi/api/video/ltx2/_views/__init__.py +1 -0
- kiapi/api/video/ltx2/_views/video_response.py +59 -0
- kiapi/api/video/ltx2/router.py +89 -0
- kiapi/api/web/_views/__init__.py +7 -0
- kiapi/api/web/_views/fetch_api_request.py +26 -0
- kiapi/api/web/_views/fetch_error_response.py +25 -0
- kiapi/api/web/router.py +302 -0
- kiapi/capabilities/__init__.py +24 -0
- kiapi/capabilities/_exceptions/CapabilityError.py +2 -0
- kiapi/capabilities/_exceptions/ValidationError.py +2 -0
- kiapi/capabilities/_helpers/attach_mflux_progress.py +50 -0
- kiapi/capabilities/_helpers/get_file_path.py +20 -0
- kiapi/capabilities/_helpers/resolve_file_ref.py +16 -0
- kiapi/capabilities/acestep/README.ja.md +174 -0
- kiapi/capabilities/acestep/README.md +167 -0
- kiapi/capabilities/acestep/__init__.py +37 -0
- kiapi/capabilities/acestep/_constants/description.py +122 -0
- kiapi/capabilities/acestep/_exceptions/ace_step_engine_error.py +2 -0
- kiapi/capabilities/acestep/_helpers/register.py +96 -0
- kiapi/capabilities/acestep/_models/acestep.py +105 -0
- kiapi/capabilities/acestep/_operations/handle_cover.py +23 -0
- kiapi/capabilities/acestep/_operations/handle_extract.py +38 -0
- kiapi/capabilities/acestep/_operations/handle_generate.py +18 -0
- kiapi/capabilities/acestep/_operations/handle_repaint.py +25 -0
- kiapi/capabilities/acestep/_operations/resolve_ace_step_paths.py +30 -0
- kiapi/capabilities/acestep/_operations/resolve_cover_params.py +21 -0
- kiapi/capabilities/acestep/_operations/resolve_engine.py +10 -0
- kiapi/capabilities/acestep/_operations/resolve_extract_params.py +24 -0
- kiapi/capabilities/acestep/_operations/resolve_generate_params.py +18 -0
- kiapi/capabilities/acestep/_operations/resolve_repaint_params.py +22 -0
- kiapi/capabilities/acestep/_schemas/ace_step_paths.py +29 -0
- kiapi/capabilities/acestep/_services/ace_step_engine.py +143 -0
- kiapi/capabilities/acestep/_settings.py +82 -0
- kiapi/capabilities/acestep/_views/ace_step_base.py +61 -0
- kiapi/capabilities/acestep/_views/cover_params.py +26 -0
- kiapi/capabilities/acestep/_views/cover_request.py +49 -0
- kiapi/capabilities/acestep/_views/extract_params.py +24 -0
- kiapi/capabilities/acestep/_views/extract_request.py +33 -0
- kiapi/capabilities/acestep/_views/generate_params.py +25 -0
- kiapi/capabilities/acestep/_views/generate_request.py +54 -0
- kiapi/capabilities/acestep/_views/repaint_params.py +27 -0
- kiapi/capabilities/acestep/_views/repaint_request.py +51 -0
- kiapi/capabilities/acestep/_views/track_params.py +7 -0
- kiapi/capabilities/acestep/worker_subprocess.py +247 -0
- kiapi/capabilities/audiogen/README.ja.md +49 -0
- kiapi/capabilities/audiogen/README.md +48 -0
- kiapi/capabilities/audiogen/__init__.py +25 -0
- kiapi/capabilities/audiogen/_constants/description.py +60 -0
- kiapi/capabilities/audiogen/_helpers/attach_audiogen_progress.py +27 -0
- kiapi/capabilities/audiogen/_helpers/register.py +42 -0
- kiapi/capabilities/audiogen/_helpers/validate_generate.py +14 -0
- kiapi/capabilities/audiogen/_models/audiogen.py +98 -0
- kiapi/capabilities/audiogen/_operations/handle_generate.py +27 -0
- kiapi/capabilities/audiogen/_operations/resolve_generate_params.py +25 -0
- kiapi/capabilities/audiogen/_settings.py +34 -0
- kiapi/capabilities/audiogen/_views/generate_params.py +14 -0
- kiapi/capabilities/audiogen/_views/generate_request.py +96 -0
- kiapi/capabilities/chat/README.ja.md +822 -0
- kiapi/capabilities/chat/README.md +806 -0
- kiapi/capabilities/chat/__init__.py +25 -0
- kiapi/capabilities/chat/_constants/description.py +163 -0
- kiapi/capabilities/chat/_helpers/register.py +67 -0
- kiapi/capabilities/chat/_models/qwen3_5.py +183 -0
- kiapi/capabilities/chat/_models/qwen3_omni.py +242 -0
- kiapi/capabilities/chat/_operations/apply_template.py +74 -0
- kiapi/capabilities/chat/_operations/completed_hermes_tool_call_text.py +9 -0
- kiapi/capabilities/chat/_operations/emit_streaming_response.py +297 -0
- kiapi/capabilities/chat/_operations/ensure_streaming_detokenizer_compat.py +49 -0
- kiapi/capabilities/chat/_operations/format_response.py +72 -0
- kiapi/capabilities/chat/_operations/handle_chat.py +25 -0
- kiapi/capabilities/chat/_operations/parse_hermes_tool_calls.py +63 -0
- kiapi/capabilities/chat/_operations/parse_json_tool_calls.py +66 -0
- kiapi/capabilities/chat/_operations/parse_messages.py +326 -0
- kiapi/capabilities/chat/_operations/resolve_chat_params.py +50 -0
- kiapi/capabilities/chat/_operations/stream_text_from_tokens.py +32 -0
- kiapi/capabilities/chat/_operations/strip_tool_calls.py +15 -0
- kiapi/capabilities/chat/_settings.py +74 -0
- kiapi/capabilities/chat/_utils/apply_parallel_tool_call_policy.py +17 -0
- kiapi/capabilities/chat/_utils/apply_seed.py +8 -0
- kiapi/capabilities/chat/_utils/load_audio_mono.py +31 -0
- kiapi/capabilities/chat/_utils/load_mlx_vlm.py +12 -0
- kiapi/capabilities/chat/_utils/warmup_params.py +26 -0
- kiapi/capabilities/chat/_views/chat_params.py +34 -0
- kiapi/capabilities/chat/_views/chat_request.py +153 -0
- kiapi/capabilities/depthpro/README.ja.md +131 -0
- kiapi/capabilities/depthpro/README.md +124 -0
- kiapi/capabilities/depthpro/__init__.py +23 -0
- kiapi/capabilities/depthpro/_constants/description.py +39 -0
- kiapi/capabilities/depthpro/_helpers/register.py +46 -0
- kiapi/capabilities/depthpro/_helpers/validate_estimate.py +32 -0
- kiapi/capabilities/depthpro/_models/depthpro.py +144 -0
- kiapi/capabilities/depthpro/_operations/handle_estimate.py +50 -0
- kiapi/capabilities/depthpro/_operations/is_quantize_override.py +12 -0
- kiapi/capabilities/depthpro/_operations/resolve_estimate_params.py +24 -0
- kiapi/capabilities/depthpro/_settings.py +46 -0
- kiapi/capabilities/depthpro/_views/estimate_params.py +21 -0
- kiapi/capabilities/depthpro/_views/estimate_request.py +63 -0
- kiapi/capabilities/embedding/README.ja.md +137 -0
- kiapi/capabilities/embedding/README.md +128 -0
- kiapi/capabilities/embedding/__init__.py +24 -0
- kiapi/capabilities/embedding/_constants/description.py +47 -0
- kiapi/capabilities/embedding/_helpers/register.py +66 -0
- kiapi/capabilities/embedding/_models/qwen3_text.py +53 -0
- kiapi/capabilities/embedding/_models/qwen3_vl.py +97 -0
- kiapi/capabilities/embedding/_operations/format_response.py +24 -0
- kiapi/capabilities/embedding/_operations/handle_embed.py +24 -0
- kiapi/capabilities/embedding/_operations/parse_inputs.py +108 -0
- kiapi/capabilities/embedding/_operations/resolve_embed_params.py +18 -0
- kiapi/capabilities/embedding/_settings.py +27 -0
- kiapi/capabilities/embedding/_utils/to_vector.py +20 -0
- kiapi/capabilities/embedding/_views/embed_params.py +17 -0
- kiapi/capabilities/embedding/_views/embed_request.py +39 -0
- kiapi/capabilities/ernie/README.ja.md +242 -0
- kiapi/capabilities/ernie/README.md +223 -0
- kiapi/capabilities/ernie/__init__.py +34 -0
- kiapi/capabilities/ernie/_constants/description.py +71 -0
- kiapi/capabilities/ernie/_helpers/register.py +60 -0
- kiapi/capabilities/ernie/_helpers/validate_edit.py +19 -0
- kiapi/capabilities/ernie/_helpers/validate_generate.py +8 -0
- kiapi/capabilities/ernie/_models/ernie.py +356 -0
- kiapi/capabilities/ernie/_operations/handle_edit.py +39 -0
- kiapi/capabilities/ernie/_operations/handle_generate.py +38 -0
- kiapi/capabilities/ernie/_operations/handle_train.py +77 -0
- kiapi/capabilities/ernie/_operations/is_quantize_override.py +16 -0
- kiapi/capabilities/ernie/_operations/resolve_edit_params.py +44 -0
- kiapi/capabilities/ernie/_operations/resolve_generate_params.py +40 -0
- kiapi/capabilities/ernie/_operations/resolve_lora_params.py +23 -0
- kiapi/capabilities/ernie/_operations/resolve_train_params.py +43 -0
- kiapi/capabilities/ernie/_operations/validate_common.py +33 -0
- kiapi/capabilities/ernie/_schemas/lora_ref.py +27 -0
- kiapi/capabilities/ernie/_settings.py +151 -0
- kiapi/capabilities/ernie/_views/edit_params.py +36 -0
- kiapi/capabilities/ernie/_views/edit_request.py +142 -0
- kiapi/capabilities/ernie/_views/generate_params.py +32 -0
- kiapi/capabilities/ernie/_views/generate_request.py +127 -0
- kiapi/capabilities/ernie/_views/train_params.py +28 -0
- kiapi/capabilities/ernie/_views/train_request.py +96 -0
- kiapi/capabilities/flux2/README.ja.md +260 -0
- kiapi/capabilities/flux2/README.md +241 -0
- kiapi/capabilities/flux2/__init__.py +36 -0
- kiapi/capabilities/flux2/_constants/description.py +81 -0
- kiapi/capabilities/flux2/_helpers/register.py +98 -0
- kiapi/capabilities/flux2/_helpers/validate_edit.py +12 -0
- kiapi/capabilities/flux2/_helpers/validate_generate.py +8 -0
- kiapi/capabilities/flux2/_models/flux2.py +396 -0
- kiapi/capabilities/flux2/_operations/handle_edit.py +44 -0
- kiapi/capabilities/flux2/_operations/handle_generate.py +46 -0
- kiapi/capabilities/flux2/_operations/handle_train.py +105 -0
- kiapi/capabilities/flux2/_operations/is_quantize_override.py +16 -0
- kiapi/capabilities/flux2/_operations/resolve_edit_params.py +43 -0
- kiapi/capabilities/flux2/_operations/resolve_generate_params.py +44 -0
- kiapi/capabilities/flux2/_operations/resolve_lora_params.py +23 -0
- kiapi/capabilities/flux2/_operations/resolve_train_params.py +42 -0
- kiapi/capabilities/flux2/_operations/role_spec.py +13 -0
- kiapi/capabilities/flux2/_operations/split_repo.py +11 -0
- kiapi/capabilities/flux2/_operations/validate_common.py +35 -0
- kiapi/capabilities/flux2/_schemas/lora_ref.py +27 -0
- kiapi/capabilities/flux2/_settings.py +181 -0
- kiapi/capabilities/flux2/_views/edit_params.py +36 -0
- kiapi/capabilities/flux2/_views/edit_request.py +145 -0
- kiapi/capabilities/flux2/_views/generate_params.py +36 -0
- kiapi/capabilities/flux2/_views/generate_request.py +150 -0
- kiapi/capabilities/flux2/_views/train_params.py +32 -0
- kiapi/capabilities/flux2/_views/train_request.py +102 -0
- kiapi/capabilities/ideogram4/README.ja.md +230 -0
- kiapi/capabilities/ideogram4/README.md +219 -0
- kiapi/capabilities/ideogram4/__init__.py +24 -0
- kiapi/capabilities/ideogram4/_constants/description.py +65 -0
- kiapi/capabilities/ideogram4/_helpers/register.py +44 -0
- kiapi/capabilities/ideogram4/_helpers/validate_generate.py +31 -0
- kiapi/capabilities/ideogram4/_models/ideogram4.py +120 -0
- kiapi/capabilities/ideogram4/_operations/handle_generate.py +30 -0
- kiapi/capabilities/ideogram4/_operations/is_quantize_override.py +12 -0
- kiapi/capabilities/ideogram4/_operations/resolve_generate_params.py +30 -0
- kiapi/capabilities/ideogram4/_settings.py +89 -0
- kiapi/capabilities/ideogram4/_views/generate_params.py +27 -0
- kiapi/capabilities/ideogram4/_views/generate_request.py +118 -0
- kiapi/capabilities/ltx2/README.ja.md +287 -0
- kiapi/capabilities/ltx2/README.md +274 -0
- kiapi/capabilities/ltx2/__init__.py +26 -0
- kiapi/capabilities/ltx2/_constants/description.py +81 -0
- kiapi/capabilities/ltx2/_helpers/register.py +58 -0
- kiapi/capabilities/ltx2/_helpers/validate_generate.py +42 -0
- kiapi/capabilities/ltx2/_models/ltx2.py +106 -0
- kiapi/capabilities/ltx2/_operations/detect_mode.py +19 -0
- kiapi/capabilities/ltx2/_operations/handle_generate.py +52 -0
- kiapi/capabilities/ltx2/_operations/resolve_generate_params.py +31 -0
- kiapi/capabilities/ltx2/_settings.py +93 -0
- kiapi/capabilities/ltx2/_views/generate_params.py +34 -0
- kiapi/capabilities/ltx2/_views/generate_request.py +151 -0
- kiapi/capabilities/qwen/README.ja.md +251 -0
- kiapi/capabilities/qwen/README.md +235 -0
- kiapi/capabilities/qwen/__init__.py +30 -0
- kiapi/capabilities/qwen/_constants/description.py +53 -0
- kiapi/capabilities/qwen/_helpers/register.py +60 -0
- kiapi/capabilities/qwen/_helpers/validate_edit.py +12 -0
- kiapi/capabilities/qwen/_helpers/validate_generate.py +12 -0
- kiapi/capabilities/qwen/_models/qwen.py +224 -0
- kiapi/capabilities/qwen/_operations/handle_edit.py +44 -0
- kiapi/capabilities/qwen/_operations/handle_generate.py +46 -0
- kiapi/capabilities/qwen/_operations/is_quantize_override.py +15 -0
- kiapi/capabilities/qwen/_operations/resolve_edit_params.py +35 -0
- kiapi/capabilities/qwen/_operations/resolve_generate_params.py +39 -0
- kiapi/capabilities/qwen/_operations/resolve_lora_params.py +23 -0
- kiapi/capabilities/qwen/_operations/validate_common.py +32 -0
- kiapi/capabilities/qwen/_schemas/lora_ref.py +27 -0
- kiapi/capabilities/qwen/_settings.py +107 -0
- kiapi/capabilities/qwen/_views/edit_params.py +36 -0
- kiapi/capabilities/qwen/_views/edit_request.py +138 -0
- kiapi/capabilities/qwen/_views/generate_params.py +37 -0
- kiapi/capabilities/qwen/_views/generate_request.py +149 -0
- kiapi/capabilities/seedvr2/README.ja.md +234 -0
- kiapi/capabilities/seedvr2/README.md +219 -0
- kiapi/capabilities/seedvr2/__init__.py +24 -0
- kiapi/capabilities/seedvr2/_constants/description.py +46 -0
- kiapi/capabilities/seedvr2/_helpers/register.py +60 -0
- kiapi/capabilities/seedvr2/_helpers/validate_upscale.py +52 -0
- kiapi/capabilities/seedvr2/_models/seedvr2.py +140 -0
- kiapi/capabilities/seedvr2/_operations/handle_upscale.py +42 -0
- kiapi/capabilities/seedvr2/_operations/is_quantize_override.py +12 -0
- kiapi/capabilities/seedvr2/_operations/resolve_upscale_params.py +30 -0
- kiapi/capabilities/seedvr2/_settings.py +74 -0
- kiapi/capabilities/seedvr2/_views/upscale_params.py +27 -0
- kiapi/capabilities/seedvr2/_views/upscale_request.py +94 -0
- kiapi/capabilities/web/README.ja.md +187 -0
- kiapi/capabilities/web/README.md +171 -0
- kiapi/capabilities/web/__init__.py +30 -0
- kiapi/capabilities/web/_constants/description.py +38 -0
- kiapi/capabilities/web/_exceptions/FetchError.py +24 -0
- kiapi/capabilities/web/_exceptions/SearchBackendError.py +11 -0
- kiapi/capabilities/web/_helpers/register.py +59 -0
- kiapi/capabilities/web/_models/crawl4ai.py +32 -0
- kiapi/capabilities/web/_models/searxng.py +44 -0
- kiapi/capabilities/web/_operations/handle_fetch.py +145 -0
- kiapi/capabilities/web/_operations/handle_search.py +56 -0
- kiapi/capabilities/web/_operations/resolve_fetch_params.py +19 -0
- kiapi/capabilities/web/_operations/resolve_search_params.py +34 -0
- kiapi/capabilities/web/_operations/resolve_searxng_config_dir.py +21 -0
- kiapi/capabilities/web/_services/__init__.py +1 -0
- kiapi/capabilities/web/_services/web_backend_process.py +144 -0
- kiapi/capabilities/web/_settings.py +138 -0
- kiapi/capabilities/web/_views/fetch_params.py +27 -0
- kiapi/capabilities/web/_views/fetch_request.py +29 -0
- kiapi/capabilities/web/_views/fetch_result.py +20 -0
- kiapi/capabilities/web/_views/search_params.py +43 -0
- kiapi/capabilities/web/_views/search_request.py +93 -0
- kiapi/capabilities/web/_views/search_response.py +49 -0
- kiapi/capabilities/web/resources/__init__.py +0 -0
- kiapi/capabilities/web/resources/searxng/__init__.py +0 -0
- kiapi/capabilities/web/resources/searxng/settings.yml +11 -0
- kiapi/capabilities/zimage/README.ja.md +249 -0
- kiapi/capabilities/zimage/README.md +231 -0
- kiapi/capabilities/zimage/__init__.py +34 -0
- kiapi/capabilities/zimage/_constants/description.py +73 -0
- kiapi/capabilities/zimage/_helpers/register.py +62 -0
- kiapi/capabilities/zimage/_helpers/validate_generate.py +37 -0
- kiapi/capabilities/zimage/_models/zimage.py +278 -0
- kiapi/capabilities/zimage/_operations/handle_generate.py +38 -0
- kiapi/capabilities/zimage/_operations/handle_train.py +78 -0
- kiapi/capabilities/zimage/_operations/is_quantize_override.py +11 -0
- kiapi/capabilities/zimage/_operations/resolve_generate_params.py +39 -0
- kiapi/capabilities/zimage/_operations/resolve_lora_params.py +23 -0
- kiapi/capabilities/zimage/_operations/resolve_train_params.py +38 -0
- kiapi/capabilities/zimage/_schemas/lora_ref.py +27 -0
- kiapi/capabilities/zimage/_settings.py +166 -0
- kiapi/capabilities/zimage/_views/generate_params.py +23 -0
- kiapi/capabilities/zimage/_views/generate_request.py +127 -0
- kiapi/capabilities/zimage/_views/train_params.py +22 -0
- kiapi/capabilities/zimage/_views/train_request.py +101 -0
- kiapi/cli/__init__.py +11 -0
- kiapi/cli/_helpers/dedupe_resources.py +12 -0
- kiapi/cli/_helpers/register_all_capabilities.py +36 -0
- kiapi/cli/_helpers/run_resources.py +24 -0
- kiapi/cli/_helpers/select_specs.py +67 -0
- kiapi/cli/activate/_operations/preflight_hf_access.py +129 -0
- kiapi/cli/activate/cli.py +37 -0
- kiapi/cli/check/_helpers/check_audio_acestep_turbo.py +22 -0
- kiapi/cli/check/_helpers/check_audio_acestep_xl_base.py +22 -0
- kiapi/cli/check/_helpers/check_audio_audiogen_medium.py +24 -0
- kiapi/cli/check/_helpers/check_chat_chat_qwen3_6_27b.py +19 -0
- kiapi/cli/check/_helpers/check_chat_chat_qwen3_omni.py +19 -0
- kiapi/cli/check/_helpers/check_embedding_embedding_qwen3_embedding_8b.py +14 -0
- kiapi/cli/check/_helpers/check_embedding_embedding_qwen3_vl_embedding_2b.py +19 -0
- kiapi/cli/check/_helpers/check_image_depthpro_base.py +21 -0
- kiapi/cli/check/_helpers/check_image_ernie_base.py +23 -0
- kiapi/cli/check/_helpers/check_image_ernie_turbo.py +23 -0
- kiapi/cli/check/_helpers/check_image_flux2_klein_9b.py +23 -0
- kiapi/cli/check/_helpers/check_image_flux2_klein_base_4b.py +23 -0
- kiapi/cli/check/_helpers/check_image_flux2_klein_base_9b.py +23 -0
- kiapi/cli/check/_helpers/check_image_ideogram4_fp8.py +23 -0
- kiapi/cli/check/_helpers/check_image_qwen_edit_2509.py +27 -0
- kiapi/cli/check/_helpers/check_image_qwen_image.py +23 -0
- kiapi/cli/check/_helpers/check_image_seedvr2_3b.py +23 -0
- kiapi/cli/check/_helpers/check_image_seedvr2_7b.py +23 -0
- kiapi/cli/check/_helpers/check_image_zimage_base.py +23 -0
- kiapi/cli/check/_helpers/check_image_zimage_turbo.py +23 -0
- kiapi/cli/check/_helpers/check_video_ltx2_distilled.py +26 -0
- kiapi/cli/check/_helpers/check_web_web_fetch.py +14 -0
- kiapi/cli/check/_helpers/check_web_web_search.py +14 -0
- kiapi/cli/check/_operations/build_check_result.py +20 -0
- kiapi/cli/check/_operations/check_context.py +10 -0
- kiapi/cli/check/_operations/create_sample_image.py +46 -0
- kiapi/cli/check/_schemas/check_result.py +12 -0
- kiapi/cli/check/cli.py +89 -0
- kiapi/cli/cli.py +29 -0
- kiapi/cli/config/cli.py +17 -0
- kiapi/cli/config/edit/cli.py +32 -0
- kiapi/cli/config/init/cli.py +33 -0
- kiapi/cli/config/show/cli.py +13 -0
- kiapi/cli/config/template/cli.py +36 -0
- kiapi/cli/deactivate/cli.py +49 -0
- kiapi/cli/run/asgi.py +16 -0
- kiapi/cli/run/cli.py +59 -0
- kiapi/cli/service/__init__.py +5 -0
- kiapi/cli/service/_services/service_manager.py +107 -0
- kiapi/cli/service/cli.py +19 -0
- kiapi/cli/service/install/cli.py +17 -0
- kiapi/cli/service/start/cli.py +22 -0
- kiapi/cli/service/status/cli.py +81 -0
- kiapi/cli/service/stop/cli.py +19 -0
- kiapi/cli/service/uninstall/cli.py +16 -0
- kiapi/cli/status/cli.py +226 -0
- kiapi/core/app/__init__.py +16 -0
- kiapi/core/app/_schemas/app_context.py +28 -0
- kiapi/core/app/_services/user_directory.py +59 -0
- kiapi/core/app/_settings.py +46 -0
- kiapi/core/capability/__init__.py +11 -0
- kiapi/core/capability/_schemas/capability_spec.py +17 -0
- kiapi/core/capability/_services/capability_spec_registry.py +21 -0
- kiapi/core/config/__init__.py +11 -0
- kiapi/core/config/_exceptions/user_config_error.py +2 -0
- kiapi/core/config/_helpers/get_user_settings_path.py +7 -0
- kiapi/core/config/_helpers/load_user_settings.py +54 -0
- kiapi/core/file/__init__.py +37 -0
- kiapi/core/file/_helpers/create_file_store.py +7 -0
- kiapi/core/file/_helpers/resolve_file_ref.py +90 -0
- kiapi/core/file/_schemas/file_data_url_ref.py +19 -0
- kiapi/core/file/_schemas/file_id_ref.py +16 -0
- kiapi/core/file/_schemas/file_record.py +46 -0
- kiapi/core/file/_schemas/file_url_ref.py +16 -0
- kiapi/core/file/_services/file_store.py +138 -0
- kiapi/core/file/_settings.py +22 -0
- kiapi/core/file/_types/file_id.py +2 -0
- kiapi/core/file/_types/file_ref.py +12 -0
- kiapi/core/file/_views/resolved_file_ref.py +16 -0
- kiapi/core/job/__init__.py +24 -0
- kiapi/core/job/_enums/job_status.py +9 -0
- kiapi/core/job/_helpers/creep_progress.py +123 -0
- kiapi/core/job/_models/job.py +121 -0
- kiapi/core/job/_services/job_store.py +33 -0
- kiapi/core/job/_services/progress_reporter.py +79 -0
- kiapi/core/job/_types/job_id.py +3 -0
- kiapi/core/job/_types/job_result.py +5 -0
- kiapi/core/job/_types/job_type.py +4 -0
- kiapi/core/logging/__init__.py +14 -0
- kiapi/core/logging/_helpers/get_log_level.py +8 -0
- kiapi/core/logging/_helpers/setup_logger.py +14 -0
- kiapi/core/logging/_settings.py +34 -0
- kiapi/core/logging/_types/log_level.py +3 -0
- kiapi/core/memory/__init__.py +21 -0
- kiapi/core/memory/_exceptions/memory_budget_error.py +2 -0
- kiapi/core/memory/_helpers/create_memory_manager.py +17 -0
- kiapi/core/memory/_operations/log_memory_limit.py +29 -0
- kiapi/core/memory/_operations/resolve_effective_memory_limit_gb.py +13 -0
- kiapi/core/memory/_operations/resolve_framework_strategy.py +42 -0
- kiapi/core/memory/_schemas/framework_strategy.py +14 -0
- kiapi/core/memory/_schemas/memory_stats.py +24 -0
- kiapi/core/memory/_schemas/resident_model.py +14 -0
- kiapi/core/memory/_schemas/resident_model_stats.py +49 -0
- kiapi/core/memory/_services/memory_manager.py +257 -0
- kiapi/core/memory/_settings.py +36 -0
- kiapi/core/memory/_types/framework_name.py +4 -0
- kiapi/core/memory/_types/resident_key.py +4 -0
- kiapi/core/model/__init__.py +36 -0
- kiapi/core/model/_exceptions/unknown_model_error.py +2 -0
- kiapi/core/model/_schemas/model_spec.py +145 -0
- kiapi/core/model/_services/model_registry.py +85 -0
- kiapi/core/model/_types/model_alias.py +2 -0
- kiapi/core/model/_types/model_domain.py +6 -0
- kiapi/core/model/_types/model_family.py +5 -0
- kiapi/core/model/_types/model_key.py +8 -0
- kiapi/core/model/_types/model_name.py +4 -0
- kiapi/core/model/_types/model_repo.py +3 -0
- kiapi/core/net/__init__.py +16 -0
- kiapi/core/net/_exceptions/unsafe_url_error.py +7 -0
- kiapi/core/net/_helpers/verify_public_url.py +68 -0
- kiapi/core/net/_settings.py +28 -0
- kiapi/core/setup/__init__.py +25 -0
- kiapi/core/setup/_exceptions/setup_required_error.py +2 -0
- kiapi/core/setup/_schemas/docker_image_resource.py +37 -0
- kiapi/core/setup/_schemas/hf_snapshot_resource.py +50 -0
- kiapi/core/setup/_schemas/local_path_resource.py +43 -0
- kiapi/core/setup/_schemas/python_package_resource.py +58 -0
- kiapi/core/setup/_schemas/python_venv_resource.py +63 -0
- kiapi/core/setup/_schemas/setup_status.py +7 -0
- kiapi/core/setup/_schemas/url_file_resource.py +43 -0
- kiapi/core/setup/_services/setup_manager.py +331 -0
- kiapi/core/setup/_types/setup_resource.py +21 -0
- kiapi/core/setup/_types/setup_target.py +11 -0
- kiapi/core/workdir/__init__.py +8 -0
- kiapi/core/workdir/_helpers/create_work_dir.py +11 -0
- kiapi/core/workdir/_settings.py +21 -0
- kiapi/core/worker/__init__.py +23 -0
- kiapi/core/worker/_helpers/create_worker.py +9 -0
- kiapi/core/worker/_services/worker.py +165 -0
- kiapi/core/worker/_settings.py +36 -0
- kiapi/core/worker/_types/job_thunk.py +6 -0
- kiapi-0.1.0.dist-info/METADATA +337 -0
- kiapi-0.1.0.dist-info/RECORD +465 -0
- kiapi-0.1.0.dist-info/WHEEL +4 -0
- kiapi-0.1.0.dist-info/entry_points.txt +2 -0
- kiapi-0.1.0.dist-info/licenses/LICENSE +21 -0
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
# seedvr2
|
|
2
|
+
|
|
3
|
+
[English](README.md) | **日本語**
|
|
4
|
+
|
|
5
|
+
[mflux SeedVR2](https://github.com/filipstrand/mflux/blob/main/src/mflux/models/seedvr2/README.md) で、単一画像の拡散ベース超解像 / アップスケール機能を提供します。
|
|
6
|
+
SeedVR2 はプロンプト駆動の画像生成ではなく、入力画像を元にディテールを再構成する image-to-image の超解像モデルです。
|
|
7
|
+
|
|
8
|
+
- **upscale**:
|
|
9
|
+
- Files API にアップロード済みの画像を `image` FileRef で参照
|
|
10
|
+
- 最短辺の目標ピクセル数、または `"2x"` のような倍率で出力サイズを指定
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
## API
|
|
14
|
+
|
|
15
|
+
| Endpoint | Name | Description |
|
|
16
|
+
|---|---|---|
|
|
17
|
+
| `POST /v1/image/seedvr2/upscale` | 画像アップスケール | Files API の画像を超解像し、画像を 1 枚生成。 |
|
|
18
|
+
| `GET /v1/image/seedvr2/models` | モデル一覧 | 利用可能なモデルの一覧を返す。 |
|
|
19
|
+
| `GET /v1/image/seedvr2/openapi.json` | OpenAPI | 詳細な入出力仕様、制約、TIPS を返す。 |
|
|
20
|
+
|
|
21
|
+
## API Docs
|
|
22
|
+
|
|
23
|
+
- [OpenAPI JSON](https://kiarina.github.io/kiapi/v1/image/seedvr2/openapi.json)
|
|
24
|
+
- [Swagger UI](https://kiarina.github.io/kiapi/v1/image/seedvr2/docs.html)
|
|
25
|
+
- [ReDoc](https://kiarina.github.io/kiapi/v1/image/seedvr2/redoc.html)
|
|
26
|
+
|
|
27
|
+
## Dependencies
|
|
28
|
+
|
|
29
|
+
| Package | License | Description |
|
|
30
|
+
|---|---|---|
|
|
31
|
+
| [mflux](https://github.com/filipstrand/mflux) | MIT | SeedVR2 の MLX 実装を利用。 |
|
|
32
|
+
|
|
33
|
+
## Models
|
|
34
|
+
|
|
35
|
+
| Model | License | Terms | Size | Description |
|
|
36
|
+
|---|---|---|---:|---|
|
|
37
|
+
| [numz/SeedVR2_comfyUI](https://huggingface.co/numz/SeedVR2_comfyUI) | Apache-2.0 | 不要 | 7.3 GB | `3b`(デフォルト)。軽量 variant。既定は `resolution: "2x"`、`softness: 0.0`、`quantize: 8`。 |
|
|
38
|
+
| [numz/SeedVR2_comfyUI](https://huggingface.co/numz/SeedVR2_comfyUI) | Apache-2.0 | 不要 | 17 GB | `7b`。高容量 variant。`3b` より重く、kiapi の登録値では重み約 `7.0 GiB`、実行時ヘッドルーム約 `4.0 GiB` を見込む。 |
|
|
39
|
+
|
|
40
|
+
モデル重みは `KIAPI_SEEDVR2_MODEL_REPO` で差し替えできます。
|
|
41
|
+
既定は `numz/SeedVR2_comfyUI` です。
|
|
42
|
+
|
|
43
|
+
## Notes
|
|
44
|
+
|
|
45
|
+
- **resolution**:
|
|
46
|
+
`resolution` は整数の最短辺ターゲット、または `"2x"` / `"1.5x"` のような倍率です。
|
|
47
|
+
整数の場合は既定で `16..2048`、倍率の場合は `> 0` かつ `4.0x` 以下です。
|
|
48
|
+
- **softness**:
|
|
49
|
+
`softness` は `0..1`。既定は `0.0` です。入力画像のディテール再構成の柔らかさを調整します。
|
|
50
|
+
- **seed**:
|
|
51
|
+
`seed` を省略するとリクエストごとにランダムな seed が割り当てられます。
|
|
52
|
+
再現性が必要な場合は明示してください。
|
|
53
|
+
- **quantize override**:
|
|
54
|
+
`quantize` は `3` / `4` / `5` / `6` / `8` / `null`。通常は既定の `8` で常駐モデルを使います。
|
|
55
|
+
リクエストで既定値と異なる `quantize` を指定した場合は、一回限りの一時モデルとしてロード・実行・解放します。
|
|
56
|
+
- **レスポンス形式**:
|
|
57
|
+
sync で 1 成果物を生成する場合、`Accept: application/json` を付けなければ生の画像バイト列を返します。
|
|
58
|
+
`X-Kiapi-File-Id` と `X-Kiapi-Job-Id` ヘッダから保存済み成果物と Job を参照できます。
|
|
59
|
+
Job JSON が欲しい場合、または async の場合は `Accept: application/json` を使います。
|
|
60
|
+
- **出力形式**:
|
|
61
|
+
`format` は `png`(既定)/ `jpeg` / `webp`。`jpeg` / `webp` では `quality`
|
|
62
|
+
`1..100`(既定 `90`)を使います。
|
|
63
|
+
- **メモリ目安**:
|
|
64
|
+
`3b` は重み約 `2.7 GiB`、実行時ヘッドルーム約 `1.5 GiB`、`7b` は重み約
|
|
65
|
+
`7.0 GiB`、実行時ヘッドルーム約 `4.0 GiB` として登録されています。
|
|
66
|
+
- **未対応**:
|
|
67
|
+
テキストプロンプト、画像編集指示、LoRA 学習、複数画像入力は公開していません。
|
|
68
|
+
|
|
69
|
+
## Quickstart
|
|
70
|
+
|
|
71
|
+
### upscale - 画像をアップロード
|
|
72
|
+
|
|
73
|
+
先にソース画像を Files API にアップロードします。
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
IMG=$(curl -sS -X POST http://localhost:${PORT:-8000}/v1/files \
|
|
77
|
+
-F "file=@source.png" | jq -r .file_id)
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### upscale - 倍率で指定
|
|
81
|
+
|
|
82
|
+
画像だけを保存する:
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
PARAMS=$(
|
|
86
|
+
jq -n \
|
|
87
|
+
--arg image "$IMG" \
|
|
88
|
+
'{
|
|
89
|
+
model: "3b",
|
|
90
|
+
mode: "sync",
|
|
91
|
+
image: {type: "file_id", file_id: $image},
|
|
92
|
+
resolution: "2x",
|
|
93
|
+
softness: 0.0,
|
|
94
|
+
seed: 42
|
|
95
|
+
}'
|
|
96
|
+
)
|
|
97
|
+
|
|
98
|
+
curl -sS -X POST http://localhost:${PORT:-8000}/v1/image/seedvr2/upscale \
|
|
99
|
+
-H 'Content-Type: application/json' \
|
|
100
|
+
--data-binary "$PARAMS" \
|
|
101
|
+
-o seedvr2-2x.png
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Job JSON を返す:
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
PARAMS=$(
|
|
108
|
+
jq -n \
|
|
109
|
+
--arg image "$IMG" \
|
|
110
|
+
'{
|
|
111
|
+
model: "3b",
|
|
112
|
+
mode: "sync",
|
|
113
|
+
image: {type: "file_id", file_id: $image},
|
|
114
|
+
resolution: "2x",
|
|
115
|
+
format: "webp",
|
|
116
|
+
quality: 92,
|
|
117
|
+
seed: 7
|
|
118
|
+
}'
|
|
119
|
+
)
|
|
120
|
+
|
|
121
|
+
curl -sS -X POST http://localhost:${PORT:-8000}/v1/image/seedvr2/upscale \
|
|
122
|
+
-H 'Accept: application/json' \
|
|
123
|
+
-H 'Content-Type: application/json' \
|
|
124
|
+
--data-binary "$PARAMS" |
|
|
125
|
+
jq .
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### upscale - 最短辺ピクセル数で指定
|
|
129
|
+
|
|
130
|
+
最短辺を `768px` に合わせてアップスケールします。
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
PARAMS=$(
|
|
134
|
+
jq -n \
|
|
135
|
+
--arg image "$IMG" \
|
|
136
|
+
'{
|
|
137
|
+
mode: "sync",
|
|
138
|
+
image: {type: "file_id", file_id: $image},
|
|
139
|
+
resolution: 768,
|
|
140
|
+
softness: 0.15,
|
|
141
|
+
seed: 11
|
|
142
|
+
}'
|
|
143
|
+
)
|
|
144
|
+
|
|
145
|
+
curl -sS -X POST http://localhost:${PORT:-8000}/v1/image/seedvr2/upscale \
|
|
146
|
+
-H 'Content-Type: application/json' \
|
|
147
|
+
--data-binary "$PARAMS" \
|
|
148
|
+
-o seedvr2-768.png
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
`resolution` に `"768"` のような文字列を渡した場合も整数ターゲットとして解釈されます。
|
|
152
|
+
|
|
153
|
+
### 7b variant
|
|
154
|
+
|
|
155
|
+
```bash
|
|
156
|
+
PARAMS=$(
|
|
157
|
+
jq -n \
|
|
158
|
+
--arg image "$IMG" \
|
|
159
|
+
'{
|
|
160
|
+
model: "7b",
|
|
161
|
+
mode: "sync",
|
|
162
|
+
image: {type: "file_id", file_id: $image},
|
|
163
|
+
resolution: "2x",
|
|
164
|
+
seed: 13
|
|
165
|
+
}'
|
|
166
|
+
)
|
|
167
|
+
|
|
168
|
+
curl -sS -X POST http://localhost:${PORT:-8000}/v1/image/seedvr2/upscale \
|
|
169
|
+
-H 'Content-Type: application/json' \
|
|
170
|
+
--data-binary "$PARAMS" \
|
|
171
|
+
-o seedvr2-7b.png
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
### async
|
|
175
|
+
|
|
176
|
+
```bash
|
|
177
|
+
PARAMS=$(
|
|
178
|
+
jq -n \
|
|
179
|
+
--arg image "$IMG" \
|
|
180
|
+
'{
|
|
181
|
+
mode: "async",
|
|
182
|
+
image: {type: "file_id", file_id: $image},
|
|
183
|
+
resolution: "2x",
|
|
184
|
+
seed: 17
|
|
185
|
+
}'
|
|
186
|
+
)
|
|
187
|
+
|
|
188
|
+
JOB=$(curl -sS -X POST http://localhost:${PORT:-8000}/v1/image/seedvr2/upscale \
|
|
189
|
+
-H 'Accept: application/json' \
|
|
190
|
+
-H 'Content-Type: application/json' \
|
|
191
|
+
--data-binary "$PARAMS" |
|
|
192
|
+
jq -r .job_id)
|
|
193
|
+
|
|
194
|
+
curl -sS http://localhost:${PORT:-8000}/v1/jobs/$JOB | jq .
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
完了後、Job の `artifacts[0]` または `result.file_id` を使って画像を取得します。
|
|
198
|
+
|
|
199
|
+
```bash
|
|
200
|
+
FID=$(curl -sS http://localhost:${PORT:-8000}/v1/jobs/$JOB | jq -r .result.file_id)
|
|
201
|
+
curl -sS http://localhost:${PORT:-8000}/v1/files/$FID/download -o seedvr2-async.png
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
### quantize override
|
|
205
|
+
|
|
206
|
+
既定と異なる量子化で試す場合は `quantize` を明示します。この呼び出しは常駐モデルを
|
|
207
|
+
再利用せず、一時モデルを構築します。
|
|
208
|
+
|
|
209
|
+
```bash
|
|
210
|
+
PARAMS=$(
|
|
211
|
+
jq -n \
|
|
212
|
+
--arg image "$IMG" \
|
|
213
|
+
'{
|
|
214
|
+
model: "3b",
|
|
215
|
+
mode: "sync",
|
|
216
|
+
image: {type: "file_id", file_id: $image},
|
|
217
|
+
resolution: "1.5x",
|
|
218
|
+
quantize: 6,
|
|
219
|
+
seed: 19
|
|
220
|
+
}'
|
|
221
|
+
)
|
|
222
|
+
|
|
223
|
+
curl -sS -X POST http://localhost:${PORT:-8000}/v1/image/seedvr2/upscale \
|
|
224
|
+
-H 'Content-Type: application/json' \
|
|
225
|
+
--data-binary "$PARAMS" \
|
|
226
|
+
-o seedvr2-q6.png
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
### モデル一覧とヘルプ
|
|
230
|
+
|
|
231
|
+
```bash
|
|
232
|
+
curl -sS http://localhost:${PORT:-8000}/v1/image/seedvr2/models | jq .
|
|
233
|
+
curl -sS http://localhost:${PORT:-8000}/v1/image/seedvr2/openapi.json | jq .
|
|
234
|
+
```
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
# seedvr2
|
|
2
|
+
|
|
3
|
+
**English** | [日本語](README.ja.md)
|
|
4
|
+
|
|
5
|
+
[mflux SeedVR2](https://github.com/filipstrand/mflux/blob/main/src/mflux/models/seedvr2/README.md) provides single-image diffusion-based super-resolution/upscaling functionality.
|
|
6
|
+
SeedVR2 is an image-to-image super-resolution model that reconstructs details based on input images rather than prompt-driven image generation.
|
|
7
|
+
|
|
8
|
+
- **upscale**:
|
|
9
|
+
- Reference images already uploaded to Files API with `image` FileRef
|
|
10
|
+
- Specify the output size by the target number of pixels on the shortest side or by a scaling factor like `"2x"`
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
## API
|
|
14
|
+
|
|
15
|
+
| Endpoint | Name | Description |
|
|
16
|
+
|---|---|---|
|
|
17
|
+
| `POST /v1/image/seedvr2/upscale` | Image upscaling | Super-resolve the Files API image and generate one image. |
|
|
18
|
+
| `GET /v1/image/seedvr2/models` | Model list | Returns a list of available models. |
|
|
19
|
+
| `GET /v1/image/seedvr2/openapi.json` | OpenAPI | Return detailed input/output specifications, constraints, and TIPS. |
|
|
20
|
+
|
|
21
|
+
## API Docs
|
|
22
|
+
|
|
23
|
+
- [OpenAPI JSON](https://kiarina.github.io/kiapi/v1/image/seedvr2/openapi.json)
|
|
24
|
+
- [Swagger UI](https://kiarina.github.io/kiapi/v1/image/seedvr2/docs.html)
|
|
25
|
+
- [ReDoc](https://kiarina.github.io/kiapi/v1/image/seedvr2/redoc.html)
|
|
26
|
+
|
|
27
|
+
## Dependencies
|
|
28
|
+
|
|
29
|
+
| Package | License | Description |
|
|
30
|
+
|---|---|---|
|
|
31
|
+
| [mflux](https://github.com/filipstrand/mflux) | MIT | Uses SeedVR2's MLX implementation. |
|
|
32
|
+
|
|
33
|
+
## Models
|
|
34
|
+
|
|
35
|
+
| Model | License | Terms | Size | Description |
|
|
36
|
+
|---|---|---|---:|---|
|
|
37
|
+
| [numz/SeedVR2_comfyUI](https://huggingface.co/numz/SeedVR2_comfyUI) | Apache-2.0 | Not required | 7.3 GB | `3b` (default). Lightweight variant. Defaults are `resolution: "2x"`, `softness: 0.0`, `quantize: 8`. |
|
|
38
|
+
| [numz/SeedVR2_comfyUI](https://huggingface.co/numz/SeedVR2_comfyUI) | Apache-2.0 | Not required | 17 GB | `7b`. High capacity variant. It is heavier than `3b`, and the registered value of kiapi is expected to have a weight of about `7.0 GiB` and a runtime headroom of about `4.0 GiB`. |
|
|
39
|
+
|
|
40
|
+
Model weights can be replaced with `KIAPI_SEEDVR2_MODEL_REPO`.
|
|
41
|
+
Default is `numz/SeedVR2_comfyUI`.
|
|
42
|
+
|
|
43
|
+
## Notes
|
|
44
|
+
|
|
45
|
+
- **resolution**:
|
|
46
|
+
`resolution` is an integer shortest edge target or a scaling factor such as `"2x"` / `"1.5x"`.
|
|
47
|
+
The default is `16..2048` for integers, and `> 0` and less than or equal to `4.0x` for scale factors.
|
|
48
|
+
- **softness**:
|
|
49
|
+
`softness` is `0..1`. Default is `0.0`. Adjusts the softness of detail reconstruction of the input image.
|
|
50
|
+
- **seed**:
|
|
51
|
+
If `seed` is omitted, a random seed will be assigned for each request.
|
|
52
|
+
Please specify if reproducibility is required.
|
|
53
|
+
- **quantize override**:
|
|
54
|
+
`quantize` is `3` / `4` / `5` / `6` / `8` / `null`. Normally, the default `8` uses the resident model.
|
|
55
|
+
If you specify `quantize` that is different from the default value in the request, it will be loaded, executed, and released as a one-time temporary model.
|
|
56
|
+
- **Response format**:
|
|
57
|
+
If you generate one artifact with sync, it will return the raw image bytes unless you specify `Accept: application/json`.
|
|
58
|
+
You can reference saved artifacts and Jobs from the `X-Kiapi-File-Id` and `X-Kiapi-Job-Id` headers.
|
|
59
|
+
If you want Job JSON or async, use `Accept: application/json`.
|
|
60
|
+
- **Output format**:
|
|
61
|
+
`format` is `png` (default) / `jpeg` / `webp`. `quality` for `jpeg` / `webp`
|
|
62
|
+
Use `1..100` (default `90`).
|
|
63
|
+
- **Memory guideline**:
|
|
64
|
+
`3b` is the weight approximately `2.7 GiB`, runtime headroom is approximately `1.5 GiB`, `7b` is the weight approximately
|
|
65
|
+
Registered as `7.0 GiB`, runtime headroom approximately `4.0 GiB`.
|
|
66
|
+
- **Not supported**:
|
|
67
|
+
We do not publish text prompts, image editing instructions, LoRA learning, or multiple image input.
|
|
68
|
+
|
|
69
|
+
## Quickstart
|
|
70
|
+
|
|
71
|
+
### upscale - Upload image
|
|
72
|
+
|
|
73
|
+
First, upload the source image to the Files API.
|
|
74
|
+
```bash
|
|
75
|
+
IMG=$(curl -sS -X POST http://localhost:${PORT:-8000}/v1/files \
|
|
76
|
+
-F "file=@source.png" | jq -r .file_id)
|
|
77
|
+
```
|
|
78
|
+
### upscale - Specify by scale factor
|
|
79
|
+
|
|
80
|
+
Save only the image:
|
|
81
|
+
```bash
|
|
82
|
+
PARAMS=$(
|
|
83
|
+
jq -n \
|
|
84
|
+
--arg image "$IMG" \
|
|
85
|
+
'{
|
|
86
|
+
model: "3b",
|
|
87
|
+
mode: "sync",
|
|
88
|
+
image: {type: "file_id", file_id: $image},
|
|
89
|
+
resolution: "2x",
|
|
90
|
+
softness: 0.0,
|
|
91
|
+
seed: 42
|
|
92
|
+
}'
|
|
93
|
+
)
|
|
94
|
+
|
|
95
|
+
curl -sS -X POST http://localhost:${PORT:-8000}/v1/image/seedvr2/upscale \
|
|
96
|
+
-H 'Content-Type: application/json' \
|
|
97
|
+
--data-binary "$PARAMS" \
|
|
98
|
+
-o seedvr2-2x.png
|
|
99
|
+
```
|
|
100
|
+
Returns Job JSON:
|
|
101
|
+
```bash
|
|
102
|
+
PARAMS=$(
|
|
103
|
+
jq -n \
|
|
104
|
+
--arg image "$IMG" \
|
|
105
|
+
'{
|
|
106
|
+
model: "3b",
|
|
107
|
+
mode: "sync",
|
|
108
|
+
image: {type: "file_id", file_id: $image},
|
|
109
|
+
resolution: "2x",
|
|
110
|
+
format: "webp",
|
|
111
|
+
quality: 92,
|
|
112
|
+
seed: 7
|
|
113
|
+
}'
|
|
114
|
+
)
|
|
115
|
+
|
|
116
|
+
curl -sS -X POST http://localhost:${PORT:-8000}/v1/image/seedvr2/upscale \
|
|
117
|
+
-H 'Accept: application/json' \
|
|
118
|
+
-H 'Content-Type: application/json' \
|
|
119
|
+
--data-binary "$PARAMS" |
|
|
120
|
+
jq .
|
|
121
|
+
```
|
|
122
|
+
### upscale - Specified by the number of pixels on the shortest side
|
|
123
|
+
|
|
124
|
+
Upscale the shortest side to `768px`.
|
|
125
|
+
```bash
|
|
126
|
+
PARAMS=$(
|
|
127
|
+
jq -n \
|
|
128
|
+
--arg image "$IMG" \
|
|
129
|
+
'{
|
|
130
|
+
mode: "sync",
|
|
131
|
+
image: {type: "file_id", file_id: $image},
|
|
132
|
+
resolution: 768,
|
|
133
|
+
softness: 0.15,
|
|
134
|
+
seed: 11
|
|
135
|
+
}'
|
|
136
|
+
)
|
|
137
|
+
|
|
138
|
+
curl -sS -X POST http://localhost:${PORT:-8000}/v1/image/seedvr2/upscale \
|
|
139
|
+
-H 'Content-Type: application/json' \
|
|
140
|
+
--data-binary "$PARAMS" \
|
|
141
|
+
-o seedvr2-768.png
|
|
142
|
+
```
|
|
143
|
+
Passing a string like `"768" to `resolution` will also be interpreted as an integer target.
|
|
144
|
+
|
|
145
|
+
### 7b variant
|
|
146
|
+
```bash
|
|
147
|
+
PARAMS=$(
|
|
148
|
+
jq -n \
|
|
149
|
+
--arg image "$IMG" \
|
|
150
|
+
'{
|
|
151
|
+
model: "7b",
|
|
152
|
+
mode: "sync",
|
|
153
|
+
image: {type: "file_id", file_id: $image},
|
|
154
|
+
resolution: "2x",
|
|
155
|
+
seed: 13
|
|
156
|
+
}'
|
|
157
|
+
)
|
|
158
|
+
|
|
159
|
+
curl -sS -X POST http://localhost:${PORT:-8000}/v1/image/seedvr2/upscale \
|
|
160
|
+
-H 'Content-Type: application/json' \
|
|
161
|
+
--data-binary "$PARAMS" \
|
|
162
|
+
-o seedvr2-7b.png
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
### async
|
|
166
|
+
|
|
167
|
+
```bash
|
|
168
|
+
PARAMS=$(
|
|
169
|
+
jq -n \
|
|
170
|
+
--arg image "$IMG" \
|
|
171
|
+
'{
|
|
172
|
+
mode: "async",
|
|
173
|
+
image: {type: "file_id", file_id: $image},
|
|
174
|
+
resolution: "2x",
|
|
175
|
+
seed: 17
|
|
176
|
+
}'
|
|
177
|
+
)
|
|
178
|
+
|
|
179
|
+
JOB=$(curl -sS -X POST http://localhost:${PORT:-8000}/v1/image/seedvr2/upscale \
|
|
180
|
+
-H 'Accept: application/json' \
|
|
181
|
+
-H 'Content-Type: application/json' \
|
|
182
|
+
--data-binary "$PARAMS" |
|
|
183
|
+
jq -r .job_id)
|
|
184
|
+
|
|
185
|
+
curl -sS http://localhost:${PORT:-8000}/v1/jobs/$JOB | jq .
|
|
186
|
+
```
|
|
187
|
+
After completion, use the Job's `artifacts[0]` or `result.file_id` to get the image.
|
|
188
|
+
```bash
|
|
189
|
+
FID=$(curl -sS http://localhost:${PORT:-8000}/v1/jobs/$JOB | jq -r .result.file_id)
|
|
190
|
+
curl -sS http://localhost:${PORT:-8000}/v1/files/$FID/download -o seedvr2-async.png
|
|
191
|
+
```
|
|
192
|
+
### quantize override
|
|
193
|
+
|
|
194
|
+
Specify `quantize` if you want to try a different quantization than the default. This call calls the resident model
|
|
195
|
+
Build a temporary model without reusing it.
|
|
196
|
+
```bash
|
|
197
|
+
PARAMS=$(
|
|
198
|
+
jq -n \
|
|
199
|
+
--arg image "$IMG" \
|
|
200
|
+
'{
|
|
201
|
+
model: "3b",
|
|
202
|
+
mode: "sync",
|
|
203
|
+
image: {type: "file_id", file_id: $image},
|
|
204
|
+
resolution: "1.5x",
|
|
205
|
+
quantize: 6,
|
|
206
|
+
seed: 19
|
|
207
|
+
}'
|
|
208
|
+
)
|
|
209
|
+
|
|
210
|
+
curl -sS -X POST http://localhost:${PORT:-8000}/v1/image/seedvr2/upscale \
|
|
211
|
+
-H 'Content-Type: application/json' \
|
|
212
|
+
--data-binary "$PARAMS" \
|
|
213
|
+
-o seedvr2-q6.png
|
|
214
|
+
```
|
|
215
|
+
### Model list and help
|
|
216
|
+
```bash
|
|
217
|
+
curl -sS http://localhost:${PORT:-8000}/v1/image/seedvr2/models | jq .
|
|
218
|
+
curl -sS http://localhost:${PORT:-8000}/v1/image/seedvr2/openapi.json | jq .
|
|
219
|
+
```
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"""seedvr2 family — diffusion super-resolution / upscale via mflux.
|
|
2
|
+
|
|
3
|
+
Endpoint: ``POST /v1/image/seedvr2/upscale``. SeedVR2 is not a prompt-driven
|
|
4
|
+
image generator; it takes an input image from the Files API and produces an
|
|
5
|
+
upscaled image. Variants are ``3b`` (default) and ``7b``. A ``quantize`` override
|
|
6
|
+
runs a one-off transient model; otherwise the resident model is used.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
from kiapi.capabilities import ValidationError
|
|
10
|
+
|
|
11
|
+
from ._helpers.register import register
|
|
12
|
+
from ._helpers.validate_upscale import validate_upscale
|
|
13
|
+
from ._operations.handle_upscale import handle_upscale
|
|
14
|
+
from ._settings import settings_manager
|
|
15
|
+
from ._views.upscale_request import UpscaleRequest
|
|
16
|
+
|
|
17
|
+
__all__ = [
|
|
18
|
+
"UpscaleRequest", # ._views
|
|
19
|
+
"ValidationError", # kiapi.capabilities
|
|
20
|
+
"handle_upscale", # ._operations
|
|
21
|
+
"register", # ._helpers
|
|
22
|
+
"settings_manager", # ._settings
|
|
23
|
+
"validate_upscale", # ._helpers
|
|
24
|
+
]
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
DESCRIPTION = """Image super-resolution upscaling (SeedVR2 via mflux).
|
|
2
|
+
|
|
3
|
+
One operation: `/upscale` takes an input image and produces a higher-resolution
|
|
4
|
+
version. SeedVR2 is diffusion-based super-resolution, **not** prompt-driven image
|
|
5
|
+
generation — there is no prompt. To create or edit images from text, use the
|
|
6
|
+
qwen / flux2 / zimage / ideogram4 families instead.
|
|
7
|
+
|
|
8
|
+
## Upstream docs
|
|
9
|
+
- [mflux — SeedVR2](https://github.com/filipstrand/mflux/blob/main/src/mflux/models/seedvr2/README.md) — the MLX engine kiapi runs
|
|
10
|
+
- [numz/SeedVR2_comfyUI](https://huggingface.co/numz/SeedVR2_comfyUI) — weights
|
|
11
|
+
|
|
12
|
+
## Models
|
|
13
|
+
- **3b** (default) — faster, lighter; good general upscaler.
|
|
14
|
+
- **7b** — larger variant, higher quality at a higher memory/time cost.
|
|
15
|
+
|
|
16
|
+
Discover variants at `GET /v1/image/seedvr2/models`. An omitted `quantize` uses
|
|
17
|
+
the resident model's quantization (q8); the resolved values are recorded in the
|
|
18
|
+
result `params`.
|
|
19
|
+
|
|
20
|
+
## Sizing the output
|
|
21
|
+
`resolution` accepts either form:
|
|
22
|
+
- an **integer** shortest-edge pixel target (16..2048), or
|
|
23
|
+
- a **scale factor** string like `2x` or `1.5x` (> 0 and at most 4.0x).
|
|
24
|
+
|
|
25
|
+
`softness` (0..1) trades sharpness for smoothing; leave it at 0 for the crispest
|
|
26
|
+
result.
|
|
27
|
+
|
|
28
|
+
## Resident vs transient runs
|
|
29
|
+
The warmed, resident model uses the server-default quantization (q8). A request
|
|
30
|
+
that sets a `quantize` differing from the resident model builds a **one-off
|
|
31
|
+
transient model** for that call — weights load fresh, so it is slower and not
|
|
32
|
+
reused. For the fast path, leave `quantize` unset.
|
|
33
|
+
|
|
34
|
+
## TIPS
|
|
35
|
+
- For a quick result, call `sync` without `Accept: application/json` to get the
|
|
36
|
+
raw bytes straight back (`curl -o out.png`).
|
|
37
|
+
- Upscaling a large source image to a high `resolution` raises peak memory; the
|
|
38
|
+
request can 503 if it does not fit the global memory budget — try the `3b`
|
|
39
|
+
variant or a smaller target.
|
|
40
|
+
- First use downloads the SeedVR2 weights; run `kiapi activate` ahead of time to
|
|
41
|
+
avoid a cold-start download on the first request.
|
|
42
|
+
|
|
43
|
+
## Performance
|
|
44
|
+
- **3b**: 256→512 q8 first-run peak ~3929 MiB; cached 256→768 peak ~1756 MiB.
|
|
45
|
+
- **7b**: larger variant; estimate only until measured locally.
|
|
46
|
+
"""
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"""Register seedvr2's models + OpenAPI description in the global registries."""
|
|
2
|
+
|
|
3
|
+
from kiapi.core.capability import CapabilitySpec, capability_spec_registry
|
|
4
|
+
from kiapi.core.model import ModelSpec, model_registry
|
|
5
|
+
from kiapi.core.setup import HfSnapshotResource
|
|
6
|
+
|
|
7
|
+
from .._constants.description import DESCRIPTION
|
|
8
|
+
from .._models import seedvr2
|
|
9
|
+
from .._settings import settings_manager
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def register() -> None:
|
|
13
|
+
capability_spec_registry.register(
|
|
14
|
+
CapabilitySpec(
|
|
15
|
+
name="seedvr2",
|
|
16
|
+
domain="image",
|
|
17
|
+
title="kiapi SeedVR2 API",
|
|
18
|
+
summary="Upscale and restore images with SeedVR2.",
|
|
19
|
+
description=DESCRIPTION,
|
|
20
|
+
openapi_path="/v1/image/seedvr2/openapi.json",
|
|
21
|
+
docs_path="/v1/image/seedvr2/docs",
|
|
22
|
+
redoc_path="/v1/image/seedvr2/redoc",
|
|
23
|
+
path_prefixes=("/v1/image/seedvr2",),
|
|
24
|
+
)
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
_s = settings_manager.get_settings()
|
|
28
|
+
|
|
29
|
+
model_registry.register(
|
|
30
|
+
ModelSpec(
|
|
31
|
+
name="3b",
|
|
32
|
+
family="seedvr2",
|
|
33
|
+
domain="image",
|
|
34
|
+
repo=f"{_s.model_repo}#3b",
|
|
35
|
+
module=seedvr2,
|
|
36
|
+
weight_gb=2.7,
|
|
37
|
+
peak_headroom_gb=1.5,
|
|
38
|
+
framework="mlx",
|
|
39
|
+
priority=0,
|
|
40
|
+
aliases=("seedvr2-3b", "seedvr2"),
|
|
41
|
+
default=True,
|
|
42
|
+
setup_resources=(HfSnapshotResource(repo=_s.model_repo, disk_gb=7.3),),
|
|
43
|
+
)
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
model_registry.register(
|
|
47
|
+
ModelSpec(
|
|
48
|
+
name="7b",
|
|
49
|
+
family="seedvr2",
|
|
50
|
+
domain="image",
|
|
51
|
+
repo=f"{_s.model_repo}#7b",
|
|
52
|
+
module=seedvr2,
|
|
53
|
+
weight_gb=7.0,
|
|
54
|
+
peak_headroom_gb=4.0,
|
|
55
|
+
framework="mlx",
|
|
56
|
+
priority=0,
|
|
57
|
+
aliases=("seedvr2-7b", "seedvr2-7B"),
|
|
58
|
+
setup_resources=(HfSnapshotResource(repo=_s.model_repo, disk_gb=17.0),),
|
|
59
|
+
)
|
|
60
|
+
)
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
from kiapi.capabilities import ValidationError
|
|
2
|
+
|
|
3
|
+
from .._settings import settings_manager
|
|
4
|
+
from .._views.upscale_request import UpscaleRequest
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def _parse_scale(value: str) -> float | None:
|
|
8
|
+
if not value.endswith("x"):
|
|
9
|
+
return None
|
|
10
|
+
raw = value[:-1]
|
|
11
|
+
try:
|
|
12
|
+
return float(raw)
|
|
13
|
+
except ValueError:
|
|
14
|
+
raise ValidationError("resolution scale must look like '2x' or '1.5x'") # noqa: B904
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def validate_upscale(req: UpscaleRequest) -> None:
|
|
18
|
+
settings = settings_manager.get_settings()
|
|
19
|
+
if req.quantize is not None and req.quantize not in (3, 4, 5, 6, 8):
|
|
20
|
+
raise ValidationError("quantize must be one of 3, 4, 5, 6, 8")
|
|
21
|
+
if not 0.0 <= req.softness <= 1.0:
|
|
22
|
+
raise ValidationError("softness must be in 0..1")
|
|
23
|
+
|
|
24
|
+
resolution = req.resolution
|
|
25
|
+
if isinstance(resolution, int):
|
|
26
|
+
if resolution < settings.min_resolution or resolution > settings.max_resolution:
|
|
27
|
+
raise ValidationError(
|
|
28
|
+
f"resolution must be in {settings.min_resolution}..{settings.max_resolution}"
|
|
29
|
+
)
|
|
30
|
+
return
|
|
31
|
+
|
|
32
|
+
if not isinstance(resolution, str):
|
|
33
|
+
raise ValidationError(
|
|
34
|
+
"resolution must be an integer shortest-edge target or a scale like '2x'"
|
|
35
|
+
)
|
|
36
|
+
if resolution.endswith("x"):
|
|
37
|
+
scale = _parse_scale(resolution)
|
|
38
|
+
if scale is None or scale <= 0 or scale > settings.max_scale:
|
|
39
|
+
raise ValidationError(
|
|
40
|
+
f"resolution scale must be > 0 and <= {settings.max_scale}x"
|
|
41
|
+
)
|
|
42
|
+
return
|
|
43
|
+
try:
|
|
44
|
+
pixels = int(resolution)
|
|
45
|
+
except ValueError:
|
|
46
|
+
raise ValidationError( # noqa: B904
|
|
47
|
+
"resolution must be an integer shortest-edge target or a scale like '2x'"
|
|
48
|
+
)
|
|
49
|
+
if pixels < settings.min_resolution or pixels > settings.max_resolution:
|
|
50
|
+
raise ValidationError(
|
|
51
|
+
f"resolution must be in {settings.min_resolution}..{settings.max_resolution}"
|
|
52
|
+
)
|