IDEA-Research / Grounded-Segment-Anything

Grounded SAM: Marrying Grounding DINO with Segment Anything & Stable Diffusion & Recognize Anything - Automatically Detect , Segment and Generate Anything
https://arxiv.org/abs/2401.14159
Apache License 2.0
15.16k stars 1.4k forks source link

can not auto download [bert-base-uncased] #284

Closed shaun17 closed 1 year ago

shaun17 commented 1 year ago

To create a public link, set share=True in launch(). Startup time: 10.8s (import torch: 1.9s, import gradio: 1.4s, import ldm: 0.3s, other imports: 1.1s, load scripts: 1.2s, load SD checkpoint: 3.5s, create ui: 1.2s, gradio launch: 0.2s). Running GroundingDINO Inference Initializing GroundingDINO GroundingDINO_SwinT_OGC (694MB) final text_encoder_type: bert-base-uncased Traceback (most recent call last): File "E:\stable diffusion\stable-diffusion-webui\venv\lib\site-packages\gradio\routes.py", line 394, in run_predict output = await app.get_blocks().process_api( File "E:\stable diffusion\stable-diffusion-webui\venv\lib\site-packages\gradio\blocks.py", line 1075, in process_api result = await self.call_function( File "E:\stable diffusion\stable-diffusion-webui\venv\lib\site-packages\gradio\blocks.py", line 884, in call_function prediction = await anyio.to_thread.run_sync( File "E:\stable diffusion\stable-diffusion-webui\venv\lib\site-packages\anyio\to_thread.py", line 31, in run_sync return await get_asynclib().run_sync_in_worker_thread( File "E:\stable diffusion\stable-diffusion-webui\venv\lib\site-packages\anyio_backends_asyncio.py", line 937, in run_sync_in_worker_thread return await future File "E:\stable diffusion\stable-diffusion-webui\venv\lib\site-packages\anyio_backends_asyncio.py", line 867, in run result = context.run(func, *args) File "E:\stable diffusion\stable-diffusion-webui\extensions\sd-webui-segment-anything\scripts\sam.py", line 249, in dino_predict boxes_filt, install_success = dino_predict_internal(input_image, dino_model_name, text_prompt, box_threshold) File "E:\stable diffusion\stable-diffusion-webui\extensions\sd-webui-segment-anything\scripts\dino.py", line 136, in dino_predict_internal dino_model = load_dino_model(dino_model_name) File "E:\stable diffusion\stable-diffusion-webui\extensions\sd-webui-segment-anything\scripts\dino.py", line 83, in load_dino_model dino = build_model(args) File "E:\stable diffusion\stable-diffusion-webui\venv\lib\site-packages\groundingdino\models__init__.py", line 17, in build_model model = build_func(args) File "E:\stable diffusion\stable-diffusion-webui\venv\lib\site-packages\groundingdino\models\GroundingDINO\groundingdino.py", line 372, in build_groundingdino model = GroundingDINO( File "E:\stable diffusion\stable-diffusion-webui\venv\lib\site-packages\groundingdino\models\GroundingDINO\groundingdino.py", line 108, in init self.bert = get_tokenlizer.get_pretrained_language_model(text_encoder_type) File "E:\stable diffusion\stable-diffusion-webui\venv\lib\site-packages\groundingdino\util\get_tokenlizer.py", line 25, in get_pretrained_language_model return BertModel.from_pretrained(text_encoder_type) File "E:\stable diffusion\stable-diffusion-webui\venv\lib\site-packages\transformers\modeling_utils.py", line 2230, in from_pretrained state_dict = load_state_dict(resolved_archive_file) File "E:\stable diffusion\stable-diffusion-webui\venv\lib\site-packages\transformers\modeling_utils.py", line 397, in load_state_dict return safe_load_file(checkpoint_file) File "E:\stable diffusion\stable-diffusion-webui\venv\lib\site-packages\safetensors\torch.py", line 101, in load_file result[k] = f.get_tensor(k) RuntimeError: self.size(-1) must be divisible by 4 to view Byte as Float (different element sizes), but got 89423127

it not work when i use GroundingDINO by this error, so i fix it by download the model from huggingface in my local ,method here https://github.com/IDEA-Research/Grounded-Segment-Anything/issues/75#issuecomment-1508225437

But I don't know why it didn't automatically download the model. ? someone could help me?

rentainhe commented 1 year ago

Seems like the network from huggingface is not that stable at that time