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.

[MusicBERT]: How to fill masked tokens in an input sequence after training?

See original GitHub issue

Hello again,

I have fine-tuned MusicBERT on masked language modeling using a custom dataset. I have loaded the fine-tuned checkpoint using:

roberta = RobertaModel.from_pretrained( # MusicBERTModel.from_pretrained also works
    '.',
    checkpoint_file=sys.argv[1],
    data_name_or_path=sys.argv[2],
    user_dir='musicbert'
)

What I want to do is to give it an input sequence, mask one or more tokens before passing the input to the model and somehow predict them. Something like masked language modeling, but with control over which tokens I want to mask and predict.

What I cannot understand is what format the input sequence should be in order to be passed to the model, and how to make the model predict the masked tokens in the input. I have tried to replicate it by looking at the fairseq’s training code since I want to do something similar, but it’s too complicated.

Thanks in advance.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
aspilcommented, Jul 10, 2022

Hello @mlzeng and @tripathiarpan20 I’ll be closing this issue as it is more than resolved. The MIDIformers project is indeed brilliant!

1reaction
mlzengcommented, Jul 10, 2022

Hi @tripathiarpan20

The MIDI remixing tool works well. It’s a brilliant project! I have added the links in README.md.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Fine-tuning a masked language model - Hugging Face Course
When training models for masked language modeling, one technique that can be used is to mask whole words together, not just individual tokens....
Read more >
Masked-Language Modeling With BERT | by James Briggs
In many cases, we might be able to take the pre-trained BERT model ... we actually give BERT that input sentence — we...
Read more >
End-to-end Masked Language Modeling with BERT - Keras
Masked Language Modeling is a fill-in-the-blank task, where a model uses the context words surrounding a mask token to try to predict what ......
Read more >
Large-scale Pre-training for Symbolic Music Understanding
We employ the mask language modeling (MLM) pre-training strategy of BERT, randomly masking 15% tokens of an input sequence, and asking the Transformer...
Read more >
(PDF) Multi-modal, Multi-task, Music BERT: A Context-Aware ...
After pre-training using masked reconstruction and self-attention ... BERT reconstructs masked input sequences in its pre-training stage;.
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