|
11 | 11 | @@ -721,6 +722,31 @@ |
12 | 12 | next_mel = torch.cat((old_mel[..., -(keep - chunk_mel.shape[2]) :], chunk_mel), dim=2) |
13 | 13 | return speech, source, next_mel.detach() |
14 | | - |
| 14 | + |
15 | 15 | + def prefetch_prompt_cpu(self, prompt_cache_id: str, prompt_wav: str, workers: int) -> bool: |
16 | 16 | + """Queue bounded CPU extraction; accelerator work stays on the caller.""" |
17 | 17 | + if workers <= 0 or torch.get_default_dtype() != torch.float32: |
|
99 | 99 | + logger.exception("MiniCPM-o CPU reference prefetch failed for %s", state_id) |
100 | 100 | + self._drop_prefetch(state_id) |
101 | 101 | + |
102 | | - |
| 102 | + |
103 | 103 | @torch.inference_mode() |
104 | 104 | def run_idle_prefetch(self) -> bool: |
105 | 105 | --- a/vllm_omni/model_executor/models/minicpmo_4_5/minicpmo_4_5_token2wav.py |
106 | 106 | +++ b/vllm_omni/model_executor/models/minicpmo_4_5/minicpmo_4_5_token2wav.py |
107 | 107 | @@ -119,9 +119,12 @@ |
108 | 108 | def speech_window(self) -> torch.Tensor: |
109 | 109 | return self._core.speech_window |
110 | | - |
| 110 | + |
111 | 111 | - def _prepare_prompt(self, prompt_wav: str): |
112 | 112 | + def _prepare_prompt_cpu(self, prompt_wav: str): |
113 | 113 | + return self._core._prepare_prompt_cpu(prompt_wav) |
|
116 | 116 | """Delegate prompt feature extraction to the wrapped core.""" |
117 | 117 | - return self._core._prepare_prompt(prompt_wav) |
118 | 118 | + return self._core._prepare_prompt(prompt_wav, cpu_features=cpu_features) |
119 | | - |
| 119 | + |
120 | 120 | def enable_trt_spk_embedding(self, *, cpu_reference: bool = False) -> None: |
121 | 121 | """Run the campplus speaker-embedding model on TensorRT.""" |
122 | 122 | --- a/vllm_omni/model_executor/models/step_audio2/step_audio2_token2wav.py |
123 | 123 | +++ b/vllm_omni/model_executor/models/step_audio2/step_audio2_token2wav.py |
124 | 124 | @@ -514,8 +514,9 @@ |
125 | 125 | ) |
126 | 126 | return code, code_len |
127 | | - |
| 127 | + |
128 | 128 | - def _prepare_prompt(self, prompt_wav: str): |
129 | 129 | - """Prepare prompt audio for conditioning""" |
130 | 130 | + @staticmethod |
131 | 131 | + def _prepare_prompt_cpu(prompt_wav: str): |
132 | 132 | + """Extract reference features without accessing the accelerator.""" |
133 | 133 | audio_np_raw, sample_rate = load_audio(prompt_wav, sr=None, mono=True) |
134 | 134 | sample_rate = int(sample_rate) |
135 | | - |
| 135 | + |
136 | 136 | @@ -524,29 +525,8 @@ |
137 | 137 | audio = torch.from_numpy(audio_16k) |
138 | 138 | mels = s3tokenizer.log_mel_spectrogram(audio) |
|
0 commit comments