xinsir6 / ControlNetPlus

ControlNet++: All-in-one ControlNet for image generations and editing!
Apache License 2.0
1.77k stars 43 forks source link

MobileSAM Entry Not Found #54

Open Profy opened 3 months ago

Profy commented 3 months ago

MobileSAM download in the controlnet_union_test_segment.py script does not work. It can't find the entry point.

Traceback (most recent call last):
  File "/home/user/.local/lib/python3.10/site-packages/huggingface_hub/utils/_errors.py", line 304, in hf_raise_for_status
    response.raise_for_status()
  File "/home/user/.local/lib/python3.10/site-packages/requests/models.py", line 1021, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://huggingface.co/dhkim2810/MobileSAM/resolve/main/sam_vit_h_4b8939.pth

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/user/ControlNetPlus/controlnet_union_test_segment.py", line 42, in <module>
    processor = SamDetector.from_pretrained('dhkim2810/MobileSAM').to(device)
  File "/home/user/.local/lib/python3.10/site-packages/controlnet_aux/segment_anything/__init__.py", line 35, in from_pretrained
    model_path = hf_hub_download(pretrained_model_or_path, filename, subfolder=subfolder, cache_dir=cache_dir)
  File "/home/user/.local/lib/python3.10/site-packages/huggingface_hub/utils/_validators.py", line 119, in _inner_fn
    return fn(*args, **kwargs)
  File "/home/user/.local/lib/python3.10/site-packages/huggingface_hub/file_download.py", line 1261, in hf_hub_download
    metadata = get_hf_file_metadata(
  File "/home/user/.local/lib/python3.10/site-packages/huggingface_hub/utils/_validators.py", line 119, in _inner_fn
    return fn(*args, **kwargs)
  File "/home/user/.local/lib/python3.10/site-packages/huggingface_hub/file_download.py", line 1674, in get_hf_file_metadata
    r = _request_wrapper(
  File "/home/user/.local/lib/python3.10/site-packages/huggingface_hub/file_download.py", line 369, in _request_wrapper
    response = _request_wrapper(
  File "/home/user/.local/lib/python3.10/site-packages/huggingface_hub/file_download.py", line 393, in _request_wrapper
    hf_raise_for_status(response)
  File "/home/user/.local/lib/python3.10/site-packages/huggingface_hub/utils/_errors.py", line 315, in hf_raise_for_status
    raise EntryNotFoundError(message, response) from e
huggingface_hub.utils._errors.EntryNotFoundError: 404 Client Error. (Request ID: Root=1-66b5d46f-2cece28e44cd3ba2052fed2c;a31fcc4e-c4bb-4b8b-adc0-1b7a6d1cff89)

Entry Not Found for url: https://huggingface.co/dhkim2810/MobileSAM/resolve/main/sam_vit_h_4b8939.pth.

Is there an additional step (such as adding weights locally or using a token for downloading) required to download MobileSAM?

tttonyalpha commented 2 months ago

Try to use SamDetector.from_pretrained("dhkim2810/MobileSAM", model_type="vit_t", filename="mobile_sam.pt")

aycaecemgul commented 3 weeks ago

Try to use SamDetector.from_pretrained("dhkim2810/MobileSAM", model_type="vit_t", filename="mobile_sam.pt")

I tried this but i got another error: RuntimeError: Expected all tensors to be on the same device, but found at least two devices, cuda:0 and cpu! I am using controlnet-aux==0.0.9