From ba155e4e2f582de28abed230aca2e79191ecbc51 Mon Sep 17 00:00:00 2001 From: James Betker Date: Sun, 27 Feb 2022 14:48:38 -0700 Subject: [PATCH] script for uploading models to the HF hub --- codes/scripts/hugging_face_hub_upload.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 codes/scripts/hugging_face_hub_upload.py diff --git a/codes/scripts/hugging_face_hub_upload.py b/codes/scripts/hugging_face_hub_upload.py new file mode 100644 index 00000000..b05784c6 --- /dev/null +++ b/codes/scripts/hugging_face_hub_upload.py @@ -0,0 +1,22 @@ +import json + +import torch + +from models.asr.w2v_wrapper import Wav2VecWrapper +from models.tacotron2.text import tacotron_symbol_mapping + +if __name__ == '__main__': + """ + Utility script for uploading model weights to the HF hub + """ + + ''' + model = Wav2VecWrapper(vocab_size=148, basis_model='facebook/wav2vec2-large-robust-ft-libri-960h', freeze_transformer=True, checkpointing_enabled=False) + weights = torch.load('D:\\dlas\\experiments\\train_wav2vec_mass_large2\\models\\22500_wav2vec.pth') + model.load_state_dict(weights) + model.w2v.save_pretrained("jbetker/wav2vec2-large-robust-ft-libritts-voxpopuli", push_to_hub=True) + ''' + + # Build tokenizer vocab + mapping = tacotron_symbol_mapping() + print(json.dumps(mapping)) \ No newline at end of file