Depth anything v2环境相关问题

环境配置:numpy版本

2.x的版本不兼容。

因为我的torch版本较高,所以numpy改成一个较高的版本:1.26.4。可用

warning:xFormers not available

xFormers:

一个用于推理加速的库,尤其是当输入尺寸增大时,能有效减小显存占用和推理时间。如下表(Depth anything v1上的报告)

安装的话,如果pytorch版本足够新,可以直接简单式安装

如果torch版本低,需要找到对应的低版本xformers

xformers版本与其依赖pytorch版本的对应关系-CSDN博客

以笔者为例,我的torch=1.13.1+cu116(已安装)。只能用0.0.16的xFormers

pip install xformers==0.0.16 

注:实际上xformers低版本还是无法适配depth anything v2,因为需要

from xformers.ops import scaled_index_add

但是低版本的xformers没有

gradio和gradio_imageslider版本问题

虽然官方库给了gradio的推荐版本,但是gradio_imageslider没给版本,直接用pip install的话可能导致下载的版本太高,与python不兼容,执行python app.py的时候报错:

TypeError: You have a type annotation 'Union[Tuple[FileData | None, FileData | None], None]' which makes use of newer typing features than are supported in your version of Python. To handle this error, you should either remove the use of new syntax or install the `eval_type_backport` package.

我这边用python3.9与 gradio_imageslider==0.0.20不兼容,我不想升级python版本

因此降低gradio_imageslider版本:pip install gradio_imageslider==0.0.17

注意在服务器内网中使用的时候需要修改app.py的main函数中launch(),添加参数share=True,否则外网访问不了gradio_client的链接

  • 3
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值