PJLab-ADG / 3DTrans

An open-source codebase for exploring autonomous driving pre-training
https://bobrown.github.io/Team_3DTrans.github.io/
Apache License 2.0
585 stars 72 forks source link

Using ckpt for pretraining #24

Closed martiiv closed 9 months ago

martiiv commented 9 months ago

Hello!

I am currently working on reproducing the results from the AD-PT paper. To save some time I am trying to include a ckpt file when running the pretraining with Pointcontrast file.

sh scripts/PRETRAIN/dist_train_pointcontrast.sh 2 \
--cfg_file ./cfgs/once_models/unsupervised_model/pointcontrast_pvrcnn_res_plus_backbone.yaml \
--batch_size 4 \
--epochs 4 \
--ckpt once_1M_ckpt.pth

However the model fails when trying to load the model state giving me the following error:

Traceback (most recent call last):
  File "train_pointcontrast.py", line 212, in <module>
    main()
  File "train_pointcontrast.py", line 140, in main
    it, start_epoch = model.load_params_with_optimizer(args.ckpt, to_cpu=dist_train, optimizer=optimizer, logger=logger)
  File "../pcdet/models/detectors/detector3d_template.py", line 403, in load_params_with_optimizer
    self._load_state_dict(checkpoint['model_state'], strict=True)
KeyError: 'model_state'

Do I need to save my model state before applying the checkpoint? Do you have a solution for this problem @BOBrown

martiiv commented 9 months ago

Update: The code crashes on line 403 here:

image

Am I using the wrong ckpt file? Since it doesn't recognize the model_state key

BOBrown commented 9 months ago

@martiiv

Which ckpt file are you using? Please note that we provide two different pre-training methods in our repo.

martiiv commented 9 months ago

@BOBrown I am using pointContrast, is the ckpt file for AD-PT pre-training?

BOBrown commented 9 months ago

@martiiv No. The ckpt file for AD-PT is shown in here for three ckpts trained using different sizes of pre-training data (100K, 500K, 1M)