Speech Command Prediction with Federated Learning

To tell the truth, I want to train speech-to-text model with federated learning instead of speech command prediction. But I couldn’t make it this time so maybe in the future…

Training Objective


Split and send data to remote machine

# import PySyft 
import syft as sy # maket PySyft and PyTorch work together
hook = sy.TorchHook(torch) # create virtual remote machine
bob = sy.VirtualWorker(hook, id="bob")
alice = sy.VirtualWorker(hook, id="alice")
# sy.FederatedDataLoader do the magic 
federated_train_loader = sy.FederatedDataLoader(
train_dataset.federate((bob, alice)),

Training loop

# send model to data.location

But wait…
validation accuracy was just 16 %. This is close to random picking…




Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store