Spaces:
Runtime error
Runtime error
Download encoder/data_objects/speaker_batch.py from jewelt123/CloneABC01: direct link, hf CLI and curl.
- Browser
- Download file 622 Bytes
-
https://huggingface.co/spaces/jewelt123/CloneABC01/resolve/ea0a6c1f3d870d1ec91311d6c7f45a78bd6b3dcb/encoder/data_objects/speaker_batch.py
- Command line
-
hf download hf://spaces/jewelt123/CloneABC01@ea0a6c1f3d870d1ec91311d6c7f45a78bd6b3dcb/encoder/data_objects/speaker_batch.py
-
curl -L -o speaker_batch.py https://huggingface.co/spaces/jewelt123/CloneABC01/resolve/ea0a6c1f3d870d1ec91311d6c7f45a78bd6b3dcb/encoder/data_objects/speaker_batch.py
622 Bytes
| import numpy as np | |
| from typing import List | |
| from encoder.data_objects.speaker import Speaker | |
| class SpeakerBatch: | |
| def __init__(self, speakers: List[Speaker], utterances_per_speaker: int, n_frames: int): | |
| self.speakers = speakers | |
| self.partials = {s: s.random_partial(utterances_per_speaker, n_frames) for s in speakers} | |
| # Array of shape (n_speakers * n_utterances, n_frames, mel_n), e.g. for 3 speakers with | |
| # 4 utterances each of 160 frames of 40 mel coefficients: (12, 160, 40) | |
| self.data = np.array([frames for s in speakers for _, frames, _ in self.partials[s]]) | |