Reproducing APC to compare with Mockingjay - andi611/Mockingjay-Speech-Representation GitHub Wiki

Step 1. Training the APC Model for Speech Representation Learning

Once the Librispeech preprocessing is ready, run the following command to train the official model implementation of APC with our audio and experiment settings:

python3 runner_apc.py --train

All model and training settings are set according to the paper: An Unsupervised Autoregressive Model for Speech Representation Learning

Step 2. Loading Pre-trained Models and Testing

Once a model was trained, use the following python code to generate APC representations from a batch of spectrograms:

# import loading wrapper
from runner_apc import get_apc_model
# load and set the pre-trained model
example_path = './result/result_apc/apc_libri_sd1337/apc-500000.ckpt'
apc = get_apc_model(example_path)
# inference
feats = apc.forward(batch_x=spec, all_layers=False) # feats shape:  (batch_size, seq_len, rnn_hidden_size)
# or
feats = apc.forward(batch_x=spec, all_layers=True) # feats shape:  (batch_size, num_layers, seq_len, rnn_hidden_size)