Caffe2_checkpoint is integer when loading pre-train models
See original GitHub issueHello. I’m testing different pre-train networks you offer on MODEL_ZOO.md. When I’m loading different model using pickle (as they are in caffe2), it returns an integer; this later results in an error as an integer doesn’t have key-values.
My environment corresponds to a docker container, generated from pytorch/pytorch:1.7.0-cuda11.0-cudnn8-runtime
image available in Docker Hub, running Ubuntu 18.04.5 LTS and with the needed dependencies stated in the INSTALL.md. Important dependencies version to mention:
- pickle == 4.0
- python == 3.8.3
- torch == 1.7.0
My hardware is:
- Nvidia GeForce GTX 1050Ti
- Intel i7-7700HQ CPU @ 2.80GHz
This happens specifically in the lines 213-215 from the slowfast/utils/checkpoint.py
, in the load_checkpoint
function.
213 if convert_from_caffe2:
214 with g_pathmgr.open(path_to_checkpoint, "rb") as f:
215 caffe2_checkpoint = pickle.load(f, encoding="latin1")
caffe2_checkpoint
is an int, so when it tries access the keys from the dictionary, it fails (line 218):
218 for key in caffe2_checkpoint["blobs"].keys():
The caffe2_checkpoint
is an integer for some model. Among the tested models with this behavior, are:
- SLOWFAST_64x2_R101_50_50.pkl (AVA)
- SLOWFAST_32x2_R101_50_50.pkl (AVA)
- SLOWFAST_8x8_R50_stepwise_multigrid.pkl (Kinetics)
- SLOWFAST_8x8_R50_stepwise.pkl (Kinetics)
Other tested model that return the correct object (dictionary), are:
- SLOWFAST_8x8_R50.pkl (Kinetics)
- SLOWFAST_4x16_R50.pkl (Kinetics)
- SLOWFAST_32x2_R101_50_50_v2.1.pkl (AVA)
The command I’m using is:
python3 slowfast/tools/run_net.py \
--cfg \
slowfast/configs/AVA/c2/SLOWFAST_64x2_R101_50_50.yaml \
TEST.DATASET ava \
DATA.PATH_TO_DATA_DIR PATH_TO_DATA_DIR \
AVA.ANNOTATION_DIR annotations \
AVA.LABEL_MAP_FILE ava_action_list_v2.2.pbtxt \
AVA.GROUNDTRUTH_FILE ava_val_v2.2.csv \
AVA.EXCLUSION_FILE ava_val_excluded_timestamps_v2.2.csv \
AVA.TEST_PREDICT_BOX_LISTS [' "ava_val_predicted_boxes.csv" ']
AVA.FRAME_DIR frames \
AVA.FRAME_LIST_DIR frame_lists \
AVA.TEST_LISTS [' "val.csv" '] \
TEST.CHECKPOINT_FILE_PATH path/to/SLOWFAST_64x2_R101_50_50.pkl \
TEST.CHECKPOINT_TYPE caffe2
TRAIN.ENABLE False \
TEST.ENABLE True \
DATA.NUM_FRAMES 16 \
NUM_GPUS 1
I would like to confirm if the problem is only on my end or the .pkl
files have the problem.
Issue Analytics
- State:
- Created 3 years ago
- Comments:9
I encountered the same problem as you, and it has been solved. The reason is that the Pretrained Model should be downloaded instead of downloading the model.Their names are the same.
I had the same problems, see this post:
https://github.com/facebookresearch/SlowFast/issues/85