continue-revolution / sd-webui-segment-anything

Segment Anything for Stable Diffusion WebUI
3.38k stars 206 forks source link

[Feature]: can it install and download a sam model after installing, i work on colab and it dosent seems to be downloading sam #122

Open revolverocelot1 opened 1 year ago

revolverocelot1 commented 1 year ago

Expected behavior

it gives Start SAM Processing Found GroundingDINO in pip. Verifying if dynamic library build success. GroundingDINO dynamic library have been successfully built. Running GroundingDINO Inference Initializing GroundingDINO GroundingDINO_SwinT_OGC (694MB) Initializing SAM to cpu Traceback (most recent call last): File "/usr/local/lib/python3.10/dist-packages/gradio/routes.py", line 422, in run_predict output = await app.get_blocks().process_api( File "/usr/local/lib/python3.10/dist-packages/gradio/blocks.py", line 1323, in process_api result = await self.call_function( File "/usr/local/lib/python3.10/dist-packages/gradio/blocks.py", line 1051, in call_function prediction = await anyio.to_thread.run_sync( File "/usr/local/lib/python3.10/dist-packages/anyio/to_thread.py", line 31, in run_sync return await get_asynclib().run_sync_in_worker_thread( File "/usr/local/lib/python3.10/dist-packages/anyio/_backends/_asyncio.py", line 937, in run_sync_in_worker_thread return await future File "/usr/local/lib/python3.10/dist-packages/anyio/_backends/_asyncio.py", line 867, in run result = context.run(func, *args) File "/content/cagliostro-colab-ui/extensions/sd-webui-segment-anything/scripts/sam.py", line 201, in sam_predict sam = init_sam_model(sam_model_name) File "/content/cagliostro-colab-ui/extensions/sd-webui-segment-anything/scripts/sam.py", line 129, in init_sam_model raise Exception( Exception: not found, please download model to models/sam.

continue-revolution commented 1 year ago

In v1 you need to download models on your own, but in v2 I will probably implement auto-download. Though I cannot give an estimate on when v2 will be ready.

revolverocelot1 commented 1 year ago

In v1 you need to download models on your own, but in v2 I will probably implement auto-download. Though I cannot give an estimate on when v2 will be ready. thanks for response. looks like i have to write a separate code in collab for that

a373648449 commented 11 months ago

C:\stable-diffusion-webui\venv\lib\site-packages\transformers\modeling_utils.py:884: FutureWarning: The device argument is deprecated and will be removed in v5 of Transformers. warnings.warn( Initializing SAM to cuda {'sam_vit_h': <function build_sam_vit_h at 0x0000025F19076440>, 'sam_vit_l': <function build_sam_vit_l at 0x0000025F19075990>, 'sam_vit_b': <function build_sam_vit_b at 0x0000025F19075900>, 'sam_hq_vit_h': <function build_sam_hq_vit_h at 0x0000025F18F2E4D0>, 'sam_hq_vit_l': <function build_sam_hq_vit_l at 0x0000025F1908A050>, 'sam_hq_vit_b': <function build_sam_hq_vit_b at 0x0000025F1908B400>, 'mobile_sam': <function build_mobile_sam at 0x0000025F1908B490>} Traceback (most recent call last): File "C:\stable-diffusion-webui\venv\lib\site-packages\gradio\routes.py", line 488, in run_predict output = await app.get_blocks().process_api( File "C:\stable-diffusion-webui\venv\lib\site-packages\gradio\blocks.py", line 1431, in process_api result = await self.call_function( File "C:\stable-diffusion-webui\venv\lib\site-packages\gradio\blocks.py", line 1103, in call_function prediction = await anyio.to_thread.run_sync( File "C:\stable-diffusion-webui\venv\lib\site-packages\anyio\to_thread.py", line 33, in run_sync return await get_asynclib().run_sync_in_worker_thread( File "C:\stable-diffusion-webui\venv\lib\site-packages\anyio_backends_asyncio.py", line 877, in run_sync_in_worker_thread return await future File "C:\stable-diffusion-webui\venv\lib\site-packages\anyio_backends_asyncio.py", line 807, in run result = context.run(func, args) File "C:\stable-diffusion-webui\venv\lib\site-packages\gradio\utils.py", line 707, in wrapper response = f(args, **kwargs) File "C:\stable-diffusion-webui\extensions\sd-webui-segment-anything\scripts\sam.py", line 207, in sam_predict sam = init_sam_model(sam_model_name) File "C:\stable-diffusion-webui\extensions\sd-webui-segment-anything\scripts\sam.py", line 130, in init_sam_model sam_model_cache[sam_model_name] = load_sam_model(sam_model_name) File "C:\stable-diffusion-webui\extensions\sd-webui-segment-anything\scripts\sam.py", line 81, in load_sam_model sam = sam_model_registrymodel_type KeyError: 'groundingdino_swint'

help