Linux使用lama

安装

1
2
3
yum install -y python3 python3-devel python3-pip gcc-c++ gcc  unzip
mkdir ~/.pip
vim ~/.pip/pip.conf

写入

1
2
3
4
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
[install]
trusted-host=mirrors.aliyun.com

安装 conda

1
2
3
4
# Install conda for Linux, for other OS download miniconda at https://docs.conda.io/en/latest/miniconda.html
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
bash Miniconda3-latest-Linux-x86_64.sh -b -p $HOME/miniconda
$HOME/miniconda/bin/conda init bash

添加环境变量 vim ~/.bashrc 写入 export PATH=$PATH:$HOME/miniconda/bin/
配置国内源 vim ~/.condarc

项目中安装

1
2
3
4
5
6
conda env create -f conda_env.yml
conda activate lama
conda install pytorch torchvision torchaudio cudatoolkit=10.2 -c pytorch -y
pip install pytorch-lightning==1.2.9
# 最后退出
conda deactivate

问题:ModuleNotFoundError: No module named ‘skbuild’
pip3 install scikit-build -i https://mirrors.aliyun.com/pypi/simple/

配置环境

1
2
cd lama
export TORCH_HOME=$(pwd) && export PYTHONPATH=$(pwd)

安装 pre-trained models

当前方式已经无法下载 https://github.com/advimman/lama

本文地址: https://github.com/maxzhao-it/blog/post/2c1bc972/