Grounded-Segment-Anything icon indicating copy to clipboard operation
Grounded-Segment-Anything copied to clipboard

About Network Connect

Open aiyb1314 opened this issue 1 year ago • 14 comments

requests.exceptions.ConnectionError: (ProtocolError('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer')), '(Request ID: ea7dea4f-6b82-401c-84a6-3d970e2416ba)')

aiyb1314 avatar Jul 25 '23 11:07 aiyb1314

requests.exceptions.ConnectionError: (ProtocolError('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer')), '(Request ID: ea7dea4f-6b82-401c-84a6-3d970e2416ba)')

It may be that your network is not stable when connecting to Huggingface, you can also try to download the pre-trained BERT-based model from Huggingface to your local directory and set a specific path to it.

rentainhe avatar Jul 25 '23 13:07 rentainhe

requests.exceptions.ConnectionError: (ProtocolError('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer')), '(Request ID: ea7dea4f-6b82-401c-84a6-3d970e2416ba)')

It may be that your network is not stable when connecting to Huggingface, you can also try to download the pre-trained BERT-based model from Huggingface to your local directory and set a specific path to it.

Can you be more specific about the method of downloading the file, I had this problem too, it used to work, now it doesn't work.

MrTHMX avatar Jul 28 '23 06:07 MrTHMX

requests.exceptions.ConnectionError: (ProtocolError('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer')), '(Request ID: ea7dea4f-6b82-401c-84a6-3d970e2416ba)')

It may be that your network is not stable when connecting to Huggingface, you can also try to download the pre-trained BERT-based model from Huggingface to your local directory and set a specific path to it.

Can you be more specific about the method of downloading the file, I had this problem too, it used to work, now it doesn't work.

You can try the following steps:

  • First, download the pre-trained bert-base-uncased checkpoint from Huggingface's official link: https://huggingface.co/bert-base-uncased/tree/main
  • Put it in your local directory, remember to download all the files from Huggingface
  • Update the tokenizer instance here: https://github.com/IDEA-Research/GroundingDINO/blob/60d796825e1266e56f7e4e9e00e88de662b67bd3/groundingdino/util/get_tokenlizer.py#L23
BertTokenizer.from_pretrained(PATH, local_files_only=True)  # PATH is your local file path

If there're some error when loading local checkpoint, you can try to check the hugging face's documentation for more details about the usage.

rentainhe avatar Aug 02 '23 01:08 rentainhe

ef get_pretrained_language_model(text_encoder_type):
    if text_encoder_type == "bert-base-uncased":
        return BertTokenizer.from_pretrained('bert-base-uncased', local_files_only=True)  # PATH is your local file path
        # return BertModel.from_pretrained(text_encoder_type)

is that right?

MrTHMX avatar Aug 22 '23 06:08 MrTHMX

ef get_pretrained_language_model(text_encoder_type):
    if text_encoder_type == "bert-base-uncased":
        return BertTokenizer.from_pretrained('bert-base-uncased', local_files_only=True)  # PATH is your local file path
        # return BertModel.from_pretrained(text_encoder_type)

is that right?

I think it may work

You can refer to huggingface's documentation for more details

rentainhe avatar Aug 22 '23 08:08 rentainhe

File "/home/evsjtu2/disk1/gumingxiang/GSAM/Grounded-Segment-Anything/grounded_sam_demo.py", line 181, in model = load_model(config_file, grounded_checkpoint, device=device) File "/home/evsjtu2/disk1/gumingxiang/GSAM/Grounded-Segment-Anything/grounded_sam_demo.py", line 46, in load_model model = build_model(args) File "/home/evsjtu2/disk1/gumingxiang/GSAM/Grounded-Segment-Anything/GroundingDINO/groundingdino/models/init.py", line 17, in build_model model = build_func(args) File "/home/evsjtu2/disk1/gumingxiang/GSAM/Grounded-Segment-Anything/GroundingDINO/groundingdino/models/GroundingDINO/groundingdino.py", line 372, in build_groundingdino model = GroundingDINO( File "/home/evsjtu2/disk1/gumingxiang/GSAM/Grounded-Segment-Anything/GroundingDINO/groundingdino/models/GroundingDINO/groundingdino.py", line 109, in init self.bert.pooler.dense.weight.requires_grad_(False) AttributeError: 'BertTokenizer' object has no attribute 'pooler'

It returns the question, can you help me to solve?Or the problem is hugging face?

MrTHMX avatar Aug 22 '23 08:08 MrTHMX

File "/home/evsjtu2/disk1/gumingxiang/GSAM/Grounded-Segment-Anything/grounded_sam_demo.py", line 181, in model = load_model(config_file, grounded_checkpoint, device=device) File "/home/evsjtu2/disk1/gumingxiang/GSAM/Grounded-Segment-Anything/grounded_sam_demo.py", line 46, in load_model model = build_model(args) File "/home/evsjtu2/disk1/gumingxiang/GSAM/Grounded-Segment-Anything/GroundingDINO/groundingdino/models/init.py", line 17, in build_model model = build_func(args) File "/home/evsjtu2/disk1/gumingxiang/GSAM/Grounded-Segment-Anything/GroundingDINO/groundingdino/models/GroundingDINO/groundingdino.py", line 372, in build_groundingdino model = GroundingDINO( File "/home/evsjtu2/disk1/gumingxiang/GSAM/Grounded-Segment-Anything/GroundingDINO/groundingdino/models/GroundingDINO/groundingdino.py", line 109, in init self.bert.pooler.dense.weight.requires_grad_(False) AttributeError: 'BertTokenizer' object has no attribute 'pooler'

It returns the question, can you help me to solve?Or the problem is hugging face?

There're something wrong with this, you use BertTokenizer instead of BertModel, they're different

rentainhe avatar Aug 22 '23 08:08 rentainhe

ef get_pretrained_language_model(text_encoder_type):
    if text_encoder_type == "bert-base-uncased":
        return BertTokenizer.from_pretrained('bert-base-uncased', local_files_only=True)  # PATH is your local file path
        # return BertModel.from_pretrained(text_encoder_type)

is that right?

I think it may work

You can refer to huggingface's documentation for more details

Please use BertModel instead of BertTokenizer, one is the tokenizer for converting words into embeddings, the other is original BERT model

rentainhe avatar Aug 22 '23 08:08 rentainhe

/home/evsjtu2/miniconda3/envs/gmx-sam/lib/python3.9/site-packages/torch/functional.py:478: UserWarning: torch.meshgrid: in an upcoming release, it will be required to pass the indexing argument. (Triggered internally at /opt/conda/conda-bld/pytorch_1659484809662/work/aten/src/ATen/native/TensorShape.cpp:2894.) return _VF.meshgrid(tensors, **kwargs) # type: ignore[attr-defined] final text_encoder_type: bert-base-uncased Traceback (most recent call last): File "/home/evsjtu2/disk1/gumingxiang/GSAM/Grounded-Segment-Anything/grounded_sam_demo.py", line 181, in model = load_model(config_file, grounded_checkpoint, device=device) File "/home/evsjtu2/disk1/gumingxiang/GSAM/Grounded-Segment-Anything/grounded_sam_demo.py", line 46, in load_model model = build_model(args) File "/home/evsjtu2/disk1/gumingxiang/GSAM/Grounded-Segment-Anything/GroundingDINO/groundingdino/models/init.py", line 17, in build_model model = build_func(args) File "/home/evsjtu2/disk1/gumingxiang/GSAM/Grounded-Segment-Anything/GroundingDINO/groundingdino/models/GroundingDINO/groundingdino.py", line 372, in build_groundingdino model = GroundingDINO( File "/home/evsjtu2/disk1/gumingxiang/GSAM/Grounded-Segment-Anything/GroundingDINO/groundingdino/models/GroundingDINO/groundingdino.py", line 107, in init self.tokenizer = get_tokenlizer.get_tokenlizer(text_encoder_type) File "/home/evsjtu2/disk1/gumingxiang/GSAM/Grounded-Segment-Anything/GroundingDINO/groundingdino/util/get_tokenlizer.py", line 17, in get_tokenlizer tokenizer = AutoTokenizer.from_pretrained(text_encoder_type) File "/home/evsjtu2/miniconda3/envs/gmx-sam/lib/python3.9/site-packages/transformers/models/auto/tokenization_auto.py", line 550, in from_pretrained return tokenizer_class_fast.from_pretrained(pretrained_model_name_or_path, *inputs, **kwargs) File "/home/evsjtu2/miniconda3/envs/gmx-sam/lib/python3.9/site-packages/transformers/tokenization_utils_base.py", line 1695, in from_pretrained resolved_vocab_files[file_id] = cached_path( File "/home/evsjtu2/miniconda3/envs/gmx-sam/lib/python3.9/site-packages/transformers/file_utils.py", line 1776, in cached_path output_path = get_from_cache( File "/home/evsjtu2/miniconda3/envs/gmx-sam/lib/python3.9/site-packages/transformers/file_utils.py", line 2000, in get_from_cache raise ValueError( ValueError: Connection error, and we cannot find the requested files in the cached path. Please try again or make sure your Internet connection is on.

After I made the changes, I still prompted for network connectivity issues. Should there be no other areas in the model that require network connectivity besides the hooking face?

MrTHMX avatar Aug 23 '23 06:08 MrTHMX

I have already solved this problem. Thank you for your help!

MrTHMX avatar Aug 24 '23 05:08 MrTHMX

I have already solved this problem. Thank you for your help!

hello, same question we meet, could you share your step-by-step solution for us to solve this problem? thank you very much for your kindest action.

flandrewries avatar Sep 01 '23 09:09 flandrewries

I have already solved this problem. Thank you for your help!

hello, same question we meet, could you share your step-by-step solution for us to solve this problem? thank you very much for your kindest action.

  1. First, download the pre-trained bert-base-uncased checkpoint from Huggingface's official link: https://huggingface.co/bert-base-uncased/tree/main
  2. Put it in your local directory, remember to download all the files from Huggingface
  3. Update the tokenizer instance in /Grounded-Segment-Anything/GroundingDINO/groundingdino/util/get_tokenlizer.py
    # tokenizer = AutoTokenizer.from_pretrained(text_encoder_type)
    tokenizer = AutoTokenizer.from_pretrained('YOUR PATH/bert-base-uncased', cache_dir='bert-base-uncased')
    # return BertModel.from_pretrained(text_encoder_type)
    return BertModel.from_pretrained('YOUR PATH/bert-base-uncased', local_files_only=True) 

MrTHMX avatar Sep 06 '23 06:09 MrTHMX

I have already solved this problem. Thank you for your help!

hello, same question we meet, could you share your step-by-step solution for us to solve this problem? thank you very much for your kindest action.

  1. First, download the pre-trained bert-base-uncased checkpoint from Huggingface's official link: https://huggingface.co/bert-base-uncased/tree/main
  2. Put it in your local directory, remember to download all the files from Huggingface
  3. Update the tokenizer instance in /Grounded-Segment-Anything/GroundingDINO/groundingdino/util/get_tokenlizer.py
    # tokenizer = AutoTokenizer.from_pretrained(text_encoder_type)
    tokenizer = AutoTokenizer.from_pretrained('YOUR PATH/bert-base-uncased', cache_dir='bert-base-uncased')
    # return BertModel.from_pretrained(text_encoder_type)
    return BertModel.from_pretrained('YOUR PATH/bert-base-uncased', local_files_only=True) 

miss other error: final text_encoder_type: bert-base-uncased safetensors_rust.SafetensorError: Error while deserializing header: HeaderTooLarge

stihuangyuan avatar Sep 16 '23 10:09 stihuangyuan

LOL. I encountered this problem today because huggingface is under maintenance : )

SynUW avatar Feb 10 '24 18:02 SynUW