Git Product home page Git Product logo

Comments (2)

sophia1488 avatar sophia1488 commented on September 16, 2024 1

Hi @mridenour7,
For the melody task you mentioned, I just clone the repo and run python3 finetune.py --task=melody --name=default --ckpt='pretrain_model.ckpt', it works fine here for me.
And the state_dict of saved checkpoint has keys like 'midibert.bert.embeddings.position_ids', 'midibert.in_linear.bias', 'classifier.1.weight'.

A quick fix would be to change the following line to 'state_dict': self.model.state_dict(),

'state_dict': self.model.module.state_dict(),

But I suppose the state_dict of the saved checkpoint would have keys like 'module.midibert.bert***' then, and you'd have to be careful when loading the model for evaluation or your specific task.
Something like the following,
# remove module
#from collections import OrderedDict
#new_state_dict = OrderedDict()
#for k, v in checkpoint['state_dict'].items():
# name = k[7:]
# new_state_dict[name] = v
#model.load_state_dict(new_state_dict)

Hope this helps!

from midi-bert.

mridenour7 avatar mridenour7 commented on September 16, 2024

@sophia1488 Thank you for the quick response! That fixed my error :)

from midi-bert.

Related Issues (11)

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.