Git Product home page Git Product logo

Comments (5)

ikodoh avatar ikodoh commented on May 24, 2024

You can simply add --resume ./checkpoint/nextqa/checkpoint_best.pth to your running command to resume the training or run inference.

from flipped-vqa.

iquibalh avatar iquibalh commented on May 24, 2024

I did tried with the --resume option before posting but it trows an error about missing keys in state_dict loaded from misc.load_model:
Steps to replicate

torchrun --rdzv_endpoint 127.0.0.1:1234 --nproc_per_node 1 train.py --model 7B --max_seq_len 128 --batch_size 8 --epochs 5 --warmup_epochs 2 --bias 3.5 --tau 100. --max_feats 10 --dataset nextqa --blr 9e-2 --weight_decay 0.14 --output_dir ./checkpoint/nextqa --accum_iter 2 --vaq --qav --resume checkpoint/nextqa/checkpoint_best.pth

Actual Behavior

Traceback (most recent call last):
  File "train.py", line 163, in <module>
    main(args)
  File "train.py", line 121, in main
    misc.load_model(args=args, model_without_ddp=model_without_ddp, optimizer=optimizer, loss_scaler=loss_scaler)
  File "/home/admin-guest/Documents/multimodal-ml/iqui/Flipped-VQA/util/misc.py", line 302, in load_model
    model_without_ddp.load_state_dict(checkpoint['model'])
  File "/home/admin-guest/anaconda3/envs/flippedvqa_env/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1482, in load_state_dict
    raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format(
RuntimeError: Error(s) in loading state_dict for Transformer:
	Missing key(s) in state_dict: "tok_embeddings.weight", "layers.0.attention.wq.weight", "layers.0.attention.wk.weight", "layers.0.attention.wv.weight", "layers.0.attention.wo.weight", "layers.0.feed_forward.w1.weight", "layers.0.feed_forward.w2.weight", "layers.0.feed_forward.w3.weight", "layers.0.attention_norm.weight", "layers.0.ffn_norm.weight", "layers.1.attention.wq.weight", "layers.1.attention.wk.weight", "layers.1.attention.wv.weight", "layers.1.attention.wo.weight", "layers.1.feed_forward.w1.weight", "layers.1.feed_forward.w2.weight"...

from flipped-vqa.

ikodoh avatar ikodoh commented on May 24, 2024

Saved checkpoint only contains trainable parameters, so you need to set strict=False in model_without_ddp.load_state_dict(checkpoint['model'], strict=False).
Please pull our code again.

from flipped-vqa.

Huangbukun avatar Huangbukun commented on May 24, 2024

Saved checkpoint only contains trainable parameters, so you need to set strict=False in model_without_ddp.load_state_dict(checkpoint['model'], strict=False). Please pull our code again.

I tried it, but it still doesnโ€™t work. If I directly load the weight file after finetune without changing the epoch, the process will be terminated directly and no inference will be performed.

from flipped-vqa.

ikodoh avatar ikodoh commented on May 24, 2024

This is because the loaded epoch of the checkpoint is the same as the total epoch.
You may load checkpoint without the epoch or increasing the total epoch.

from flipped-vqa.

Related Issues (19)

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.