-
Notifications
You must be signed in to change notification settings - Fork 12
Reproducing APC to compare with Mockingjay
Andy T. Liu edited this page Jun 5, 2021
·
1 revision
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
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)