Code Monkey home page Code Monkey logo

Comments (7)

prafullasd avatar prafullasd commented on August 24, 2024

You want to add an entry for restore_prior="path/to/checkpoint" inside the corresponding hps dictionary, in your case "small_prior". For example, if your checkpoint is stored at "/root/jukebox/logs/small_prior/checkpoint_latest.pth.tar" and you're going to replace the top_level with "small_prior,
you want the entry in hparams.py to be:

small_prior = Hyperparams(
    n_ctx=8192,
    ... other hps here ...
    init_scale=0.7,
    restore_prior="/root/jukebox/logs/small_prior/checkpoint_latest.pth.tar", 
)

If you trained with labels/lyrics, make sure you also set these hps correctly:
y_bins, max_bow_genre_size for the genre/artist information
min_duration, max_duration, t_bins for the timing information
use_tokens, n_tokens, n_vocab for the lyric information

For example, if you trained with
--hps=small_single_enc_dec_prior --labels --y_bins=(10,100) --max_bow_genre_size=1 --min_duration=60 --max_duration=600 --t_bins=64 --use_tokens=True --n_tokens=384 --n_vocab=79
then you want to set

small_single_enc_dec_prior = Hyperparams(
    n_ctx=6144,
    ... other hps here ...
    single_enc_dec=True,
    labels=True,
    y_bins=(10,100),
    max_bow_genre_size=1,
    .... other hps from training here...
    n_tokens=384,
    n_vocab=79,
)

so that when you restore the model for sampling they're correctly set.

from jukebox.

made-by-chris avatar made-by-chris commented on August 24, 2024

To piggyback tangentially, could you theoretically train locally and then load it into the colab environment and use it in a hosted set up? I can run the sampler locally.. but maybe i can train. Also - has anyone managed to apply the training command within with colab env?

from jukebox.

Franckyboi avatar Franckyboi commented on August 24, 2024

You want to add an entry for restore_prior="path/to/checkpoint" inside the corresponding hps dictionary, in your case "small_prior". For example, if your checkpoint is stored at "/root/jukebox/logs/small_prior/checkpoint_latest.pth.tar" and you're going to replace the top_level with "small_prior,

Thank you, I also had to manually set the param "labels" to False in at least one of the newly trained model parts:

small_prior = Hyperparams(
    n_ctx=8192,
    ... other hps here ...
    init_scale=0.7,
    labels=False
    restore_prior="/root/jukebox/logs/small_prior/checkpoint_latest.pth.tar", 
)

from jukebox.

Franckyboi avatar Franckyboi commented on August 24, 2024

I trained the models with the standard commands in the readme file but I think the way the models are stored differs from how they are opened to use in make_models.py. I'm getting the following errors:

File "/home/user/Downloads/jukebox/jukebox/make_models.py", line 60, in restore
    model.load_state_dict(checkpoint['model'])
File "/home/user/anaconda3/envs/jukebox/lib/python3.7/site-packages/torch/nn/modules/module.py", line 777, in load_state_dict
    self.__class__.__name__, "\n\t".join(error_msgs)))
RuntimeError: Error(s) in loading state_dict for SimplePrior:
	Unexpected key(s) in state_dict: "conditioner_blocks.0.cond.model.2.0.blocks.0.model.1.weight", "conditioner_blocks.0.cond.model.2.0.blocks.0.model.1.bias"

followed by some of these:

size mismatch for conditioner_blocks.0.x_emb.weight: copying a param with shape torch.Size([1024, 1024]) from checkpoint, the shape in current model is torch.Size([512, 1024]).

Is this something I can fix with loading the checkpoint files differently or are my models corrupted?

from jukebox.

heewooj avatar heewooj commented on August 24, 2024

It's hard to say without looking at the exact commands, but these usually mean that some flags used during training are missing at sampling time

from jukebox.

vigliensoni avatar vigliensoni commented on August 24, 2024

Hi @Superchaschper, were you able to sort out the issue with the unexpected key(s) in state_dict?

from jukebox.

Franckyboi avatar Franckyboi commented on August 24, 2024

Hi @Superchaschper, were you able to sort out the issue with the unexpected key(s) in state_dict?

Hey @vigliensoni, No, I wasn't able to solve it and after getting the same errors in another attempt, I haven't tried it since.

from jukebox.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.