Skip to content

Instantly share code, notes, and snippets.

@bmcfee
Created July 27, 2016 18:01
Show Gist options
  • Save bmcfee/98f4eef1aa6d05637d7d772d8b705cc0 to your computer and use it in GitHub Desktop.
Save bmcfee/98f4eef1aa6d05637d7d772d8b705cc0 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
import numpy as np
import pescador
def data_sampler(filename, n_samples):
# Load all the data from the file, somehow
data = load_data(filename)
for n in range(n_samples):
x, y = sample(data)
yield dict(x=x, y=y)
stream = pescador.Streamer(data_sampler, n_samples=128)
streamer = pescador.zmq_stream(stream)
for sample in steamer:
process(sample)
@keunwoochoi
Copy link

e.g. sample: pick up the data for this batch x=audio file, y=label, and process= librosa.stft?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment