mirror of
https://github.com/wassname/TTS.git
synced 2026-09-11 12:00:24 +08:00
Use fsspec and torch for embedding file IO (#1581)
* Use fsspec and torch for embedding file * Fixup * Fix load and save files * Fix compute embedding script * Set use_cuda to true if available * Add dummy speakers.pth file * Make style * Change default speakers file extension Co-authored-by: WeberJulian <julian.weber@hotmail.fr>
This commit is contained in:
co-authored by
WeberJulian
parent
b6bd74a9a9
commit
f70e82cd19
@@ -16,6 +16,7 @@ encoder_model_path = os.path.join(get_tests_input_path(), "checkpoint_0.pth")
|
||||
sample_wav_path = os.path.join(get_tests_input_path(), "../data/ljspeech/wavs/LJ001-0001.wav")
|
||||
sample_wav_path2 = os.path.join(get_tests_input_path(), "../data/ljspeech/wavs/LJ001-0002.wav")
|
||||
d_vectors_file_path = os.path.join(get_tests_input_path(), "../data/dummy_speakers.json")
|
||||
d_vectors_file_pth_path = os.path.join(get_tests_input_path(), "../data/dummy_speakers.pth")
|
||||
|
||||
|
||||
class SpeakerManagerTest(unittest.TestCase):
|
||||
@@ -58,12 +59,13 @@ class SpeakerManagerTest(unittest.TestCase):
|
||||
# remove dummy model
|
||||
os.remove(encoder_model_path)
|
||||
|
||||
@staticmethod
|
||||
def test_speakers_file_processing():
|
||||
def test_speakers_file_processing(self):
|
||||
manager = SpeakerManager(d_vectors_file_path=d_vectors_file_path)
|
||||
print(manager.num_speakers)
|
||||
print(manager.embedding_dim)
|
||||
print(manager.clip_ids)
|
||||
self.assertEqual(manager.num_speakers, 1)
|
||||
self.assertEqual(manager.embedding_dim, 256)
|
||||
manager = SpeakerManager(d_vectors_file_path=d_vectors_file_pth_path)
|
||||
self.assertEqual(manager.num_speakers, 1)
|
||||
self.assertEqual(manager.embedding_dim, 256)
|
||||
d_vector = manager.get_embedding_by_clip(manager.clip_ids[0])
|
||||
assert len(d_vector) == 256
|
||||
d_vectors = manager.get_embeddings_by_name(manager.speaker_names[0])
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user