MCPcopy
hub / github.com/m-bain/whisperX / encode

Method encode

whisperx/asr.py:95–104  ·  view source on GitHub ↗
(self, features: np.ndarray)

Source from the content-addressed store, hash-verified

93 return {'text': text, 'avg_logprob': avg_logprobs}
94
95 def encode(self, features: np.ndarray) -> ctranslate2.StorageView:
96 # When the model is running on multiple GPUs, the encoder output should be moved
97 # to the CPU since we don't know which GPU will handle the next job.
98 to_cpu = self.model.device == "cuda" and len(self.model.device_index) > 1
99 # unsqueeze if batch size = 1
100 if len(features.shape) == 2:
101 features = np.expand_dims(features, 0)
102 features = get_ctranslate2_storage(features)
103
104 return self.model.encode(features, to_cpu=to_cpu)
105
106class FasterWhisperPipeline(Pipeline):
107 """

Callers 4

detect_languageMethod · 0.80
make_safeFunction · 0.80
compression_ratioFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected