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,50 @@
|
|
|
1
|
+
"""Idempotently register a denoising-progress callback on an mflux model.
|
|
2
|
+
|
|
3
|
+
Called right before ``model.generate_image(...)`` in each image family's
|
|
4
|
+
generation helper. Every mflux model exposes ``model.callbacks`` (a
|
|
5
|
+
``CallbackRegistry``) and runs ``ctx.in_loop(t, latents)`` once per denoise step;
|
|
6
|
+
the registry routes anything with ``call_in_loop`` to the in-loop list.
|
|
7
|
+
|
|
8
|
+
The callback holds no per-job state — it reads the job's ambient
|
|
9
|
+
:class:`ProgressReporter` (see core/job) each step — so a single instance can stay
|
|
10
|
+
registered on a resident model and serve every job (silently no-op when no job is
|
|
11
|
+
bound). Models built via different paths (resident ``load`` vs one-off transient
|
|
12
|
+
builds) all funnel through here, and resident models persist across jobs, so
|
|
13
|
+
registration is idempotent to avoid stacking a fresh callback per call.
|
|
14
|
+
"""
|
|
15
|
+
|
|
16
|
+
from typing import Any
|
|
17
|
+
|
|
18
|
+
from kiapi.core.job import ProgressReporter
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class _MfluxProgressCallback:
|
|
22
|
+
def __init__(self, label: str = "denoising") -> None:
|
|
23
|
+
self._label = label
|
|
24
|
+
|
|
25
|
+
def call_in_loop(
|
|
26
|
+
self,
|
|
27
|
+
t: int,
|
|
28
|
+
seed: int,
|
|
29
|
+
prompt: str,
|
|
30
|
+
latents: Any,
|
|
31
|
+
config: Any,
|
|
32
|
+
time_steps: Any,
|
|
33
|
+
) -> None:
|
|
34
|
+
# ``time_steps`` is the tqdm driving the loop; ``.n`` counts steps
|
|
35
|
+
# completed before this one, so ``n + 1`` are done after it.
|
|
36
|
+
total = getattr(time_steps, "total", 0) or getattr(
|
|
37
|
+
config, "num_inference_steps", 0
|
|
38
|
+
)
|
|
39
|
+
done = getattr(time_steps, "n", 0) + 1
|
|
40
|
+
ProgressReporter.current().step(int(done), int(total), self._label)
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def attach_mflux_progress(model: Any, *, label: str = "denoising") -> None:
|
|
44
|
+
registry = getattr(model, "callbacks", None)
|
|
45
|
+
if registry is None:
|
|
46
|
+
return # not an mflux model with a callback registry; nothing to do
|
|
47
|
+
in_loop = getattr(registry, "in_loop", [])
|
|
48
|
+
if any(isinstance(cb, _MfluxProgressCallback) for cb in in_loop):
|
|
49
|
+
return # already attached (resident model reused across jobs)
|
|
50
|
+
registry.register(_MfluxProgressCallback(label=label))
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
from kiapi.core.file import FileRef, FileStore, resolve_file_ref
|
|
2
|
+
|
|
3
|
+
from .._exceptions.CapabilityError import CapabilityError
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def get_file_path(
|
|
7
|
+
file_store: FileStore,
|
|
8
|
+
file: str | FileRef,
|
|
9
|
+
*,
|
|
10
|
+
kind: str,
|
|
11
|
+
) -> str:
|
|
12
|
+
try:
|
|
13
|
+
if isinstance(file, str):
|
|
14
|
+
rec = file_store.get(file)
|
|
15
|
+
if rec is None:
|
|
16
|
+
raise FileNotFoundError(f"unknown {kind} file_id {file!r}")
|
|
17
|
+
return rec.path
|
|
18
|
+
return resolve_file_ref(file_store, file, kind=kind).path
|
|
19
|
+
except (FileNotFoundError, ValueError) as exc:
|
|
20
|
+
raise CapabilityError(str(exc)) from exc
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
from kiapi.core.file import FileRef, FileStore, ResolvedFileRef
|
|
2
|
+
from kiapi.core.file import resolve_file_ref as core_resolve_file_ref
|
|
3
|
+
|
|
4
|
+
from .._exceptions.CapabilityError import CapabilityError
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def resolve_file_ref(
|
|
8
|
+
file_store: FileStore,
|
|
9
|
+
ref: FileRef,
|
|
10
|
+
*,
|
|
11
|
+
kind: str,
|
|
12
|
+
) -> ResolvedFileRef:
|
|
13
|
+
try:
|
|
14
|
+
return core_resolve_file_ref(file_store, ref, kind=kind)
|
|
15
|
+
except (FileNotFoundError, ValueError) as exc:
|
|
16
|
+
raise CapabilityError(str(exc)) from exc
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
# acestep
|
|
2
|
+
|
|
3
|
+
[English](README.md) | **日本語**
|
|
4
|
+
|
|
5
|
+
[ACE-Step 1.5](https://github.com/ace-step/ACE-Step-1.5) で、下記の機能を提供します。
|
|
6
|
+
- 音楽生成
|
|
7
|
+
- 既存の曲のスタイル変換
|
|
8
|
+
- 曲の一部の再生成
|
|
9
|
+
- 音源分離
|
|
10
|
+
|
|
11
|
+
## API
|
|
12
|
+
|
|
13
|
+
| Endpoint | Name | Description |
|
|
14
|
+
|---|---|---|
|
|
15
|
+
| `POST /v1/audio/acestep/generate` | 音楽生成 | プロンプト, 詩, 時間, 言語を指定して曲を生成。 |
|
|
16
|
+
| `POST /v1/audio/acestep/cover` | スタイル変換 | 既存の曲の構成を保ったまま別スタイルに変換。 |
|
|
17
|
+
| `POST /v1/audio/acestep/repaint` | 一部再生成 | 曲の時間範囲を再生成。 |
|
|
18
|
+
| `POST /v1/audio/acestep/extract` | 音源分離 | 曲のボーカル・ドラムなどの音源を分離。 |
|
|
19
|
+
| `GET /v1/audio/acestep/models` | モデル一覧 | 利用可能なモデルの一覧を返す。 |
|
|
20
|
+
| `GET /v1/audio/acestep/openapi.json` | OpenAPI | 詳細な入出力仕様、使い方、TIPS を返す。 |
|
|
21
|
+
|
|
22
|
+
## API Docs
|
|
23
|
+
|
|
24
|
+
- [OpenAPI JSON](https://kiarina.github.io/kiapi/v1/audio/acestep/openapi.json)
|
|
25
|
+
- [Swagger UI](https://kiarina.github.io/kiapi/v1/audio/acestep/docs.html)
|
|
26
|
+
- [ReDoc](https://kiarina.github.io/kiapi/v1/audio/acestep/redoc.html)
|
|
27
|
+
|
|
28
|
+
## Dependencies
|
|
29
|
+
|
|
30
|
+
| Package | License | Description |
|
|
31
|
+
|---|---|---|
|
|
32
|
+
| [ace-step](https://github.com/ace-step/ACE-Step-1.5) | MIT | ACE-Step 1.5 本体。 |
|
|
33
|
+
| [transformers](https://github.com/huggingface/transformers) | Apache-2.0 | ace-step が要求する 4.x 系。 |
|
|
34
|
+
| [PyTorch](https://github.com/pytorch/pytorch) | BSD-3-Clause | ace-step の依存として導入される。 |
|
|
35
|
+
|
|
36
|
+
## Models
|
|
37
|
+
|
|
38
|
+
| Model | License | Terms | Size | Description |
|
|
39
|
+
|---|---|---|---:|---|
|
|
40
|
+
| [ACE-Step/acestep-v15-xl-base](https://huggingface.co/ACE-Step/acestep-v15-xl-base) | MIT | 不要 | 19 GB | `xl-base`(デフォルト)。32ステップ / `guidance_scale=7.0`、最高品質。30秒の音声で約25秒(M4 Max)。 |
|
|
41
|
+
| [ACE-Step/Ace-Step1.5](https://huggingface.co/ACE-Step/Ace-Step1.5) | MIT | 不要 | 9.4 GB | `turbo`(8ステップ、`guidance_scale` を無視)の DiT に加え、5Hz LM・VAE・Qwen3-Embedding-0.6B を同梱。速度重視で15秒で約4秒(M4 Max)。 |
|
|
42
|
+
| [Qwen/Qwen3-Embedding-0.6B](https://huggingface.co/Qwen/Qwen3-Embedding-0.6B) | Apache-2.0 | 不要 | 1.1 GB | テキストエンコーダ。ACE-Step/Ace-Step1.5 に同梱。 |
|
|
43
|
+
|
|
44
|
+
## Notes
|
|
45
|
+
|
|
46
|
+
- **transformers 4.x の隔離**:
|
|
47
|
+
ACE-Step 1.5 は **transformers 4.x** をピンしており、スタック全体が必要とする **transformers 5.x** と競合する。
|
|
48
|
+
そのため ace-step は専用の **venv** でサブプロセスとして実行する。
|
|
49
|
+
メインプロセスは **`acestep` を import しない**。
|
|
50
|
+
- **ローカル配置**:
|
|
51
|
+
`KIAPI_ACESTEP_PYTHON_PATH`, `KIAPI_ACESTEP_PROJECT_ROOT`, `KIAPI_ACESTEP_CHECKPOINT_DIR`
|
|
52
|
+
が未指定の場合、ACE-Step 用の venv / project / checkpoints は
|
|
53
|
+
`core/app` の user data dir 配下の `acestep/` に配置する。
|
|
54
|
+
- **IPC**:
|
|
55
|
+
メインプロセスはワーカーと stdin/stdout 上の小さな行指向 JSON プロトコルで通信する。
|
|
56
|
+
各行に `@@KIAPI@@` センチネルを前置。それ以外の stdout はノイズ扱い。
|
|
57
|
+
加えて音声 I/O はファイルパスでやり取りする。
|
|
58
|
+
progress コールバックはジョブの `ProgressReporter` に転送される。
|
|
59
|
+
|
|
60
|
+
## Quickstart
|
|
61
|
+
|
|
62
|
+
### generate - 音楽生成
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
jq -n \
|
|
66
|
+
--arg prompt "Modern J-Pop, 132 BPM, bright piano, emotional electric guitar, upbeat drums" \
|
|
67
|
+
--arg lyrics '[Verse 1]
|
|
68
|
+
加速する世界の中で
|
|
69
|
+
君の声が聴こえてくる
|
|
70
|
+
|
|
71
|
+
[Chorus]
|
|
72
|
+
僕らは光を追いかける
|
|
73
|
+
終わらない夢の向こうへ
|
|
74
|
+
' \
|
|
75
|
+
'{
|
|
76
|
+
model: "turbo",
|
|
77
|
+
mode: "sync",
|
|
78
|
+
prompt: $prompt,
|
|
79
|
+
lyrics: $lyrics,
|
|
80
|
+
duration: 30,
|
|
81
|
+
lang: "ja",
|
|
82
|
+
seed: 1
|
|
83
|
+
}' |
|
|
84
|
+
curl -sS -X POST http://localhost:${PORT:-8000}/v1/audio/acestep/generate \
|
|
85
|
+
-H 'Content-Type: application/json' \
|
|
86
|
+
--data-binary @- \
|
|
87
|
+
-o song.wav
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### cover - スタイル変換
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
SRC=$(
|
|
94
|
+
curl -sS -X POST http://localhost:${PORT:-8000}/v1/files -F "file=@song.wav" |
|
|
95
|
+
jq -r .file_id
|
|
96
|
+
)
|
|
97
|
+
|
|
98
|
+
jq -n \
|
|
99
|
+
--arg src "$SRC" \
|
|
100
|
+
--arg prompt "City Pop, groovy bass, smooth guitar, laid-back 80s production" \
|
|
101
|
+
'{
|
|
102
|
+
model: "turbo",
|
|
103
|
+
mode: "sync",
|
|
104
|
+
source: {type: "file_id", file_id: $src},
|
|
105
|
+
prompt: $prompt,
|
|
106
|
+
strength: 0.7,
|
|
107
|
+
seed: 1
|
|
108
|
+
}' |
|
|
109
|
+
curl -sS -X POST http://localhost:${PORT:-8000}/v1/audio/acestep/cover \
|
|
110
|
+
-H 'Content-Type: application/json' \
|
|
111
|
+
--data-binary @- \
|
|
112
|
+
-o cover.wav
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
`strength`: 0.3 = 緩い再解釈。0.7 = 構成を保ちつつスタイルを変える。1.0 = 厳密。
|
|
116
|
+
|
|
117
|
+
### repaint - 時間範囲を再生成
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
SRC=$(
|
|
121
|
+
curl -sS -X POST http://localhost:${PORT:-8000}/v1/files -F "file=@song.wav" |
|
|
122
|
+
jq -r .file_id
|
|
123
|
+
)
|
|
124
|
+
|
|
125
|
+
jq -n \
|
|
126
|
+
--arg src "$SRC" \
|
|
127
|
+
--arg prompt "Dramatic orchestral strings, emotional swell, cinematic" \
|
|
128
|
+
'{
|
|
129
|
+
model: "turbo",
|
|
130
|
+
mode: "sync",
|
|
131
|
+
source: {type: "file_id", file_id: $src},
|
|
132
|
+
prompt: $prompt,
|
|
133
|
+
start: 15,
|
|
134
|
+
end: 30,
|
|
135
|
+
strength: 0.6,
|
|
136
|
+
seed: 1
|
|
137
|
+
}' |
|
|
138
|
+
curl -sS -X POST http://localhost:${PORT:-8000}/v1/audio/acestep/repaint \
|
|
139
|
+
-H 'Content-Type: application/json' \
|
|
140
|
+
--data-binary @- \
|
|
141
|
+
-o repainted.wav
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
`start`/`end` は秒単位(`end: -1` = 最後まで)。
|
|
145
|
+
|
|
146
|
+
### extract - 音源分離
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
SRC=$(
|
|
150
|
+
curl -sS -X POST http://localhost:${PORT:-8000}/v1/files -F "file=@song.wav" |
|
|
151
|
+
jq -r .file_id
|
|
152
|
+
)
|
|
153
|
+
|
|
154
|
+
RESP=$(
|
|
155
|
+
jq -n \
|
|
156
|
+
--arg src "$SRC" \
|
|
157
|
+
'{
|
|
158
|
+
model: "turbo",
|
|
159
|
+
mode: "sync",
|
|
160
|
+
source: {type: "file_id", file_id: $src},
|
|
161
|
+
targets: ["vocals", "drums", "bass", "other"]
|
|
162
|
+
}' |
|
|
163
|
+
curl -sS -X POST http://localhost:${PORT:-8000}/v1/audio/acestep/extract \
|
|
164
|
+
-H 'Content-Type: application/json' \
|
|
165
|
+
-H 'Accept: application/json' \
|
|
166
|
+
--data-binary @-
|
|
167
|
+
)
|
|
168
|
+
|
|
169
|
+
# 各音源をダウンロード(stems[] にターゲット名が入る)
|
|
170
|
+
echo "$RESP" | jq -c '.result.stems[]' | while read -r s; do
|
|
171
|
+
TARGET=$(echo "$s" | jq -r .target); FID=$(echo "$s" | jq -r .file_id)
|
|
172
|
+
curl -o "${TARGET}.wav" http://localhost:${PORT:-8000}/v1/files/$FID/download
|
|
173
|
+
done
|
|
174
|
+
```
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
# acestep
|
|
2
|
+
|
|
3
|
+
**English** | [日本語](README.ja.md)
|
|
4
|
+
|
|
5
|
+
[ACE-Step 1.5](https://github.com/ace-step/ACE-Step-1.5) provides the following functions.
|
|
6
|
+
- Music generation
|
|
7
|
+
- Style conversion of existing songs
|
|
8
|
+
- Regenerate part of a song
|
|
9
|
+
- Sound source separation
|
|
10
|
+
|
|
11
|
+
## API
|
|
12
|
+
|
|
13
|
+
| Endpoint | Name | Description |
|
|
14
|
+
|---|---|---|
|
|
15
|
+
| `POST /v1/audio/acestep/generate` | Music generation | Generate a song by specifying prompt, poem, time, and language. |
|
|
16
|
+
| `POST /v1/audio/acestep/cover` | Style conversion | Convert an existing song to a different style while preserving its structure. |
|
|
17
|
+
| `POST /v1/audio/acestep/repaint` | Partial regeneration | Regenerate the time range of the song. |
|
|
18
|
+
| `POST /v1/audio/acestep/extract` | Sound source separation | Separate the sound sources such as vocals and drums of a song. |
|
|
19
|
+
| `GET /v1/audio/acestep/models` | Model list | Returns a list of available models. |
|
|
20
|
+
| `GET /v1/audio/acestep/openapi.json` | OpenAPI | Returns detailed input/output specifications, usage, and TIPS. |
|
|
21
|
+
|
|
22
|
+
## API Docs
|
|
23
|
+
|
|
24
|
+
- [OpenAPI JSON](https://kiarina.github.io/kiapi/v1/audio/acestep/openapi.json)
|
|
25
|
+
- [Swagger UI](https://kiarina.github.io/kiapi/v1/audio/acestep/docs.html)
|
|
26
|
+
- [ReDoc](https://kiarina.github.io/kiapi/v1/audio/acestep/redoc.html)
|
|
27
|
+
|
|
28
|
+
## Dependencies
|
|
29
|
+
|
|
30
|
+
| Package | License | Description |
|
|
31
|
+
|---|---|---|
|
|
32
|
+
| [ace-step](https://github.com/ace-step/ACE-Step-1.5) | MIT | ACE-Step 1.5 main body. |
|
|
33
|
+
| [transformers](https://github.com/huggingface/transformers) | Apache-2.0 | 4.x version required by ace-step. |
|
|
34
|
+
| [PyTorch](https://github.com/pytorch/pytorch) | BSD-3-Clause | Introduced as a dependency of ace-step. |
|
|
35
|
+
|
|
36
|
+
## Models
|
|
37
|
+
|
|
38
|
+
| Model | License | Terms | Size | Description |
|
|
39
|
+
|---|---|---|---:|---|
|
|
40
|
+
| [ACE-Step/acestep-v15-xl-base](https://huggingface.co/ACE-Step/acestep-v15-xl-base) | MIT | Not required | 19 GB | `xl-base` (default). 32 steps / `guidance_scale=7.0`, highest quality. Approximately 25 seconds with 30 seconds of audio (M4 Max). |
|
|
41
|
+
| [ACE-Step/Ace-Step1.5](https://huggingface.co/ACE-Step/Ace-Step1.5) | MIT | Not required | 9.4 GB | In addition to `turbo` (8 steps, ignoring `guidance_scale`) DiT, 5Hz LM, VAE, and Qwen3-Embedding-0.6B are included. Focusing on speed, 15 seconds is about 4 seconds (M4 Max). |
|
|
42
|
+
| [Qwen/Qwen3-Embedding-0.6B](https://huggingface.co/Qwen/Qwen3-Embedding-0.6B) | Apache-2.0 | Not required | 1.1 GB | Text encoder. Included with ACE-Step/Ace-Step1.5. |
|
|
43
|
+
|
|
44
|
+
## Notes
|
|
45
|
+
|
|
46
|
+
- **Isolation of transformers 4.x**:
|
|
47
|
+
ACE-Step 1.5 pins **transformers 4.x** and conflicts with **transformers 5.x**, which requires the entire stack.
|
|
48
|
+
Therefore, ace-step is executed as a subprocess in a dedicated **venv**.
|
|
49
|
+
The main process does not import `acestep`.
|
|
50
|
+
- **Local placement**:
|
|
51
|
+
`KIAPI_ACESTEP_PYTHON_PATH`, `KIAPI_ACESTEP_PROJECT_ROOT`, `KIAPI_ACESTEP_CHECKPOINT_DIR`
|
|
52
|
+
If is not specified, venv / project / checkpoints for ACE-Step is
|
|
53
|
+
Place it in `acestep/` under the user data dir of `core/app`.
|
|
54
|
+
- **IPC**:
|
|
55
|
+
The main process communicates with workers using a small line-oriented JSON protocol on stdin/stdout.
|
|
56
|
+
Prefix each line with `@@KIAPI@@` sentinel. Other stdout is treated as noise.
|
|
57
|
+
In addition, audio I/O is exchanged using file paths.
|
|
58
|
+
The progress callback is forwarded to the job's `ProgressReporter`.
|
|
59
|
+
|
|
60
|
+
## Quickstart
|
|
61
|
+
|
|
62
|
+
### generate - music generation
|
|
63
|
+
```bash
|
|
64
|
+
jq -n \
|
|
65
|
+
--arg prompt "Modern J-Pop, 132 BPM, bright piano, emotional electric guitar, upbeat drums" \
|
|
66
|
+
--arg lyrics '[Verse 1]
|
|
67
|
+
加速する世界の中で
|
|
68
|
+
君の声が聴こえてくる
|
|
69
|
+
|
|
70
|
+
[Chorus]
|
|
71
|
+
僕らは光を追いかける
|
|
72
|
+
終わらない夢の向こうへ
|
|
73
|
+
' \
|
|
74
|
+
'{
|
|
75
|
+
model: "turbo",
|
|
76
|
+
mode: "sync",
|
|
77
|
+
prompt: $prompt,
|
|
78
|
+
lyrics: $lyrics,
|
|
79
|
+
duration: 30,
|
|
80
|
+
lang: "ja",
|
|
81
|
+
seed: 1
|
|
82
|
+
}' |
|
|
83
|
+
curl -sS -X POST http://localhost:${PORT:-8000}/v1/audio/acestep/generate \
|
|
84
|
+
-H 'Content-Type: application/json' \
|
|
85
|
+
--data-binary @- \
|
|
86
|
+
-o song.wav
|
|
87
|
+
```
|
|
88
|
+
### cover - style conversion
|
|
89
|
+
```bash
|
|
90
|
+
SRC=$(
|
|
91
|
+
curl -sS -X POST http://localhost:${PORT:-8000}/v1/files -F "file=@song.wav" |
|
|
92
|
+
jq -r .file_id
|
|
93
|
+
)
|
|
94
|
+
|
|
95
|
+
jq -n \
|
|
96
|
+
--arg src "$SRC" \
|
|
97
|
+
--arg prompt "City Pop, groovy bass, smooth guitar, laid-back 80s production" \
|
|
98
|
+
'{
|
|
99
|
+
model: "turbo",
|
|
100
|
+
mode: "sync",
|
|
101
|
+
source: {type: "file_id", file_id: $src},
|
|
102
|
+
prompt: $prompt,
|
|
103
|
+
strength: 0.7,
|
|
104
|
+
seed: 1
|
|
105
|
+
}' |
|
|
106
|
+
curl -sS -X POST http://localhost:${PORT:-8000}/v1/audio/acestep/cover \
|
|
107
|
+
-H 'Content-Type: application/json' \
|
|
108
|
+
--data-binary @- \
|
|
109
|
+
-o cover.wav
|
|
110
|
+
```
|
|
111
|
+
`strength`: 0.3 = loose reinterpretation. 0.7 = Change style while keeping composition. 1.0 = strict.
|
|
112
|
+
|
|
113
|
+
### repaint - regenerate time range
|
|
114
|
+
```bash
|
|
115
|
+
SRC=$(
|
|
116
|
+
curl -sS -X POST http://localhost:${PORT:-8000}/v1/files -F "file=@song.wav" |
|
|
117
|
+
jq -r .file_id
|
|
118
|
+
)
|
|
119
|
+
|
|
120
|
+
jq -n \
|
|
121
|
+
--arg src "$SRC" \
|
|
122
|
+
--arg prompt "Dramatic orchestral strings, emotional swell, cinematic" \
|
|
123
|
+
'{
|
|
124
|
+
model: "turbo",
|
|
125
|
+
mode: "sync",
|
|
126
|
+
source: {type: "file_id", file_id: $src},
|
|
127
|
+
prompt: $prompt,
|
|
128
|
+
start: 15,
|
|
129
|
+
end: 30,
|
|
130
|
+
strength: 0.6,
|
|
131
|
+
seed: 1
|
|
132
|
+
}' |
|
|
133
|
+
curl -sS -X POST http://localhost:${PORT:-8000}/v1/audio/acestep/repaint \
|
|
134
|
+
-H 'Content-Type: application/json' \
|
|
135
|
+
--data-binary @- \
|
|
136
|
+
-o repainted.wav
|
|
137
|
+
```
|
|
138
|
+
`start`/`end` is in seconds (`end: -1` = until the end).
|
|
139
|
+
|
|
140
|
+
### extract - sound source separation
|
|
141
|
+
```bash
|
|
142
|
+
SRC=$(
|
|
143
|
+
curl -sS -X POST http://localhost:${PORT:-8000}/v1/files -F "file=@song.wav" |
|
|
144
|
+
jq -r .file_id
|
|
145
|
+
)
|
|
146
|
+
|
|
147
|
+
RESP=$(
|
|
148
|
+
jq -n \
|
|
149
|
+
--arg src "$SRC" \
|
|
150
|
+
'{
|
|
151
|
+
model: "turbo",
|
|
152
|
+
mode: "sync",
|
|
153
|
+
source: {type: "file_id", file_id: $src},
|
|
154
|
+
targets: ["vocals", "drums", "bass", "other"]
|
|
155
|
+
}' |
|
|
156
|
+
curl -sS -X POST http://localhost:${PORT:-8000}/v1/audio/acestep/extract \
|
|
157
|
+
-H 'Content-Type: application/json' \
|
|
158
|
+
-H 'Accept: application/json' \
|
|
159
|
+
--data-binary @-
|
|
160
|
+
)
|
|
161
|
+
|
|
162
|
+
# 各音源をダウンロード(stems[] にターゲット名が入る)
|
|
163
|
+
echo "$RESP" | jq -c '.result.stems[]' | while read -r s; do
|
|
164
|
+
TARGET=$(echo "$s" | jq -r .target); FID=$(echo "$s" | jq -r .file_id)
|
|
165
|
+
curl -o "${TARGET}.wav" http://localhost:${PORT:-8000}/v1/files/$FID/download
|
|
166
|
+
done
|
|
167
|
+
```
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"""acestep family - ACE-Step 1.5 music generation, run in an isolated venv subprocess.
|
|
2
|
+
|
|
3
|
+
Endpoints: ``POST /v1/audio/acestep/{generate,cover,repaint,extract}``. ace-step
|
|
4
|
+
pins transformers 4.x, which conflicts with chat/embedding's transformers 5.x, so
|
|
5
|
+
it cannot share kiapi's process. Instead each variant (preset) is a resident spec
|
|
6
|
+
whose payload is a long-lived worker subprocess (launched from the ACE-Step venv);
|
|
7
|
+
kiapi talks to it over a small JSON pipe protocol and treats it as a normal
|
|
8
|
+
resident model - budgeted, evictable (``release`` = terminate), TTL-swept.
|
|
9
|
+
|
|
10
|
+
The subprocess's memory is NOT visible in kiapi's own RSS, so ``weight_gb`` here
|
|
11
|
+
is an estimate (the registry value is authoritative for budgeting); load() logs
|
|
12
|
+
the child's real RSS so these can be tuned on device.
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
from ._helpers.register import register
|
|
16
|
+
from ._operations.handle_cover import handle_cover
|
|
17
|
+
from ._operations.handle_extract import handle_extract
|
|
18
|
+
from ._operations.handle_generate import handle_generate
|
|
19
|
+
from ._operations.handle_repaint import handle_repaint
|
|
20
|
+
from ._settings import settings_manager
|
|
21
|
+
from ._views.cover_request import CoverRequest
|
|
22
|
+
from ._views.extract_request import ExtractRequest
|
|
23
|
+
from ._views.generate_request import GenerateRequest
|
|
24
|
+
from ._views.repaint_request import RepaintRequest
|
|
25
|
+
|
|
26
|
+
__all__ = [
|
|
27
|
+
"CoverRequest",
|
|
28
|
+
"ExtractRequest",
|
|
29
|
+
"GenerateRequest",
|
|
30
|
+
"RepaintRequest",
|
|
31
|
+
"handle_cover",
|
|
32
|
+
"handle_extract",
|
|
33
|
+
"handle_generate",
|
|
34
|
+
"handle_repaint",
|
|
35
|
+
"register",
|
|
36
|
+
"settings_manager",
|
|
37
|
+
]
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
DESCRIPTION = """Music generation (ACE-Step 1.5): compose, cover, repaint, extract.
|
|
2
|
+
|
|
3
|
+
Four operations on ACE-Step 1.5: `/generate` (text2music — a new song from a
|
|
4
|
+
style prompt + lyrics), `/cover` (re-style an existing track), `/repaint`
|
|
5
|
+
(regenerate a time range), and `/extract` (separate into stems). ACE-Step runs in
|
|
6
|
+
an isolated subprocess (it pins an older transformers than chat/embedding); the
|
|
7
|
+
first request after idle pays a load cost of tens of seconds, then it stays
|
|
8
|
+
resident until the idle TTL or budget pressure frees it.
|
|
9
|
+
|
|
10
|
+
## Upstream docs
|
|
11
|
+
- [ACE-Step](https://github.com/ace-step/ACE-Step) — the upstream model
|
|
12
|
+
|
|
13
|
+
## Models
|
|
14
|
+
- **xl-base** (default) — highest quality. 32 inference steps, CFG 7.0.
|
|
15
|
+
~25 s per 30 s of audio on M4 Max.
|
|
16
|
+
- **turbo** — fastest. 8 inference steps, no CFG. ~4 s per 15 s on M4 Max. Great
|
|
17
|
+
for prototyping / iterating on prompts.
|
|
18
|
+
|
|
19
|
+
Pick the preset with `model`; discover variants at `GET /v1/audio/acestep/models`.
|
|
20
|
+
The sampling overrides (`inference_steps`, `guidance_scale`, `shift`) default to
|
|
21
|
+
the preset's tuned values — set them only to deviate.
|
|
22
|
+
|
|
23
|
+
## Source workflow
|
|
24
|
+
`/cover`, `/repaint`, and `/extract` operate on an existing track: POST the source
|
|
25
|
+
WAV to `/v1/files` to get a `file_id`, then pass it as `source`. `/generate` needs
|
|
26
|
+
no source.
|
|
27
|
+
|
|
28
|
+
## Prompt tips
|
|
29
|
+
Describe the SOUND, not the story — a narrative sentence beats a keyword list.
|
|
30
|
+
Useful elements to mention:
|
|
31
|
+
- **genre**: Modern J-Pop / Acoustic Jazz / Dark Trap / Lo-fi Hip-hop / Anime OST
|
|
32
|
+
- **tempo**: 132 BPM / slow and intimate / driving beat / half-time feel
|
|
33
|
+
- **instruments**: bright piano / smooth saxophone / 808 sub-bass / nylon guitar
|
|
34
|
+
- **vocal**: emotional female vocal / whispered delivery / powerful male tenor
|
|
35
|
+
- **mood**: melancholic / triumphant / cozy / aggressive / dreamy / nostalgic
|
|
36
|
+
- **production**: polished radio-ready / lo-fi vinyl texture / orchestral / live band
|
|
37
|
+
|
|
38
|
+
- **good**: "A melancholic piano ballad where soft female vocals weave through
|
|
39
|
+
gentle strings, intimate and heartbreaking. 80 BPM."
|
|
40
|
+
- **bad**: "piano, sad, female, slow"
|
|
41
|
+
|
|
42
|
+
## Lyrics format (generate)
|
|
43
|
+
Use `[Square Bracket]` section tags at the start of a line: `[Intro]`,
|
|
44
|
+
`[Verse 1]`, `[Pre-Chorus]`, `[Chorus]`, `[Bridge]`, `[Instrumental]`, `[Outro]`.
|
|
45
|
+
Modifiers work too, e.g. `[Verse 1 - Female]`, `[Chorus - Both]`,
|
|
46
|
+
`[Bridge - Whispered]`. Set lyrics to `[Instrumental]` for no vocals. Keep the
|
|
47
|
+
lyric length proportionate to `duration` — sparse lyrics over a long duration
|
|
48
|
+
degrade quality.
|
|
49
|
+
|
|
50
|
+
## Language codes (lang, generate)
|
|
51
|
+
ISO 639-1: `ja` Japanese, `en` English, `ko` Korean, `zh` Mandarin, `yue`
|
|
52
|
+
Cantonese, `es` Spanish, `fr` French, `de` German, …. `unknown` auto-detects
|
|
53
|
+
(may reduce quality).
|
|
54
|
+
|
|
55
|
+
## TIPS
|
|
56
|
+
- For a quick track, call `sync` without `Accept: application/json` to get the raw
|
|
57
|
+
WAV bytes straight back (`curl -o out.wav`). `/extract` is multi-artifact, so it
|
|
58
|
+
always returns Job JSON.
|
|
59
|
+
- Reuse a `seed` (≠ -1) with the same params to reproduce a result.
|
|
60
|
+
- Run `kiapi activate` ahead of time so the first request doesn't pay a cold-start
|
|
61
|
+
weight download.
|
|
62
|
+
|
|
63
|
+
## Examples
|
|
64
|
+
|
|
65
|
+
### Generate (sync, turbo)
|
|
66
|
+
```sh
|
|
67
|
+
jq -n \\
|
|
68
|
+
--arg prompt "Modern J-Pop, 132 BPM, bright piano, emotional electric guitar, upbeat drums, polished anime opening production" \\
|
|
69
|
+
--arg lyrics '[Verse 1]
|
|
70
|
+
加速する世界の中で
|
|
71
|
+
君の声が聴こえてくる
|
|
72
|
+
|
|
73
|
+
[Pre-Chorus]
|
|
74
|
+
夜明け前の空に
|
|
75
|
+
まだ見ぬ明日を描いた
|
|
76
|
+
|
|
77
|
+
[Chorus]
|
|
78
|
+
僕らは光を追いかける
|
|
79
|
+
終わらない夢の向こうへ
|
|
80
|
+
何度でも手を伸ばして
|
|
81
|
+
新しい風になる
|
|
82
|
+
' \\
|
|
83
|
+
'{
|
|
84
|
+
"model": "turbo",
|
|
85
|
+
"mode": "sync",
|
|
86
|
+
"prompt": $prompt,
|
|
87
|
+
"lyrics": $lyrics,
|
|
88
|
+
"duration": 30,
|
|
89
|
+
"lang": "ja",
|
|
90
|
+
"seed": 1
|
|
91
|
+
}' |
|
|
92
|
+
curl -sS -X POST http://localhost:${PORT:-8000}/v1/audio/acestep/generate \\
|
|
93
|
+
-H 'Content-Type: application/json' \\
|
|
94
|
+
--data-binary @- \\
|
|
95
|
+
-o acestep_generate.wav
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### Cover (async, turbo)
|
|
99
|
+
```sh
|
|
100
|
+
curl -sS http://HOST:PORT/v1/audio/acestep/cover \\
|
|
101
|
+
-H 'Content-Type: application/json' \\
|
|
102
|
+
-d '{
|
|
103
|
+
"model": "turbo",
|
|
104
|
+
"mode": "async",
|
|
105
|
+
"source": "<file_id>",
|
|
106
|
+
"prompt": "lo-fi chillhop, warm tape",
|
|
107
|
+
"strength": 0.7
|
|
108
|
+
}'
|
|
109
|
+
# -> {"job_id": "..."}; poll GET /v1/jobs/{job_id}
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### Extract stems
|
|
113
|
+
```sh
|
|
114
|
+
curl -sS http://HOST:PORT/v1/audio/acestep/extract \\
|
|
115
|
+
-H 'Content-Type: application/json' \\
|
|
116
|
+
-d '{
|
|
117
|
+
"source": "<file_id>",
|
|
118
|
+
"targets": ["vocals", "drums", "bass", "other"]
|
|
119
|
+
}'
|
|
120
|
+
# -> one job, artifacts = 4 file_ids (one WAV per target)
|
|
121
|
+
```
|
|
122
|
+
"""
|