title: PyTorch RuntimeError: requires_grad_ is not supported on ScriptModules
body: <p>I'm running Python code from an old repo that seems to no longer work but I can't figure out why or how to fix it.</p>
  <p><strong>SETUP CODE</strong> (Google Colab Notebook)</p>
  <pre><code>#@title Setup
  import pkg_resources
  print(pkg_resources.get_distribution(&quot;torch&quot;).version)
  from IPython.utils import io
  with io.capture_output() as captured:
    !git clone https://github.com/openai/CLIP
    # !pip install taming-transformers
    !git clone https://github.com/CompVis/taming-transformers.git
    !rm -Rf clipit
    !git clone https://github.com/mfrashad/clipit.git
    !pip install ftfy regex tqdm omegaconf pytorch-lightning
    !pip install kornia
    !pip install imageio-ffmpeg   
    !pip install einops
    !pip install torch-optimizer
    !pip install easydict
    !pip install braceexpand
    !pip install git+https://github.com/pvigier/perlin-numpy
  
    # ClipDraw deps
    !pip install svgwrite
    !pip install svgpathtools
    !pip install cssutils
    !pip install numba
    !pip install torch-tools
    !pip install visdom
  
    !pip install gradio
  
    !git clone https://github.com/BachiLi/diffvg
    %cd diffvg
    # !ls
    !git submodule update --init --recursive
    !python setup.py install
    %cd ..
    
    !mkdir -p steps
    !mkdir -p models
  import sys
  sys.path.append(&quot;clipit&quot;)
  </code></pre>
  <p><strong>THEN ERRORS ON SECOND TO LAST INE</strong></p>
  <pre><code>import clipit
  # To reset settings to default
  clipit.reset_settings()
  # You can use &quot;|&quot; to separate multiple prompts
  prompts = &quot;underwater city&quot;
  # You can trade off speed for quality: draft, normal, better, best
  quality = &quot;normal&quot;
  # Aspect ratio: widescreen, square
  aspect = &quot;widescreen&quot;
  # Add settings
  clipit.add_settings(prompts=prompts, quality=quality, aspect=aspect)
  # Apply these settings and run
  settings = clipit.apply_settings()
  clipit.do_init(settings) # generates error
  clipit.do_run(settings)
  </code></pre>
  <blockquote>
  <p>Working with z of shape (1, 256, 16, 16) = 65536 dimensions. loaded
  pretrained LPIPS loss from taming/modules/autoencoder/lpips/vgg.pth
  VQLPIPSWithDiscriminator running with hinge loss. Restored from
  models/vqgan_imagenet_f16_16384.ckpt
  --------------------------------------------------------------------------- RuntimeError                              Traceback (most recent call
  last)  in ()
  12 # Apply these settings and run
  13 settings = clipit.apply_settings()
  ---&gt; 14 clipit.do_init(settings)
  15 clipit.do_run(settings)</p>
  <p>1 frames /usr/local/lib/python3.7/dist-packages/torch/jit/_script.py
  in fail(self, *args, **kwargs)
  912     def _make_fail(name):
  913         def fail(self, *args, **kwargs):
  --&gt; 914             raise RuntimeError(name + &quot; is not supported on ScriptModules&quot;)
  915
  916         return fail</p>
  <p>RuntimeError: requires_grad_ is not supported on ScriptModules</p>
  </blockquote>