First argument error in pytorch.loads() function when working with Emotic demo
Basically, I'm creating an emotion recognition application, and I'm using Emotic's image dataset. They have their own premade program and trained model for a demo (The colab link below) but for some reason the third cell under  I. Prepare places pretrained model is encountering the error:
the first argument must be callable on line 19 in the 4th Google Colab cell.
Code:
# Converting model weights to python3.6 format
import torch
from PIL import Image
from torch.autograd import Variable as V
import torchvision.models as models
from torchvision import transforms as trn
from torch.nn import functional as F
import os

model_path = './places'
archs = ['resnet18']
for arch in archs:
    model_file = os.path.join(model_path,'%s_places365.pth.tar' % arch)
    save_file = os.path.join(model_path,'%s_places365_py36.pth.tar' % arch)

    from functools import partial
    import pickle
    pickle.load = partial(pickle.load, encoding=&quot;latin1&quot;)
    pickle.Unpickler = partial(pickle.Unpickler, encoding=&quot;latin1&quot;)
    model = torch.load(model_file, map_location=lambda storage, loc: storage, pickle_module=pickle)
    torch.save(model, save_file)
    print('converting %s -&gt; %s'%(model_file, save_file))

print ('completed cell')
# Saving the model weights to use ahead in the notebook

# the architecture to use
arch = 'resnet18'
model_weight = os.path.join(model_path, 'resnet18_places365_py36.pth.tar')

# create the network architecture
model = models.__dict__[arch](num_classes=365)

#model_weight = '%s_places365.pth.tar' % arch

checkpoint = torch.load(model_weight) # model trained in GPU could be deployed in CPU machine like this!
state_dict = {str.replace(k,'module.',''): v for k,v in checkpoint['state_dict'].items()} # the data parallel layer will add 'module' before each layer name
model.load_state_dict(state_dict)
model.eval()

model.cpu()
torch.save(model, os.path.join(model_path, 'res_context' + '.pth'))
print ('completed cell')

Does anyone have any idea why this is happening? (Haven't changed any code this is the demo offered by Emotic)
Error:
TypeError                                 Traceback (most recent call last)
&lt;ipython-input-8-1a9e3bc55eae&gt; in &lt;module&gt;()
     17 #model_weight = '%s_places365.pth.tar' % arch
     18 
---&gt; 19 checkpoint = torch.load(model_weight) # model trained in GPU could be deployed in CPU machine like this!
     20 state_dict = {str.replace(k,'module.',''): v for k,v in checkpoint['state_dict'].items()} # the data parallel layer will add 'module' before each layer name
     21 model.load_state_dict(state_dict)

1 frames
/usr/local/lib/python3.7/dist-packages/torch/serialization.py in _load(zip_file, map_location, pickle_module, pickle_file, **pickle_load_args)
    867     # because it's marked readonly in pickle.
    868     # The type: ignore is because mypy can't statically determine the type of this class.
--&gt; 869     class UnpicklerWrapper(pickle_module.Unpickler):  # type: ignore[name-defined]
    870         # from https://stackoverflow.com/questions/13398462/unpickling-python-objects-with-a-changed-module-path/13405732
    871         # Lets us override the imports that pickle uses when unpickling an object.

TypeError: the first argument must be callable

Public Gopogle Colab link:
https://colab.research.google.com/github/Tandon-A/emotic/blob/master/Colab_train_emotic.ipynb

I am the author of this repository. I had fixed this issue back in August 2021. The issue is caused due to some changes in the Python Pickle module in the python 3.7 version. The code used to work properly in the Python 3.6 version.
You can try the Colab_train_emotic.ipynb file.
