Skip to content

Commit

Permalink
Reduce RAM usage further
Browse files Browse the repository at this point in the history
  • Loading branch information
Purfview authored Dec 11, 2024
1 parent fe9f194 commit 4c456f5
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion faster_whisper/vad.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,15 @@ def __call__(

batched_audio = batched_audio.reshape(-1, num_samples + context_size_samples)

encoder_output = self.encoder_session.run(None, {"input": batched_audio})[0]
batch_process_size = 10000
num_segments = batched_audio.shape[0]
encoder_outputs = []
for start in range(0, num_segments, batch_process_size):
end = min(start + batch_process_size, num_segments)
encoder_output = self.encoder_session.run(None, {"input": batched_audio[start:end]})[0]
encoder_outputs.append(encoder_output)

encoder_output = np.concatenate(encoder_outputs, axis=0)
encoder_output = encoder_output.reshape(batch_size, -1, 128)

decoder_outputs = []
Expand Down

0 comments on commit 4c456f5

Please sign in to comment.