Acme

WinError 2

Sep 22nd, 2020
915
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import jukebox
  2. import torch as t
  3. import librosa
  4. import os
  5. from IPython.display import Audio
  6. from jukebox.make_models import make_vqvae, make_prior, MODELS, make_model
  7. from jukebox.hparams import Hyperparams, setup_hparams
  8. from jukebox.sample import sample_single_window, _sample, \
  9.                            sample_partial_window, upsample, \
  10.                            load_prompts
  11. from jukebox.utils.dist_utils import setup_dist_from_mpi
  12. from jukebox.utils.torch_utils import empty_cache
  13. rank, local_rank, device = setup_dist_from_mpi()
  14.  
  15. model = "5b_lyrics" # or "1b_lyrics"
  16. hps = Hyperparams()
  17. hps.sr = 44100
  18. hps.n_samples = 3 if model=='5b_lyrics' else 8
  19.  
  20. from tkinter import filedialog
  21. from tkinter import *
  22. root = Tk()
  23. root.withdraw()
  24. hps.name = filedialog.askdirectory()
  25.  
  26. chunk_size = 16 if model=="5b_lyrics" else 32
  27. max_batch_size = 3 if model=="5b_lyrics" else 16
  28. hps.levels = 3
  29. hps.hop_fraction = [.5,.5,.125]
  30.  
  31. vqvae, *priors = MODELS[model]
  32. vqvae = make_vqvae(setup_hparams(vqvae, dict(sample_length = 1048576)), device)
  33. top_prior = make_prior(setup_hparams(priors[-1], dict()), vqvae, device)
RAW Paste Data