Code Monkey home page Code Monkey logo

Comments (5)

Julymycin avatar Julymycin commented on July 20, 2024

Well, I think both --model-restore and --schp-restore are used for resume training, not well fit for finetune, you can use the default value, and then, add:
state_dict = torch.load(pre_ckpt)['state_dict'] model.load_state_dict(state_dict) schp_model.load_state_dict(state_dict)
after you initialize model and schp_model,pre_ckpt means the path to your pretrained weight such as exp-schp-201908270938-pascal-person-part.pth.
Hope it can work.

from self-correction-human-parsing.

rkhilnani9 avatar rkhilnani9 commented on July 20, 2024

@Julymycin Thanks for your suggestion! I tried that, but I am getting this error :

size mismatch for module.decoder.conv4.weight: copying a param with shape torch.Size([7, 256, 1, 1]) from checkpoint, the shape in current model is torch.Size([3, 256, 1, 1]).

My data has 3 classes, and the pascal person dataset has 7. That can be the issue, but I'm struggling to figure out how to resolve. it.

from self-correction-human-parsing.

Julymycin avatar Julymycin commented on July 20, 2024

@rkhilnani9 Well, there are two possibly helpful options for you.

  1. use the 7 classes as default network and load the state_dict, then change this layer to 3 classes, initial it.
  2. use your own 3 classes network, before you load the state_dict, locate the mismatch layer(s), change its shape or replace it with your custom(or random) tensor value.

from self-correction-human-parsing.

Stephenfang51 avatar Stephenfang51 commented on July 20, 2024

@Julymycin

Dear Sir

I followed your step and I can load LIP pretrained model so far, however the errors shows

RuntimeError: module must have its parameters and buffers on device cuda:0 (device_ids[0]) but found one of them on device: cpu
> /home/liwei.fang/SCHP/train_qinzhou_pretrainfromlip.py(209)main()
-> preds = model(images)

I checked the model parameter and buffers on gpu using next(model.parameters()).is_cuda() and it return True
Did you sucessfully using pretrained model before ?
Thanks so much !

from self-correction-human-parsing.

Stephenfang51 avatar Stephenfang51 commented on July 20, 2024

@Julymycin

Dear Sir

I followed your step and I can load LIP pretrained model so far, however the errors shows

RuntimeError: module must have its parameters and buffers on device cuda:0 (device_ids[0]) but found one of them on device: cpu
> /home/liwei.fang/SCHP/train_qinzhou_pretrainfromlip.py(209)main()
-> preds = model(images)

I checked the model parameter and buffers on gpu using next(model.parameters()).is_cuda() and it return True
Did you sucessfully using pretrained model before ?
Thanks so much !

I just solved the problem, the error happend becuase I modified the final fusion layer conv outputs to 3 nodes, and the weight I changed is on cpu, so need to model.to(device) afterall

from self-correction-human-parsing.

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.