Open garychan22 opened 1 month ago
Hi @garychan22, thanks for opening this issue!
What is the value of detector_id
being used (it's ambiguous from the snippet)? Running with "IDEA-Research/grounding-dino-tiny"
on main
I'm unable to replicate this error.
@amyeroberts hi, the detector_id
is a local model path to the downloaded IDEA-Research/grounding-dino-tiny
Could you try with just passing "IDEA-Research/grounding-dino-tiny" directly i.e:
from transformers import AutoModelForMaskGeneration, AutoProcessor, pipeline
device = "cuda"
detector_id = "IDEA-Research/grounding-dino-tiny"
object_detector = pipeline(model=detector_id, task="zero-shot-object-detection", device=device)
emmm... i tried and i think the reason i have manually downloaded the pretrained weights is the inner server network issue
requests.exceptions.ConnectionError: (MaxRetryError("HTTPSConnectionPool(host='huggingface.co', port=443)
and i set the HF_HOME and TRANSFORMERS_CACHE to the parent dir of the local model path, rename the model dir to
models--IDEA-Research--grounding-dino-tiny
it seems that transformers cannot find the path.
and i set the HF_HOME and TRANSFORMERS_CACHE to the parent dir of the local model path, rename the model dir to
There's no need to do this, and I believe this might be the issue. The models stored in the cache have a specific folder structure which keeps track of which objects correspond to which commits on the repo s.t. if one updates the config on the hub, only the new config is downloaded.
Instead, if you've downloaded the folder directly you can just pass in that local folder
from transformers import AutoModelForMaskGeneration, AutoProcessor, pipeline
device = "cuda"
detector_id = "path/to/model/folder"
object_detector = pipeline(model=detector_id, task="zero-shot-object-detection", device=device)
I can reproduce the issue, but with device_map
provided instead of device
.
from transformers import pipeline
object_detector = pipeline(
model="IDEA-Research/grounding-dino-tiny", task="zero-shot-object-detection", device_map="cuda"
)
The issue appears because tied_params
are identified differently depending on whether device_map
is specified.
I created an issue in Accelerate regarding this to clarify the cause.
https://github.com/huggingface/accelerate/issues/2984
System Info
transformers 4.44.0.dev0 python 3.8.19 torch 2.3.1+cu118
Who can help?
@amyeroberts
Information
Tasks
examples
folder (such as GLUE/SQuAD, ...)Reproduction
hi, I am trying grounded_sam implemented with transformers following https://github.com/NielsRogge/Transformers-Tutorials/blob/master/Grounding%20DINO/GroundingDINO_with_Segment_Anything.ipynb
however, when I am loading the model
some error are encountered
Expected behavior
expect everything works well