Passing the parameters of pretrained googlenet to an optimizer

Bill_Collins: <p>I downloaded the pretrained quantized googlenet model to finetune on some data.</p>
<p>model = models.quantization.googlenet(pretrained=True, quantize=True)</p>
<p>However, list(model.parameters()) yields [].</p>
<p>How can I access the parameters to pass to an optimizer or set requires_grad?</p>
<p>There is no clear structure in the model containing the parameters, like ModuleList or something, which is mentioned in other posts about this type of topic. Here is a fragment of the model:</p>
<p>QuantizableGoogLeNet(<br>
(conv1): QuantizableBasicConv2d(<br>
(conv): QuantizedConvReLU2d(3, 64, kernel_size=(7, 7), stride=(2, 2), scale=0.08655554801225662, zero_point=0, padding=(3, 3))<br>
(bn): Identity()<br>
(relu): Identity()<br>
)</p>
<p>Thanks</p>

eqy: <p>From the docs, it seems that quantized models aren’t intended to be user with an optimizer (I’m assuming for training):</p><aside class="onebox githubblob" data-onebox-src="https://github.com/pytorch/vision/blob/62740807c18e68bb0acd85895dca527f9a655bd5/torchvision/models/quantization/googlenet.py#L147">
  <header class="source">

      <a href="https://github.com/pytorch/vision/blob/62740807c18e68bb0acd85895dca527f9a655bd5/torchvision/models/quantization/googlenet.py#L147" target="_blank" rel="noopener nofollow ugc">github.com</a>
  </header>

  <article class="onebox-body">
    <h4><a href="https://github.com/pytorch/vision/blob/62740807c18e68bb0acd85895dca527f9a655bd5/torchvision/models/quantization/googlenet.py#L147" target="_blank" rel="noopener nofollow ugc">pytorch/vision/blob/62740807c18e68bb0acd85895dca527f9a655bd5/torchvision/models/quantization/googlenet.py#L147</a></h4>



    <pre class="onebox">      <code class="lang-py">
        <ol class="start lines" start="137" style="counter-reset: li-counter 136 ;">
            <li>def googlenet(</li>
            <li>    *,</li>
            <li>    weights: Optional[Union[GoogLeNet_QuantizedWeights, GoogLeNet_Weights]] = None,</li>
            <li>    progress: bool = True,</li>
            <li>    quantize: bool = False,</li>
            <li>    **kwargs: Any,</li>
            <li>) -&gt; QuantizableGoogLeNet:</li>
            <li>    r"""GoogLeNet (Inception v1) model architecture from</li>
            <li>    `"Going Deeper with Convolutions" &lt;http://arxiv.org/abs/1409.4842&gt;`_.</li>
            <li>
            <li class="selected">    Note that quantize = True returns a quantized model with 8 bit</li>
            <li>    weights. Quantized models only support inference and run on CPUs.</li>
            <li>    GPU inference is not yet supported</li>
            <li>
            <li>    Args:</li>
            <li>        weights (GoogLeNet_QuantizedWeights or GoogLeNet_Weights, optional): The pretrained</li>
            <li>            weights for the model</li>
            <li>        progress (bool): If True, displays a progress bar of the download to stderr</li>
            <li>        quantize (bool): If True, return a quantized version of the model</li>
            <li>    """</li>
            <li>    weights = (GoogLeNet_QuantizedWeights if quantize else GoogLeNet_Weights).verify(weights)</li>
        </ol>
      </code>
    </pre>



  </article>

  <div class="onebox-metadata">
    
    
  </div>

  <div style="clear: both"></div>
</aside>