一、背景
之所以想装这个库,就是想在本地体验一下去除图片水印的功能。
这个库目前也是支持 CPU & GPU & Apple Silicon,在它的README有提到。但是在README中并没有直接提到Macos的直接安装方式,更多的是Windows以及在有英伟达GPU的情况下如何安装。
Macos并没有cudn这个库
然后我是在Issue里面找到的,说是可以通过安装 lama-cleaner 这个库,以及使用 cpu 的方式运行。
可以看这里:github.com/Sanster/IOP…
二、实战
1、创建项目
$ mkdir iopaint
$ cd iopaint
# 创建虚拟环境
$ python3 -m venv venv
$ source venv/bin/activate
2、安装依赖
$ pip install lama-cleaner
3、第一个问题
NotOpenSSLWarning: urllib3 v2 only supports OpenSSL 1.1.1+, currently the 'ssl' module is compiled with 'LibreSSL 2.8.3'.
这个问题比较常见,我偷懒了,直接降版本
pip install urllib3==1.26.6
参考:
stackoverflow.com/questions/7…
4、第二个问题
ImportError: cannot import name 'cached_download' from 'huggingface_hub’
搜了下,也是版本不匹配的问题,pip默认装的是新版本,而新版本这些方法移除了,所以找不到。
pip install huggingface-hub==0.25.2
参考:
stackoverflow.com/questions/7…
5、安装成功
6、效果
感觉还是挺Nice的