Loading pretrained regnet Model

Shekar_Neo: <p>How can i use this regnet pretrained model for transfer learning,</p>
<p><a href="https://github.com/facebookresearch/pycls/blob/master/MODEL_ZOO.md" rel="nofollow noopener">regnety-32f</a></p>
<p>i have tried to load this model by this</p>
<pre><code class="lang-auto">from pycls.models.regnet import RegNet

device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
model = RegNet()
# optimizer = TheOptimizerClass(*args, **kwargs)

checkpoint = torch.load('model/RegNetY-32GF_dds_8gpu.pyth', map_location=device)['model_state']
model.load_state_dict(checkpoint)```

but got this error:

RuntimeError                              Traceback (most recent call last)
&lt;ipython-input-19-2467f7a101a2&gt; in &lt;module&gt;
      9         checkpoint[key.replace('model.', '')] = checkpoint[key]
     10         del checkpoint[key]
---&gt; 11 model.load_state_dict(checkpoint)

c:\users\neo\.conda\envs\pytorch\lib\site-packages\torch\nn\modules\module.py in load_state_dict(self, state_dict, strict)
    828         if len(error_msgs) &gt; 0:
    829             raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format(
--&gt; 830                                self.__class__.__name__, "\n\t".join(error_msgs)))
    831         return _IncompatibleKeys(missing_keys, unexpected_keys)
    832 

**RuntimeError: Error(s) in loading state_dict for RegNet:**
	Missing key(s) in state_dict: "s1.b3.f.a.weight", "s1.b3.f.a_bn.weight", "s1.b3.f.a_bn.bias", "s1.b3.f.a_bn.running_mean", "s1.b3.f.a_bn.running_var", "s1.b3.f.b.weight", "s1.b3.f.b_bn.weight", "s1.b3.f.b_bn.bias", "s1.b3.f.b_bn.running_mean", "s1.b3.f.b_bn.running_var", "s1.b3.f.c.weight", "s1.b3.f.c_bn.weight", "s1.b3.f.c_bn.bias", "s1.b3.f.c_bn.running_mean", "s1.b3.f.c_bn.running_var", "s1.b4.f.a.weight", "s1.b4.f.a_bn.weight", "s1.b4.f.a_bn.bias", "s1.b4.f.a_bn.running_mean", "s1.b4.f.a_bn.running_var", "s1.b4.f.b.weight", "s1.b4.f.b_bn.weight", "s1.b4.f.b_bn.bias", "s1.b4.f.b_bn.running_mean", "s1.b4.f.b_bn.running_var", "s1.b4.f.c.weight", "s1.b4.f.c_bn.weight", "s1.b4.f.c_bn.bias", "s1.b4.f.c_bn.running_mean", "s1.b4.f.c_bn.running_var", "s2.b6.f.a.weight", "s2.b6.f.a_bn.weight", "s2.b6.f.a_bn.bias", "s2.b6.f.a_bn.running_mean", "s2.b6.f.a_bn.running_var", "s2.b6.f.b.weight", "s2.b6.f.b_bn.weight", "s2.b6.f.b_bn.bias", "s2.b6.f.b_bn.running_mean", "s2.b6.f.b_bn.running_var", "s2.b6.f.c.weight", "s2.b6.f.c_bn.weight", "s2.b6.f.c_bn.bias", "s2.b6.f.c_bn.running_mean", "s2.b6.f.c_bn.running_var". 
	**Unexpected key(s) in state_dict:** "s3.b1.proj.weight", "s3.b1.bn.weight", "s3.b1.bn.bias", "s3.b1.bn.running_mean", "s3.b1.bn.running_var", "s3.b1.bn.num_batches_tracked", "s3.b1.f.a.weight", "s3.b1.f.a_bn.weight", "s3.b1.f.a_bn.bias", "s3.b1.f.a_bn.running_mean", "s3.b1.f.a_bn.running_var", "s3.b1.f</code></pre>

surya00060: <p>Can you try to load the model by mapping it to CPU and then moving it to GPU by model.to(device)?</p>

Shekar_Neo: <p>But i have already loaded it in cpu</p>

Shekar_Neo: <p>I was loading default config files which is resnet50.yml, it should be config.yml (for regnet model config file)</p>
<pre><code class="lang-auto">import pycls.core.config as config

config.load_cfg('configs/regnety/')
</code></pre>
<p>will works fine</p>