当前位置: 首页 > article >正文

LLaMA-Factory-0.9.1执行python src/webui.py会报错且会自动退出

环境:

代理服务器:http://10.*.*.*:8118解决上互联网

错误:

webui.py的代码如下:

import os
import logging
from llamafactory.webui.interface import create_ui

# 设置日志级别为DEBUG以获取更多信息
logging.basicConfig(level=logging.DEBUG)


os.environ["GRADIO_ANALYTICS_ENABLED"] = "0"
def main():
    gradio_share =False
    server_name = "172.*.*.*"
    # 创建UI对象
    ui = create_ui()    
    try:
        # 尝试启动UI,不创建共享链接,也不自动打开浏览器窗口
        ui.queue().launch(
            share=False,#True, 
            server_name=server_name,
            inbrowser=False,
            prevent_thread_lock=False  # 让服务器占用主线程
        )
        logging.info("grado接口启动成功。")
    except ValueError as e:
        if "When localhost is not accessible" in str(e):
            logging.warning("忽略关于本地主机可访问性的错误,因为我们在本地网络中运行.{e}")
        else:
            logging.error(f"Unexpected ValueError: {e}")
            raise  # 如果是其他类型的ValueError,则重新抛出异常
    except Exception as e:
        logging.error(f"An unexpected error occurred: {e}")
        raise  # 重新抛出所有其他异常以便进一步调试

if __name__ == "__main__":
    main()

执行python src/webui.py会报如下错误:

DEBUG:asyncio:Using selector: EpollSelector

Running on local URL:  http://172.*.*.*:7861

DEBUG:httpcore.connection:connect_tcp.started host='10.*.*.*' port=8118 local_address=None timeout=None socket_options=None

DEBUG:httpcore.connection:connect_tcp.complete return_value=<httpcore._backends.sync.SyncStream object at 0x7f2d931ec7f0>

DEBUG:httpcore.http11:send_request_headers.started request=<Request [b'GET']>

DEBUG:httpcore.http11:send_request_headers.complete

DEBUG:httpcore.http11:send_request_body.started request=<Request [b'GET']>

DEBUG:httpcore.http11:send_request_body.complete

DEBUG:httpcore.http11:receive_response_headers.started request=<Request [b'GET']>

DEBUG:httpcore.http11:receive_response_headers.complete return_value=(b'HTTP/1.1', 200, b'OK', [(b'date', b'Tue, 17 Dec 2024 11:37:06 GMT'), (b'server', b'uvicorn'), (b'content-length', b'4'), (b'content-type', b'application/json'), (b'Proxy-Connection', b'keep-alive')])

INFO:httpx:HTTP Request: GET http://172.*.*.*:7861/startup-events "HTTP/1.1 200 OK"

DEBUG:httpcore.http11:receive_response_body.started request=<Request [b'GET']>

DEBUG:httpcore.http11:receive_response_body.complete

DEBUG:httpcore.http11:response_closed.started

DEBUG:httpcore.http11:response_closed.complete

DEBUG:httpcore.connection:close.started

DEBUG:httpcore.connection:close.complete

DEBUG:httpcore.connection:connect_tcp.started host='10.*.*.*' port=8118 local_address=None timeout=3 socket_options=None

DEBUG:httpcore.connection:connect_tcp.failed exception=ConnectTimeout(TimeoutError('timed out'))

WARNING:root:Ignoring error about localhost accessibility since we are running in a local network.

解决方案: 

临时关闭代理服务。

unset HTTP_PROXY

unset HTTPS_PROXY

unset http_proxy

unset https_proxy

再执行 python src/webui.py就没有问题。


http://www.kler.cn/a/442476.html

相关文章:

  • SpringMVC (1)
  • 类模板的使用方法
  • Deep4SNet: deep learning for fake speech classification
  • 基于光偏振与光学调制实现白光干涉相移
  • centos 8 中安装Docker
  • Qwins的使用
  • ElasticSearch07-分片读写原理
  • Dynamics 365 CRM- 后端
  • 微服务中token鉴权设计的4种方式总结
  • Unity中触发器Trigger无法被射线检测到的问题
  • FPGA-PS端编程1:
  • Ubuntu20.04解决docker安装后is the docker daemon running? 问题
  • go语言压缩[]byte数据为zlib格式的时候,耗时较多,应该怎么修改?
  • Java 网络初始 ①-OSI七层网络模型 || 网络通信 || 五元组 || 协议分层
  • 通过增强的 vSphere 集成增强你的 vSphere 监控
  • Postman接口测试:全局变量/接口关联/加密/解密
  • Redis性能调优:深入剖析变慢原因及应对策略
  • Next.js流量教程:如何在 Next.js 中使用 React Helmet 管理 SEO Meta 标签
  • Django基础之中间件
  • 【后端面试总结】进程间通信的方法
  • RPA自动化:如何让你的电商营销活动更精准、更高效?【52rpa.com】
  • linux指定特定用户执行命令
  • 深入探索Vue.js中的v-bind指令:属性绑定与动态渲染的核心机制
  • Mac升级macOS 15 Sequoia后,无法ssh连接本地虚拟机
  • spring boot框架优劣势分析
  • windows下安装及使用labelme