Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gradio run error #5

Closed
VisionZQ opened this issue Apr 23, 2024 · 4 comments
Closed

gradio run error #5

VisionZQ opened this issue Apr 23, 2024 · 4 comments

Comments

@VisionZQ
Copy link

Hi,
1、请问运行gradio脚本中CKPT_PATH=该如何指定,我huggingface中下载模型,并指定路径,设置TRANSFORMERS_OFFLINE=1,运行报错依然需要online下载模型?
2、
image
我手动指定了路径后,模型load会被block住?

@xk-huang
Copy link
Owner

xk-huang commented Apr 23, 2024

Hi!

  1. 可以参考这个 issue How could I try your gradio app? #2

  2. 使用预训练权重的话不用指定模型路径。而 block 的原因可能是无法连接到 huggingface https://zhuanlan.zhihu.com/p/647843635

@xk-huang xk-huang changed the title gradio run erroe gradio run error Apr 24, 2024
@VisionZQ
Copy link
Author

Hi!

  1. 可以参考这个 issue how could I try your gradio app? #2
  2. 使用预训练权重的话不用指定模型路径。而 block 的原因可能是无法连接到 huggingface https://zhuanlan.zhihu.com/p/647843635

非常感谢您的回复,我按照你的指导进行了实验,但依然出现一些问题,我离线下载了pretrain模型,并按照说明配置:
企业微信截图_17140111938308

但运行依然会在线下载模型,请问还需要下载其他模型吗?vit? 感谢回复! 报错如下:
`eval_data: []
eval_data_overrides: []
model:
model_max_length: 20
cache_dir: .model.cache
model_name_or_path: ./models/segment-caption-anything-gpt2_large-pt
sam_model_name_or_path: facebook/sam-vit-huge
lm_head_model_name_or_path: gpt2-large
additional_num_hidden_layers: 2
num_caption_tokens: 1
num_task_tokens: 6
num_caption_heads: 1
data_transforms: null
data_collator:
use_instruction: false
instruction_mapping_json: null

[2024-04-25 10:23:55,352][src.arguments][INFO] - Running on ctmt231220145413fj2-5979b84dbb-v85nv
[2024-04-25 10:23:56,178][src.arguments][WARNING] - Process rank: 0, device: cpu, log_level: 20 n_gpu: 8 distributed training: True, 16-bits training: False, bf16 training: False
[2024-04-25 10:23:56,181][main][INFO] - Try to load sas_key from .env file: False.
/opt/conda/envs/sca-v2/lib/python3.8/site-packages/transformers/processing_utils.py:215: FutureWarning: The use_auth_token argument is deprecated and will be removed in v5 of Transformers. Please use token instead.
warnings.warn(
pretrained_model_name_or_path = facebook/sam-vit-huge
path_or_repo_id = facebook/sam-vit-huge
Error executing job with overrides: ['+model=base_sca_multitask_v2', 'model.model_name_or_path=./models/segment-caption-anything-gpt2_large-pt', 'model.lm_head_model_name_or_path=gpt2-large']
Traceback (most recent call last):
File "/opt/conda/envs/sca-v2/lib/python3.8/site-packages/urllib3/connection.py", line 174, in _new_conn
conn = connection.create_connection(
File "/opt/conda/envs/sca-v2/lib/python3.8/site-packages/urllib3/util/connection.py", line 95, in create_connection
raise err
File "/opt/conda/envs/sca-v2/lib/python3.8/site-packages/urllib3/util/connection.py", line 85, in create_connection
sock.connect(sa)
socket.timeout: timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/opt/conda/envs/sca-v2/lib/python3.8/site-packages/urllib3/connectionpool.py", line 715, in urlopen
httplib_response = self._make_request(
File "/opt/conda/envs/sca-v2/lib/python3.8/site-packages/urllib3/connectionpool.py", line 404, in _make_request
self._validate_conn(conn)
File "/opt/conda/envs/sca-v2/lib/python3.8/site-packages/urllib3/connectionpool.py", line 1058, in _validate_conn
conn.connect()
File "/opt/conda/envs/sca-v2/lib/python3.8/site-packages/urllib3/connection.py", line 363, in connect
self.sock = conn = self._new_conn()
File "/opt/conda/envs/sca-v2/lib/python3.8/site-packages/urllib3/connection.py", line 179, in _new_conn
raise ConnectTimeoutError(
urllib3.exceptions.ConnectTimeoutError: (<urllib3.connection.HTTPSConnection object at 0x7f1c80a3ed90>, 'Connection to huggingface.co timed out. (connect timeout=10)')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/opt/conda/envs/sca-v2/lib/python3.8/site-packages/requests/adapters.py", line 489, in send
resp = conn.urlopen(
File "/opt/conda/envs/sca-v2/lib/python3.8/site-packages/urllib3/connectionpool.py", line 799, in urlopen
retries = retries.increment(
File "/opt/conda/envs/sca-v2/lib/python3.8/site-packages/urllib3/util/retry.py", line 592, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='huggingface.co', port=443): Max retries exceeded with url: /facebook/sam-vit-huge/resolve/main/preprocessor_config.json (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x7f1c80a3ed90>, 'Connection to huggingface.co timed out. (connect timeout=10)'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/opt/conda/envs/sca-v2/lib/python3.8/site-packages/huggingface_hub/file_download.py", line 1238, in hf_hub_download
metadata = get_hf_file_metadata(
File "/opt/conda/envs/sca-v2/lib/python3.8/site-packages/huggingface_hub/utils/_validators.py", line 118, in _inner_fn
return fn(*args, **kwargs)
File "/opt/conda/envs/sca-v2/lib/python3.8/site-packages/huggingface_hub/file_download.py", line 1631, in get_hf_file_metadata
r = _request_wrapper(
File "/opt/conda/envs/sca-v2/lib/python3.8/site-packages/huggingface_hub/file_download.py", line 385, in _request_wrapper
response = _request_wrapper(
File "/opt/conda/envs/sca-v2/lib/python3.8/site-packages/huggingface_hub/file_download.py", line 408, in _request_wrapper
response = get_session().request(method=method, url=url, **params)
File "/opt/conda/envs/sca-v2/lib/python3.8/site-packages/requests/sessions.py", line 587, in request
resp = self.send(prep, **send_kwargs)
File "/opt/conda/envs/sca-v2/lib/python3.8/site-packages/requests/sessions.py", line 701, in send
r = adapter.send(request, **kwargs)
File "/opt/conda/envs/sca-v2/lib/python3.8/site-packages/huggingface_hub/utils/_http.py", line 67, in send
return super().send(request, *args, **kwargs)
File "/opt/conda/envs/sca-v2/lib/python3.8/site-packages/requests/adapters.py", line 553, in send
raise ConnectTimeout(e, request=request)
requests.exceptions.ConnectTimeout: (MaxRetryError("HTTPSConnectionPool(host='huggingface.co', port=443): Max retries exceeded with url: /facebook/sam-vit-huge/resolve/main/preprocessor_config.json (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x7f1c80a3ed90>, 'Connection to huggingface.co timed out. (connect timeout=10)'))"), '(Request ID: 15027d7a-e2da-467e-a939-ae5ee524d022)')

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

@xk-huang
Copy link
Owner

xk-huang commented Apr 25, 2024

我这边使用 docker 环境无法复现你的报错,可以尝试用 docker 配置环境。

另外从上面的报错日志看,应该是下载 sam vit huge 超时导致问题:

Max retries exceeded with url: /facebook/sam-vit-huge/resolve/main/preprocessor_config.json 

如果 docker 也不行,则可以手动下载模型:
把 config 中的:

sam_model_name_or_path: facebook/sam-vit-huge
lm_head_model_name_or_path: gpt2-large

替换为:

sam_model_name_or_path: ./models/facebook/sam-vit-huge
lm_head_model_name_or_path: ./models/gpt2-large

@VisionZQ
Copy link
Author

我这边使用 docker 环境无法复现你的报错,可以尝试用 docker 配置环境。

另外从上面的报错日志看,应该是下载 sam vit huge 超时导致问题:

Max retries exceeded with url: /facebook/sam-vit-huge/resolve/main/preprocessor_config.json 

如果 docker 也不行,则可以手动下载模型: 把 config 中的:

sam_model_name_or_path: facebook/sam-vit-huge
lm_head_model_name_or_path: gpt2-large

替换为:

sam_model_name_or_path: ./models/facebook/sam-vit-huge
lm_head_model_name_or_path: ./models/gpt2-large

非常感谢你耐心的指导。。最后发现从hugging face下载示例图片block了。现在可以运行了,Nice。。

@xk-huang xk-huang closed this as completed May 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants