Why did I fail to run the colab file you provided directly?
UnpicklingError Traceback (most recent call last)
in ()
20 # but num_rotations=64~128 is often sufficient.
21 # To reduce the memory usage, we can reduce the tile size in the next cell.
---> 22 demo = Demo(num_rotations=256, device='cpu') # change to "cuda" if you have a GPU.
MaxRetryError: HTTPSConnectionPool(host='api.openstreetmap.org', port=443): Max retries exceeded with url: /api/0.6/map.json?bbox=8.548173412781503%2C47.37771879777533%2C8.55013322635351%2C47.37904999377059 (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x00000293A557CEB0>, 'Connection to api.openstreetmap.org timed out. (connect timeout=10)'))
Can you report the full traceback? There's likely some intermediate scopes missing. Is there an error message related to downloading the model? can you try again on a fresh runtime?
The link works fine on my end. Is this in colab? if not you might be connected from IP that spams OSM and your requests are thus limited.
in ()
20 # but num_rotations=64~128 is often sufficient.
21 # To reduce the memory usage, we can reduce the tile size in the next cell.
---> 22 demo = Demo(num_rotations=256, device='cpu') # change to "cuda" if you have a GPU.
2 frames
/content/OrienterNet/maploc/demo.py in __init__(self, experiment_or_path, device, **kwargs)
132 experiment_or_path, _ = pretrained_models[experiment_or_path]
133 path = resolve_checkpoint_path(experiment_or_path)
--> 134 ckpt = torch. load(path, map_location=(lambda storage, loc: storage))
135 config = ckpt["hyper_parameters"]
136 config.model.update(kwargs)
/usr/local/lib/python3.10/dist-packages/torch/serialization.py in load(f, map_location, pickle_module, weights_only, **pickle_load_args)
813 except RuntimeError as e:
814 raise pickle.UnpicklingError(UNSAFE_MESSAGE + str(e)) from None
--> 815 return _legacy_load(opened_file, map_location, pickle_module, **pickle_load_args)
816
817
/usr/local/lib/python3.10/dist-packages/torch/serialization.py in _legacy_load(f, map_location, pickle_module, **pickle_load_args)
1031 "functionality.")
1032
-> 1033 magic_number = pickle_module.load(f, **pickle_load_args)
1034 if magic_number != MAGIC_NUMBER:
1035 raise RuntimeError("Invalid magic number; corrupt file?")
UnpicklingError: invalid load key, '<'.
2. I tried to run the following code successfully, but I couldn't run the code in the demo:
import requests
import time
OSM_URL = "https://api.openstreetmap.org/api/0.6/map.json"
start_time = time. time()
response = requests. get(OSM_URL)
end_time = time. time()
print(f"The request took {end_time - start_time} seconds.")
The request took 0.9423749446868896 seconds.
UnpicklingError Traceback (most recent call last)
2 frames /usr/local/lib/python3.10/dist-packages/torch/serialization.py in _legacy_load(f, map_location, pickle_module, pickle_load_args) 1031 "functionality.") 1032 -> 1033 magic_number = pickle_module.load(f, pickle_load_args) 1034 if magic_number != MAGIC_NUMBER: 1035 raise RuntimeError("Invalid magic number; corrupt file?")
UnpicklingError: invalid load key, '<'.
2、Unable to run download osm smoothly
MaxRetryError: HTTPSConnectionPool(host='api.openstreetmap.org', port=443): Max retries exceeded with url: /api/0.6/map.json?bbox=8.548173412781503%2C47.37771879777533%2C8.55013322635351%2C47.37904999377059 (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x00000293A557CEB0>, 'Connection to api.openstreetmap.org timed out. (connect timeout=10)'))