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
14.85k stars 1.37k forks source link

openai.error.APIConnectionError: Error communicating with OpenAI: HTTPSConnectionPool(host='api.openai.com', port=443) #65

Open kfchandsome opened 1 year ago

kfchandsome commented 1 year ago

run this code: python automatic_label_demo.py \ --config GroundingDINO/groundingdino/config/GroundingDINO_SwinT_OGC.py \ --grounded_checkpoint groundingdino_swint_ogc.pth \ --sam_checkpoint sam_vit_h_4b8939.pth \ --input_image assets/demo3.jpg \ --output_dir "outputs" \ --openai_key your_openai_key \ --box_threshold 0.25 \ --text_threshold 0.2 \ --iou_threshold 0.5 \ --device "cuda"

issues: warnings.warn( Traceback (most recent call last): File "C:\Users\kfchandsome.conda\envs\grounded-segment\lib\site-packages\urllib3\connection.py", line 159, in _new_conn conn = connection.create_connection( File "C:\Users\kfchandsome.conda\envs\grounded-segment\lib\site-packages\urllib3\util\connection.py", line 84, in create_connection raise err File "C:\Users\kfchandsome.conda\envs\grounded-segment\lib\site-packages\urllib3\util\connection.py", line 74, in create_connection sock.connect(sa) TimeoutError: [WinError 10060] 由于连接方在一段时间后没有正确答复或连接的主机没有反应,连接尝试失败。

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\Users\kfchandsome.conda\envs\grounded-segment\lib\site-packages\urllib3\connectionpool.py", line 670, in urlopen httplib_response = self._make_request( File "C:\Users\kfchandsome.conda\envs\grounded-segment\lib\site-packages\urllib3\connectionpool.py", line 381, in _make_request self._validate_conn(conn) File "C:\Users\kfchandsome.conda\envs\grounded-segment\lib\site-packages\urllib3\connectionpool.py", line 978, in _validate_conn conn.connect() File "C:\Users\kfchandsome.conda\envs\grounded-segment\lib\site-packages\urllib3\connection.py", line 309, in connect conn = self._new_conn() File "C:\Users\kfchandsome.conda\envs\grounded-segment\lib\site-packages\urllib3\connection.py", line 171, in _new_conn raise NewConnectionError( urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPSConnection object at 0x000002A1952D2B80>: Failed to establish a new connection: [WinError 10060] 由于连接方在一段时间后没有正确答复或连接的主机没有反应,连接尝试失败。

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\Users\kfchandsome.conda\envs\grounded-segment\lib\site-packages\requests\adapters.py", line 489, in send resp = conn.urlopen( File "C:\Users\kfchandsome.conda\envs\grounded-segment\lib\site-packages\urllib3\connectionpool.py", line 754, in urlopen return self.urlopen( File "C:\Users\kfchandsome.conda\envs\grounded-segment\lib\site-packages\urllib3\connectionpool.py", line 754, in urlopen return self.urlopen( File "C:\Users\kfchandsome.conda\envs\grounded-segment\lib\site-packages\urllib3\connectionpool.py", line 726, in urlopen retries = retries.increment( File "C:\Users\kfchandsome.conda\envs\grounded-segment\lib\site-packages\urllib3\util\retry.py", line 446, in increment raise MaxRetryError(_pool, url, error or ResponseError(cause)) urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='api.openai.com', port=443): Max retries exceeded with url: /v1/chat/completions (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x000002A1952D2B80>: Failed to establish a new connection: [WinError 10060] 由于连接方在一段时间后没有正确答复或连接的主机没有反应,连接尝试失败。'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\Users\kfchandsome.conda\envs\grounded-segment\lib\site-packages\openai\api_requestor.py", line 516, in request_raw result = _thread_context.session.request( File "C:\Users\kfchandsome.conda\envs\grounded-segment\lib\site-packages\requests\sessions.py", line 587, in request resp = self.send(prep, send_kwargs) File "C:\Users\kfchandsome.conda\envs\grounded-segment\lib\site-packages\requests\sessions.py", line 701, in send r = adapter.send(request, kwargs) File "C:\Users\kfchandsome.conda\envs\grounded-segment\lib\site-packages\requests\adapters.py", line 565, in send raise ConnectionError(e, request=request) requests.exceptions.ConnectionError: HTTPSConnectionPool(host='api.openai.com', port=443): Max retries exceeded with url: /v1/chat/completions (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x000002A1952D2B80>: Failed to establish a new connection: [WinError 10060] 由于连接方在一段时间后没有正确答复或连接的主机没有反应,连接尝试失败。'))

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

Traceback (most recent call last): File "automatic_label_demo.py", line 247, in text_prompt = generate_tags(caption) File "automatic_label_demo.py", line 63, in generate_tags response = openai.ChatCompletion.create(model=model, messages=prompt, temperature=0.6, max_tokens=max_tokens) File "C:\Users\kfchandsome.conda\envs\grounded-segment\lib\site-packages\openai\api_resources\chat_completion.py", line 25, in create return super().create(*args, **kwargs) File "C:\Users\kfchandsome.conda\envs\grounded-segment\lib\site-packages\openai\api_resources\abstract\engine_apiresource.py", line 153, in create response, , api_key = requestor.request( File "C:\Users\kfchandsome.conda\envs\grounded-segment\lib\site-packages\openai\api_requestor.py", line 216, in request result = self.request_raw( File "C:\Users\kfchandsome.conda\envs\grounded-segment\lib\site-packages\openai\api_requestor.py", line 529, in request_raw raise error.APIConnectionError( openai.error.APIConnectionError: Error communicating with OpenAI: HTTPSConnectionPool(host='api.openai.com', port=443): Max retries exceeded with url: /v1/chat/completions (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x000002A1952D2B80>: Failed to establish a new connection: [WinError 10060] 由于连接方在一段时间后没有正确答复或连接的主机没有反应,连接尝试失败。'))

已经将urlib3改为低版本,还是报这个错误,国内有人跑通了吗?

xujin1184104394 commented 1 year ago

遇到了相同的问题。并且没有chatgpt的账号,似乎是跑步起来。作者能不能不使用charGPT呢? 是否可以用开源的模型?

davidbeckham921 commented 1 year ago

same issue,Please let me know when the problem is solved