facebookresearch / facebookresearch/sam2
why it takes forever to load the model?
- Dominant language
- Jupyter Notebook
- Stars
- 19.9k
- Forks
- 2.5k
- PR merge metrics
- No merged PRs in 30d
Description
While I was building the predictor with checkpoint, it takes pretty long to load the model for whichever checkpoint, from tiny to the large one. However, I did not run into this issue when I run it in colab.
Actually, it seems to be stuck since I has never succeed in loading the model with python file. I have to stop the process and the terminal shows such message.
`File "/workspace/user_code/segment-anything-2/demo_video.py", line 6, in
predictor = build_sam2_video_predictor(model_cfg, checkpoint)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/workspace/user_code/segment-anything-2/sam2/build_sam.py", line 74, in build_sam2_video_predictor
_load_checkpoint(model, ckpt_path)
File "/workspace/user_code/segment-anything-2/sam2/build_sam.py", line 121, in _load_checkpoint
sd = torch.load(ckpt_path, map_location="cpu")["model"]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/data/miniconda3/envs/env-3.11.9/lib/python3.11/site-packages/torch/serialization.py", line 1025, in load
return _load(opened_zipfile,
^^^^^^^^^^^^^^^^^^^^^
File "/data/miniconda3/envs/env-3.11.9/lib/python3.11/site-packages/torch/serialization.py", line 1446, in _load
result = unpickler.load()
^^^^^^^^^^^^^^^^
File "/data/miniconda3/envs/env-3.11.9/lib/python3.11/site-packages/torch/serialization.py", line 1416, in persistent_load
typed_storage = load_tensor(dtype, nbytes, key, _maybe_decode_ascii(location))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/data/miniconda3/envs/env-3.11.9/lib/python3.11/site-packages/torch/serialization.py", line 1381, in load_tensor
storage = zip_file.get_storage_from_record(name, numel, torch.UntypedStorage)._typed_storage()._untyped_storage`
Contributor guide
Assessment
This issue has not been assessed yet.