question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Load pre-trained models

See original GitHub issue

Hey @mravanelli @pplantinga @Gastron @TParcollet ,

With my transducer, I’m thinking about adding specific pre-trained option to handle the load of pre-trained models from CTC for example…

The first solution is to add an option in checkpointer like this:

checkpointer: !new:speechbrain.utils.checkpoints.Checkpointer
    checkpoints_dir: !ref <save_folder>
    recoverables:
        encoder_crdnn: !ref <encoder_crdnn>
        encoder_lin: !ref <encoder_lin>
        decoder_gru: !ref <decoder_gru>
        decoder_lin: !ref <decoder_lin>
        joint_lin: !ref <joint_lin>
        output: !ref <output>
        optimizer: !ref <optimizer>
        scheduler: !ref <lr_annealing>
        normalizer: !ref <normalize>
        counter: !ref <epoch_counter>

And consider that encoder_crdnn and encoder_lin have same dim as CTC recipe…I’m thinking about creating an option like:

checkpointer: !new:speechbrain.utils.checkpoints.Checkpointer
    checkpoints_dir: !ref <save_folder>
    pre-trained-dir: !ref <pretrained_folder>
    load-pre-trained:
        encoder_crdnn: !ref <encoder_crdnn>
        encoder_lin: !ref <encoder_lin>
    recoverables:
        encoder_crdnn: !ref <encoder_crdnn>
        encoder_lin: !ref <encoder_lin>
        decoder_gru: !ref <decoder_gru>
        decoder_lin: !ref <decoder_lin>
        joint_lin: !ref <joint_lin>
        output: !ref <output>
        optimizer: !ref <optimizer>
        scheduler: !ref <lr_annealing>
        normalizer: !ref <normalize>
        counter: !ref <epoch_counter>

Or adding a class as @TParcollet propose to load model at the begning…

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7

github_iconTop GitHub Comments

2reactions
TParcolletcommented, Jun 4, 2020

A entire class would make more sense to me 😄

0reactions
ahebacommented, Jun 4, 2020

let me make some example for transducer with ctc pre-trained model…

Read more comments on GitHub >

github_iconTop Results From Across the Web

Load pretrained instances with an AutoClass - Hugging Face
The from_pretrained() method lets you quickly load a pretrained model for any architecture so you don't have to devote time and resources to...
Read more >
Save and load models | TensorFlow Core
Model progress can be saved during and after training. This means a model can resume where it left off and avoid long training...
Read more >
Saving and Loading Models - PyTorch
To load the models, first initialize the models and optimizers, then load the dictionary locally using torch.load() .
Read more >
Loading Pre-Trained Models - Caffe2
Take advantage of the Model Zoo and grab some pre-trained models and take them for a test drive. You can find different models...
Read more >
how can I load pretrained model by pytorch? ( mmfashion)
import torchvision model = torchvision.models.wide_resnet50_2(pretrained=True) for param in model.parameters(): param.required_grad = False.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found