Skip to content

Commit

Permalink
remove unnecessary data batch generator (just use Keras)
Browse files Browse the repository at this point in the history
  • Loading branch information
cpmpercussion committed Jun 26, 2024
1 parent 262655f commit 0a5fd9a
Showing 1 changed file with 1 addition and 20 deletions.
21 changes: 1 addition & 20 deletions impsy/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,26 +30,7 @@ def mdrnn_config(size: str):
return SIZE_TO_PARAMETERS[size]


# Manages Training Data for the Musical MDN and can generate fake datsets for testing.


def batch_generator(seq_len, batch_size, dim, corpus):
"""Returns a generator to cut up datasets into
batches of features and labels."""
# generator = batch_generator(SEQ_LEN, BATCH_SIZE, 3, corpus)
batch_X = np.zeros((batch_size, seq_len, dim))
batch_y = np.zeros((batch_size, dim))
while True:
for i in range(batch_size):
# choose random example
l = random.choice(corpus)
last_index = len(l) - seq_len - 1
start_index = np.random.randint(0, high=last_index)
batch_X[i] = l[start_index : start_index + seq_len]
batch_y[i] = l[
start_index + 1 : start_index + seq_len + 1
] # .reshape(1,dim)
yield batch_X, batch_y
# Fake data generator for tests.


def fuzzy_sine_function(t, scale=1.0, fuzz_factor=0.05):
Expand Down

0 comments on commit 0a5fd9a

Please sign in to comment.