code: def _provide_torchvision_weights(
      par_path: str, filename: str
  ) -> None:
      """
      Ensure the weights files are available for a torchvision model.
      """
      # In OSS, torchvision looks for vgg16 weights in
      #   https://download.pytorch.org/models/vgg16-397923af.pth
      # Inside fbcode, this is replaced by asking iopath for
      #   manifold://torchvision/tree/models/vgg16-397923af.pth
      # (the code for this replacement is in
      #    fbcode/pytorch/vision/fb/_internally_replaced_utils.py )
      #
      # iopath does this by looking for the file at the cache location
      # and if it is not there getting it from manifold.
      # (the code for this is in
      #    fbcode/fair_infra/data/iopath/iopath/fb/manifold.py )
      #
      # On the remote execution worker, manifold is inaccessible.
      # We solve this by making the cached file available before iopath
      # looks.
      #
      # By default the cache location is
      #   ~/.torch/iopath_cache/manifold_cache/tree/models/vgg16-397923af.pth
      # But we can't write to the home directory on the RE worker.
      # We define FVCORE_CACHE to change the cache location to
      #  iopath_cache/manifold_cache/tree/models/vgg16-397923af.pth
      # (Without it, manifold caches in unstable temporary locations on RE.)
      #
      # The file we want has been copied from
      #    tree/models/vgg16-397923af.pth in the torchvision bucket
      # to
      #    tree/testing/vgg16-397923af.pth in the co3d bucket
      # and the TARGETS file copies it somewhere in the PAR which we
      # recover with get_file_path.
      # (It can't copy straight to a nested location, see
      #    https://fb.workplace.com/groups/askbuck/posts/2644615728920359/)
      # Here we symlink it to the new cache location.
      if INSIDE_RE_WORKER:
          from libfb.py.parutil import get_file_path
  
          os.environ["FVCORE_CACHE"] = "iopath_cache"
  
          source = Path(get_file_path(par_path))
          assert source.is_file()
  
          dest = Path("iopath_cache/manifold_cache/tree/models")
          if not dest.exists():
              dest.mkdir(parents=True)
  
          if not (dest / filename).is_symlink():
              try:
                  (dest / filename).symlink_to(source)
              except FileExistsError:
                  print("FileExistsError: no symlink created.")
  
file_path: pytorch3d/tests/implicitron/common_resources.py
imports: import contextlib
  import logging
  import os
  import tempfile
  import unittest
  from pathlib import Path
  from typing import Generator, Tuple
  from zipfile import ZipFile
  from iopath.common.file_io import PathManager
label_desc: Use image node_id 3 for calling a global function with example usage: _provide_torchvision_weights(par_path, filename) without return types