Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

About loading weights on docker #6

Closed
atusi-nakajima opened this issue Jun 23, 2021 · 7 comments
Closed

About loading weights on docker #6

atusi-nakajima opened this issue Jun 23, 2021 · 7 comments

Comments

@atusi-nakajima
Copy link

I would like to load weights on the provided docker, but it is not working, so I have a question.
Here is a detailed description of how I did it.

First, I started the container and logged in as root.
docker pull deepdrive/spc
docker run -it --gpus all deepdrive/spc
At this time, the nvidia-smi command worked fine.
Screenshot from 2021-06-23 11-02-14

I then git cloned spc2 and placed the downloaded weights in /home/carla/spc2/pretrain/. (I renamed the file to model_only_fpn50.pth.)

Enter the spc virtual environment.
conda activate spc

Open a separate terminal and start carla.
docker exec -it <container ID> bash
(spc) carla@325657a8b89c:~/carla_0.8.4$ bash run.sh
Confirm that the message "Waiting for the client to connect..." is displayed.

Tried to start training in the previous terminal.
(spc) root@325657a8b89c:~/spc2/scripts# bash train_carla.sh

Here are the steps I followed so far. However, I could not start as follows.
Please let me know if there is something wrong. Thank you very much.

(spc) root@325657a8b89c:~/spc2/scripts# bash train_carla.sh No model to resume! turn to the base pretrain model: pretrain/model_only_fpn50.pth Traceback (most recent call last): File "main.py", line 95, in <module> main() File "main.py", line 91, in main train_policy(args, env) File "/home/carla/spc2/train.py", line 334, in train_policy trainer = Trainer(args, env) File "/home/carla/spc2/train.py", line 124, in __init__ self.model, self.optim, self.epoch, self.exploration, self.num_steps = init_models(self.args) File "/home/carla/spc2/models/model.py", line 238, in init_models train_net, epoch, step = load_model(args, args.save_path, train_net, resume=args.resume) File "/home/carla/spc2/utils/util.py", line 327, in load_model net.load_state_dict(state_dict) File "/home/carla/anaconda3/envs/spc/lib/python3.5/site-packages/torch/nn/modules/module.py", line 845, in load_state_dict self.__class__.__name__, "\n\t".join(error_msgs))) RuntimeError: Error(s) in loading state_dict for ConvLSTMMulti: Missing key(s) in state_dict: "conv_lstm.feature_map_predictor.identify.bias", "conv_lstm.feature_map_predictor.identify.weight", "conv_lstm.feature_map_predictor.stair.bias", "conv_lstm.feature_map_predictor.stair.weight", "conv_lstm.detector.coll_head.0.bias", "conv_lstm.detector.coll_head.0.weight", "conv_lstm.detector.coll_head.2.bias", "conv_lstm.detector.coll_head.2.weight", "conv_lstm.detector.coll_head.4.bias", "conv_lstm.detector.coll_head.4.weight", "conv_lstm.detector.coll_head.6.bias", "conv_lstm.detector.coll_head.6.weight", "conv_lstm.detector.coll_head.8.bias", "conv_lstm.detector.coll_head.8.weight", "conv_lstm.detector.thrd_head.confidence_head.0.bias", "conv_lstm.detector.thrd_head.confidence_head.0.weight", "conv_lstm.detector.thrd_head.confidence_head.2.bias", "conv_lstm.detector.thrd_head.confidence_head.2.weight", "conv_lstm.detector.thrd_head.confidence_head.4.bias", "conv_lstm.detector.thrd_head.confidence_head.4.weight", "conv_lstm.detector.thrd_head.confidence_head.6.bias", "conv_lstm.detector.thrd_head.confidence_head.6.weight", "conv_lstm.detector.thrd_head.confidence_head.8.bias", "conv_lstm.detector.thrd_head.confidence_head.8.weight", "conv_lstm.detector.thrd_head.residual_head.0.bias", "conv_lstm.detector.thrd_head.residual_head.0.weight", "conv_lstm.detector.thrd_head.residual_head.2.bias", "conv_lstm.detector.thrd_head.residual_head.2.weight", "conv_lstm.detector.thrd_head.residual_head.4.bias", "conv_lstm.detector.thrd_head.residual_head.4.weight", "conv_lstm.detector.thrd_head.residual_head.6.bias", "conv_lstm.detector.thrd_head.residual_head.6.weight", "conv_lstm.detector.thrd_head.residual_head.8.bias", "conv_lstm.detector.thrd_head.residual_head.8.weight", "conv_lstm.detector.thrd_head.dimension_head.0.bias", "conv_lstm.detector.thrd_head.dimension_head.0.weight", "conv_lstm.detector.thrd_head.dimension_head.2.bias", "conv_lstm.detector.thrd_head.dimension_head.2.weight", "conv_lstm.detector.thrd_head.dimension_head.4.bias", "conv_lstm.detector.thrd_head.dimension_head.4.weight", "conv_lstm.detector.thrd_head.dimension_head.6.bias", "conv_lstm.detector.thrd_head.dimension_head.6.weight", "conv_lstm.detector.thrd_head.dimension_head.8.bias", "conv_lstm.detector.thrd_head.dimension_head.8.weight", "conv_lstm.detector.thrd_head.center_head.0.bias", "conv_lstm.detector.thrd_head.center_head.0.weight", "conv_lstm.detector.thrd_head.center_head.2.bias", "conv_lstm.detector.thrd_head.center_head.2.weight", "conv_lstm.detector.thrd_head.center_head.4.bias", "conv_lstm.detector.thrd_head.center_head.4.weight", "conv_lstm.detector.thrd_head.center_head.6.bias", "conv_lstm.detector.thrd_head.center_head.6.weight", "conv_lstm.detector.thrd_head.center_head.8.bias", "conv_lstm.detector.thrd_head.center_head.8.weight", "conv_lstm.depth_head.0.bias", "conv_lstm.depth_head.0.weight", "conv_lstm.depth_head.2.bias", "conv_lstm.depth_head.2.weight", "conv_lstm.depth_head.4.bias", "conv_lstm.depth_head.4.weight", "conv_lstm.depth_head.6.bias", "conv_lstm.depth_head.6.weight", "conv_lstm.guide_layer.fc11.bias", "conv_lstm.guide_layer.fc11.weight", "conv_lstm.guide_layer.fc22.bias", "conv_lstm.guide_layer.fc22.weight", "conv_lstm.guide_layer.fc33.bias", "conv_lstm.guide_layer.fc33.weight", "conv_lstm.coll_layer.fc11.bias", "conv_lstm.coll_layer.fc11.weight", "conv_lstm.coll_layer.fc22.bias", "conv_lstm.coll_layer.fc22.weight", "conv_lstm.coll_layer.fc33.bias", "conv_lstm.coll_layer.fc33.weight", "conv_lstm.offroad_layer.fc11.bias", "conv_lstm.offroad_layer.fc11.weight", "conv_lstm.offroad_layer.fc22.bias", "conv_lstm.offroad_layer.fc22.weight", "conv_lstm.offroad_layer.fc33.bias", "conv_lstm.offroad_layer.fc33.weight", "conv_lstm.offlane_layer.fc11.bias", "conv_lstm.offlane_layer.fc11.weight", "conv_lstm.offlane_layer.fc22.bias", "conv_lstm.offlane_layer.fc22.weight", "conv_lstm.offlane_layer.fc33.bias", "conv_lstm.offlane_layer.fc33.weight", "conv_lstm.speed_layer.fc11.bias", "conv_lstm.speed_layer.fc11.weight", "conv_lstm.speed_layer.fc22.bias", "conv_lstm.speed_layer.fc22.weight", "conv_lstm.speed_layer.fc33.bias", "conv_lstm.speed_layer.fc33.weight". Unexpected key(s) in state_dict: "conv_lstm.detector_pred.loc_head.0.weight", "conv_lstm.detector_pred.loc_head.0.bias", "conv_lstm.detector_pred.loc_head.2.weight", "conv_lstm.detector_pred.loc_head.2.bias", "conv_lstm.detector_pred.loc_head.4.weight", "conv_lstm.detector_pred.loc_head.4.bias", "conv_lstm.detector_pred.loc_head.6.weight", "conv_lstm.detector_pred.loc_head.6.bias", "conv_lstm.detector_pred.loc_head.8.weight", "conv_lstm.detector_pred.loc_head.8.bias", "conv_lstm.detector_pred.cls_head.0.weight", "conv_lstm.detector_pred.cls_head.0.bias", "conv_lstm.detector_pred.cls_head.2.weight", "conv_lstm.detector_pred.cls_head.2.bias", "conv_lstm.detector_pred.cls_head.4.weight", "conv_lstm.detector_pred.cls_head.4.bias", "conv_lstm.detector_pred.cls_head.6.weight", "conv_lstm.detector_pred.cls_head.6.bias", "conv_lstm.detector_pred.cls_head.8.weight", "conv_lstm.detector_pred.cls_head.8.bias", "conv_lstm.coll_vehicle_layer.conv1.weight", "conv_lstm.coll_vehicle_layer.conv1.bias", "conv_lstm.coll_vehicle_layer.conv2.weight", "conv_lstm.coll_vehicle_layer.conv2.bias", "conv_lstm.coll_vehicle_layer.conv3.weight", "conv_lstm.coll_vehicle_layer.conv3.bias", "conv_lstm.coll_vehicle_layer.conv4.weight", "conv_lstm.coll_vehicle_layer.conv4.bias", "conv_lstm.coll_vehicle_layer.fc1.weight", "conv_lstm.coll_vehicle_layer.fc1.bias", "conv_lstm.coll_vehicle_layer.fc2.weight", "conv_lstm.coll_vehicle_layer.fc2.bias", "conv_lstm.coll_vehicle_layer.fc3.weight", "conv_lstm.coll_vehicle_layer.fc3.bias", "conv_lstm.coll_other_layer.conv1.weight", "conv_lstm.coll_other_layer.conv1.bias", "conv_lstm.coll_other_layer.conv2.weight", "conv_lstm.coll_other_layer.conv2.bias", "conv_lstm.coll_other_layer.conv3.weight", "conv_lstm.coll_other_layer.conv3.bias", "conv_lstm.coll_other_layer.conv4.weight", "conv_lstm.coll_other_layer.conv4.bias", "conv_lstm.coll_other_layer.fc1.weight", "conv_lstm.coll_other_layer.fc1.bias", "conv_lstm.coll_other_layer.fc2.weight", "conv_lstm.coll_other_layer.fc2.bias", "conv_lstm.coll_other_layer.fc3.weight", "conv_lstm.coll_other_layer.fc3.bias", "conv_lstm.guide_layer.fc1.weight", "conv_lstm.guide_layer.fc1.bias", "conv_lstm.guide_layer.fc2.weight", "conv_lstm.guide_layer.fc2.bias", "conv_lstm.guide_layer.fc3.weight", "conv_lstm.guide_layer.fc3.bias", "conv_lstm.coll_layer.fc1.weight", "conv_lstm.coll_layer.fc1.bias", "conv_lstm.coll_layer.fc2.weight", "conv_lstm.coll_layer.fc2.bias", "conv_lstm.coll_layer.fc3.weight", "conv_lstm.coll_layer.fc3.bias", "conv_lstm.offroad_layer.fc1.weight", "conv_lstm.offroad_layer.fc1.bias", "conv_lstm.offroad_layer.fc2.weight", "conv_lstm.offroad_layer.fc2.bias", "conv_lstm.offroad_layer.fc3.weight", "conv_lstm.offroad_layer.fc3.bias", "conv_lstm.offlane_layer.fc1.weight", "conv_lstm.offlane_layer.fc1.bias", "conv_lstm.offlane_layer.fc2.weight", "conv_lstm.offlane_layer.fc2.bias", "conv_lstm.offlane_layer.fc3.weight", "conv_lstm.offlane_layer.fc3.bias", "conv_lstm.speed_layer.fc1.weight", "conv_lstm.speed_layer.fc1.bias", "conv_lstm.speed_layer.fc2.weight", "conv_lstm.speed_layer.fc2.bias", "conv_lstm.speed_layer.fc3.weight", "conv_lstm.speed_layer.fc3.bias".

@noahcao
Copy link
Collaborator

noahcao commented Jul 5, 2021

I checked the uploaded weights and fixed the key naming issues you reported.

The previous naming incompatibility issue is raised because of the version naming shift, I believe the backbone weights in this new version of pertained weights should be fine.

I'm closing this issue as the issue should be fixed now. But please feel free to reopen it or open a new one if you encounter any further issues.

@noahcao noahcao closed this as completed Jul 5, 2021
@atusi-nakajima
Copy link
Author

Thank you very much.
However, I just downloaded the updated readme weight file, and it consists of the following, and I can't find the .pth filel.
Do I need to do something to rename the file?

archive
├── data
│   ├── 140239679049472
│   ├── 140239679052976
....................................................
│   └── 140241559087728
├── data.pkl
└── version

@noahcao
Copy link
Collaborator

noahcao commented Jul 5, 2021

I just checked the link (https://drive.google.com/file/d/1O7u_ifm0HZE1mBCEgnRW7aoyrX7WgEoZ/view?usp=sharing), it should just contain a .pth file. Could you double check your link?

@atusi-nakajima
Copy link
Author

The previous file is in zip format, but it will not load.
When you unzip it, it will be in a directory format, as described in issues.

@noahcao
Copy link
Collaborator

noahcao commented Jul 7, 2021

Sorry, I didn't get your point. I checked the history, the previous version should be a "pretrained.pth" file?

But, anyways, how about the current version provided by the link above? Does it work now?

@atusi-nakajima
Copy link
Author

atusi-nakajima commented Jul 7, 2021

I'm sorry for the misunderstanding.
I downloaded the link above and it was in zip format. When unzipped, the directory structure looks like this.
#6 (comment)

@noahcao
Copy link
Collaborator

noahcao commented Jul 7, 2021

That's strange, I triple checked the link: https://drive.google.com/file/d/1O7u_ifm0HZE1mBCEgnRW7aoyrX7WgEoZ/view?usp=sharing. It should just indicate to a .pth file, not a zip file. Have no idea why that happened to you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants