MCPcopy Create free account
hub / github.com/FreeformRobotics/OTS / load_url

Function load_url

models/utils.py:10–18  ·  view source on GitHub ↗
(url, model_dir='./pretrained', map_location=None)

Source from the content-addressed store, hash-verified

8
9
10def load_url(url, model_dir='./pretrained', map_location=None):
11 if not os.path.exists(model_dir):
12 os.makedirs(model_dir)
13 filename = url.split('/')[-1]
14 cached_file = os.path.join(model_dir, filename)
15 if not os.path.exists(cached_file):
16 sys.stderr.write('Downloading: "{}" to {}\n'.format(url, cached_file))
17 urlretrieve(url, cached_file)
18 return torch.load(cached_file, map_location=map_location)

Callers 3

resnet18Function · 0.85
resnet50Function · 0.85
resnet101Function · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected