Coder Social home page Coder Social logo

Comments (1)

andi611 avatar andi611 commented on July 24, 2024

I see that you are mixing the MOCKINGJAY class with your own downstream solver modified from either mockingjay/solver.py or downstream/solver.py.
I believed most of the errors are from the above modification.

The problem with model before the actual attributes is probably caused by the model initialization method.
I see that you initialized like this:

self.mockingjay = MOCKINGJAY(options=options, inp_dim=160).to(self.device) 

If you examine the code of MOCKINGJAY, the actual model is assigned to the attribute self.model
So you should save like this, as you have discovered:

'Mockingjay': self.mockingjay.model.state_dict()

I've realized our example_extract_finetune.py missed the attribute while saving (which probably mislead you, sorry about that),
I will fix it in the next update, thanks for pointing it out!

As to your parameters mismatch problem:
Warnings are only thrown when model architecture does not match the weight.
For example, loading a 3-layer model weight into a 12-layer model.
By the look of it,
the MOCKINGJAY class builds a 12-layer model (85425408 parameters), and you are loading a 3-layer model weight (21388800 parameters) with your solver, which causes the error.

When you save with this:

all_states = {
                'Classifier': self.classifier.state_dict(),
                'Mockingjay': self.mockingjay.model.state_dict(),
                'Optimizer': self.optimizer.state_dict(),
                'Global_step': self.global_step,
                'Settings': {
                    'Config': self.config,
                    'Paras': self.paras,
                },
            }

The 'Config': self.config probably specifies a 12-layer model,
while the 'Mockingjay': self.mockingjay.model.state_dict() saves the weight of a 3-layer model.
Then when you later loads with the MOCKINGJAY class,
it uses 'Config': self.config to construct a 12-layer model, and loads the 3-layer weight,
which causes the warning.

Please verify if this is the case,
Let me know if you have further problems.
Thanks.

from s3prl.

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.