QwenLM / Qwen

The official repo of Qwen (通义千问) chat & pretrained large language model proposed by Alibaba Cloud.
Apache License 2.0
13.59k stars 1.11k forks source link

When localhost is not accessible, a shareable link must be created. Please set share=True or check your proxy settings to allow access to localhost #1101

Closed leizhu1989 closed 6 months ago

leizhu1989 commented 7 months ago

是否已有关于该错误的issue或讨论? | Is there an existing issue / discussion for this?

该问题是否在FAQ中有解答? | Is there an existing answer for this in FAQ?

当前行为 | Current Behavior

运行qwen-14b模型报错: Running on local URL: http://127.0.0.1:8000 Traceback (most recent call last): File "/media/sdc/NLP/Qwen/web_demo.py", line 209, in main() File "/media/sdc/NLP/Qwen/web_demo.py", line 205, in main _launch_demo(args, model, tokenizer, config) File "/media/sdc/NLP/Qwen/web_demo.py", line 192, in _launch_demo demo.queue().launch( File "/home/anaconda3/envs/Qwen/lib/python3.9/site-packages/gradio/blocks.py", line 1971, in launch raise ValueError( ValueError: When localhost is not accessible, a shareable link must be created. Please set share=True or check your proxy settings to allow access to localhost.

gradio版本:3.41.2

期望行为 | Expected Behavior

No response

复现方法 | Steps To Reproduce

No response

运行环境 | Environment

- OS:ubuntu 16.04
- Python: 3.9
- Transformers:4.32.0
- PyTorch:2.0.1+cu118
- CUDA (`python -c 'import torch; print(torch.version.cuda)'`):cu118

备注 | Anything else?

No response

WangJianQ-cmd commented 7 months ago

是用0.0.0.0吗,不是127.0.0.1

WangJianQ-cmd commented 7 months ago

是用0.0.0.0吗,不是127.0.0.1

leizhu1989 commented 7 months ago

web_demo里面默认的就是这个吧 parser.add_argument("--server-name", type=str, default="127.0.0.1", help="Demo server name."),我啥都没改,是啥原因呢

jklj077 commented 7 months ago

The error message presents a clear problem and solution. The Python script cannot access the localhost, and your proxy settings are likely causing this issue. To begin troubleshooting, please try disabling any active proxies, VPNs, or other programs that may be interfering with network connections. If the proxy is indeed the culprit, set the appropriate environment variables according to your platform. For instance, in Linux, you can use the following command: export no_proxy="localhost, 127.0.0.1, ::1".

错误消息明确地给出了问题和解决方案。Python脚本无法访问本地主机,这可能是由于您的代理设置导致的。首先,请尝试禁用任何可能干扰网络连接的活动代理、VPN或其他程序。如果确实是代理问题,请根据您的平台设置相应的环境变量。例如,在Linux系统中,您可以使用以下命令:export no_proxy="localhost, 127.0.0.1, ::1"

unanan commented 6 months ago

假设你的g = gr.Blocks(xxx) 在launch的时候:

g.launch(
        share=True,  # 设置了话会公开到gradio.live上
        server_name="0.0.0.0",   # 必须设置
        server_port=args.port
    )

然后检查你当前环境中的代理,如果设置了先unset