MCPcopy Create free account
hub / github.com/MStypulkowski/diffused-heads / get_audio_emb

Function get_audio_emb

utils.py:39–47  ·  view source on GitHub ↗
(audio_path, checkpoint, device)

Source from the content-addressed store, hash-verified

37
38
39def get_audio_emb(audio_path, checkpoint, device):
40 audio, audio_rate = torchaudio.load(audio_path, channels_first=False)
41 assert audio_rate == 16000, 'Only 16 kHZ audio is supported.'
42 audio = audio[None, None, :, 0].to(device)
43
44 audio_encoder = AudioEncoder(checkpoint).to(device)
45
46 emb = audio_encoder(audio)
47 return audio, emb
48
49
50def get_id_frame(path, random=False, resize=128):

Callers 1

mainFunction · 0.90

Calls 1

AudioEncoderClass · 0.85

Tested by

no test coverage detected