Tandon-A / emotic

PyTorch implementation of Emotic CNN methodology to recognize emotions in images using context information.
MIT License
134 stars 47 forks source link

TypeError: the first argument must be callable How to resolve this? #11

Closed bindujiit closed 2 years ago

bindujiit commented 3 years ago

mode train tcmalloc: large alloc 3502186496 bytes == 0x55b885002000 @ 0x7f8f31a3a1e7 0x7f8f2f5ba46e 0x7f8f2f60ee7c 0x7f8f2f60faaf 0x7f8f2f6b1470 0x55b87ecc1544 0x55b87ecc1240 0x55b87ed35627 0x55b87ed2f9ee 0x55b87ecc2bda 0x55b87ed31737 0x55b87ed2f9ee 0x55b87ecc2bda 0x55b87ed34d00 0x55b87ecc2afa 0x55b87ed30915 0x55b87ed2f9ee 0x55b87ed2f6f3 0x55b87edf94c2 0x55b87edf983d 0x55b87edf96e6 0x55b87edd1163 0x55b87edd0e0c 0x7f8f30824bf7 0x55b87edd0cea train context (23266, 224, 224, 3) body (23266, 128, 128, 3) cat (23266, 26) cont (23266, 3) val context (3315, 224, 224, 3) body (3315, 128, 128, 3) cat (3315, 26) cont (3315, 3) train loader 448 val loader 64 data/experiment/models/resnet18_places365.pth.tar Traceback (most recent call last): File "main.py", line 87, in train_emotic(result_path, model_path, train_log_path, val_log_path, ind2cat, ind2vad, context_norm, body_norm, args) File "/content/gdrive/My Drive/Deep learning Models/emotic-master/emotic-master/train.py", line 174, in train_emotic model_context, model_body = prep_models(context_model=args.context_model, body_model=args.body_model, model_dir=model_path) File "/content/gdrive/My Drive/Deep learning Models/emotic-master/emotic-master/prepare_models.py", line 32, in prep_models checkpoint = torch.load(save_file, map_location=lambda storage, loc: storage) # model trained in GPU could be deployed in CPU machine like this! File "/usr/local/lib/python3.7/dist-packages/torch/serialization.py", line 607, in load return _load(opened_zipfile, map_location, pickle_module, **pickle_load_args) File "/usr/local/lib/python3.7/dist-packages/torch/serialization.py", line 869, in _load class UnpicklerWrapper(pickle_module.Unpickler): # type: ignore[name-defined] TypeError: the first argument must be callable

YHDASHEN commented 3 years ago

Same problem, but it's after when I updated torch version. I guess that could be the reason.

sumit0309 commented 2 years ago

which torch version, it worked? I tried with 1.10.1+cpu, it is throwing above error.

sumit0309 commented 2 years ago

pip install torchvision==0.9.0.. with this error is gone.. uninstall newer torch version before this.

Tandon-A commented 2 years ago

Thanks @sumit0309 for resolving this issue.