Spaces:
Running
on
A100
Running
on
A100
fix cover logic for api_server
Browse files- acestep/api_server.py +8 -1
acestep/api_server.py
CHANGED
|
@@ -42,6 +42,7 @@ from acestep.llm_inference import LLMHandler
|
|
| 42 |
from acestep.constants import (
|
| 43 |
DEFAULT_DIT_INSTRUCTION,
|
| 44 |
DEFAULT_LM_INSTRUCTION,
|
|
|
|
| 45 |
)
|
| 46 |
from acestep.inference import (
|
| 47 |
GenerationParams,
|
|
@@ -894,11 +895,17 @@ def create_app() -> FastAPI:
|
|
| 894 |
# Determine actual inference steps (timesteps override inference_steps)
|
| 895 |
actual_inference_steps = len(parsed_timesteps) if parsed_timesteps else req.inference_steps
|
| 896 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 897 |
# Build GenerationParams using unified interface
|
| 898 |
# Note: thinking controls LM code generation, sample_mode only affects CoT metas
|
| 899 |
params = GenerationParams(
|
| 900 |
task_type=req.task_type,
|
| 901 |
-
instruction=
|
| 902 |
reference_audio=req.reference_audio_path,
|
| 903 |
src_audio=req.src_audio_path,
|
| 904 |
audio_codes=req.audio_code_string,
|
|
|
|
| 42 |
from acestep.constants import (
|
| 43 |
DEFAULT_DIT_INSTRUCTION,
|
| 44 |
DEFAULT_LM_INSTRUCTION,
|
| 45 |
+
TASK_INSTRUCTIONS,
|
| 46 |
)
|
| 47 |
from acestep.inference import (
|
| 48 |
GenerationParams,
|
|
|
|
| 895 |
# Determine actual inference steps (timesteps override inference_steps)
|
| 896 |
actual_inference_steps = len(parsed_timesteps) if parsed_timesteps else req.inference_steps
|
| 897 |
|
| 898 |
+
# Auto-select instruction based on task_type if user didn't provide custom instruction
|
| 899 |
+
# This matches gradio behavior which uses TASK_INSTRUCTIONS for each task type
|
| 900 |
+
instruction_to_use = req.instruction
|
| 901 |
+
if instruction_to_use == DEFAULT_DIT_INSTRUCTION and req.task_type in TASK_INSTRUCTIONS:
|
| 902 |
+
instruction_to_use = TASK_INSTRUCTIONS[req.task_type]
|
| 903 |
+
|
| 904 |
# Build GenerationParams using unified interface
|
| 905 |
# Note: thinking controls LM code generation, sample_mode only affects CoT metas
|
| 906 |
params = GenerationParams(
|
| 907 |
task_type=req.task_type,
|
| 908 |
+
instruction=instruction_to_use,
|
| 909 |
reference_audio=req.reference_audio_path,
|
| 910 |
src_audio=req.src_audio_path,
|
| 911 |
audio_codes=req.audio_code_string,
|