# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 3
#     language: python
#     name: python3
# ---

import tflearn
import librosa
import speech_data

learning_rate = 0.0001
training_iters = 300000

batch = word_batch = speech_data.mfcc_batch_generator(64)

net = tflearn.input_data([None, 20, 80])
net = tflearn.lstm(net, 128, dropout=0.8)
net = tflearn.fully_connected(net, 10, activation='softmax')
net = tflearn.regression(net, optimizer='adam', learning_rate=learning_rate, loss='categorical_crossentropy')
model = tflearn.DNN(net, tensorboard_verbose=0)

while --training_iters > 0:
    trainX, trainY = next(batch)
    testX, testY = next(batch)
    model.fit(trainX, trainY, n_epoch=10, validation_set=(testX, testY), show_metric=True, batch_size=64)
model.save('tflearn.lstm.model')

_y=model.predict(next(batch)[0])
print(_y)



StarcoderdataJupyterScriptsDedupFiltered