一、说明
cup型号: Intel(R) Celeron(R) CPU G1610 @ 2.60GHz
内存大小: 7.5Gi 356Mi 4.6Gi 1.0Mi 2.6Gi 6.8Gi
Swap: 4.0Gi 0B 4.0Gi显卡型号:NVIDIA P104-100
注意:系统睡眠问题
sudo systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target
二、安装nvidia驱动
017、Python+fastapi,第一个Python项目走向第17步:ubuntu24.04 无界面服务器版下安装nvidia显卡驱动_udevadm hwdb is deprecated. use systemd-hwdb inste-CSDN博客https://blog.csdn.net/jiangkp/article/details/138355860
三、安装Miniconda3
bash Miniconda3-latest-Linux-x86_64.sh
source ~/.bashrc
conda -V
三、安装虚拟环境
1、配置清华源
(base) mucunasd@mucunasd:~$ conda config --remove-key channels
(base) mucunasd@mucunasd:~$ conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
/home/mucunasd/miniconda3/lib/python3.12/site-packages/conda/base/context.py:198: FutureWarning: Adding 'defaults' to channel list implicitly is deprecated and will be removed in 25.3.To remove this warning, please choose a default channel explicitly with conda's regular configuration system, e.g. by adding 'defaults' to the list of channels:
conda config --add channels defaults
For more information see https://docs.conda.io/projects/conda/en/stable/user-guide/configuration/use-condarc.html
deprecated.topic(
(base) mucunasd@mucunasd:~$ conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
(base) mucunasd@mucunasd:~$ conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
(base) mucunasd@mucunasd:~$ conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/pro
(base) mucunasd@mucunasd:~$ conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2
(base) mucunasd@mucunasd:~$ conda config --set show_channel_urls yes
(base) mucunasd@mucunasd:~$ conda config --show channels
channels:
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/pro
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
2、虚拟环境创建
conda create -n sd python=3.10.6
conda info --envs
conda activate sd
python -m pip install --upgrade pip
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
四、通过仓库直接安装cuda
conda search cudatoolkit
(sdweibu) mucunasd@mucunasd:~$ conda search cudatoolkit
Loading channels: done
# Name Version Build Channel
。。。。。。。。。。。。。
cudatoolkit 11.3.1 ha36c431_10 anaconda/cloud/conda-forge
cudatoolkit 11.3.1 ha36c431_9 anaconda/cloud/conda-forge
cudatoolkit 11.3.1 hb98b00a_12 anaconda/cloud/conda-forge
cudatoolkit 11.3.1 hb98b00a_13 anaconda/cloud/conda-forge
cudatoolkit 11.4.2 h00f7ccd_10 anaconda/cloud/conda-forge
cudatoolkit 11.4.2 h00f7ccd_9 anaconda/cloud/conda-forge
cudatoolkit 11.4.2 h7a5bcfd_10 anaconda/cloud/conda-forge
cudatoolkit 11.4.2 h7a5bcfd_11 anaconda/cloud/conda-forge
cudatoolkit 11.4.3 h39f8164_12 anaconda/cloud/conda-forge
cudatoolkit 11.4.3 h39f8164_13 anaconda/cloud/conda-forge
cudatoolkit 11.5.0 h36ae40a_9 anaconda/cloud/conda-forge
cudatoolkit 11.5.1 h59c8dcf_10 anaconda/cloud/conda-forge
cudatoolkit 11.5.1 h59c8dcf_11 anaconda/cloud/conda-forge
cudatoolkit 11.5.1 hcf5317a_10 anaconda/cloud/conda-forge
cudatoolkit 11.5.1 hcf5317a_9 anaconda/cloud/conda-forge
cudatoolkit 11.5.2 hbdc67f6_12 anaconda/cloud/conda-forge
cudatoolkit 11.5.2 hbdc67f6_13 anaconda/cloud/conda-forge
cudatoolkit 11.6.0 habf752d_10 anaconda/cloud/conda-forge
cudatoolkit 11.6.0 habf752d_9 anaconda/cloud/conda-forge
cudatoolkit 11.6.0 hecad31d_10 anaconda/cloud/conda-forge
cudatoolkit 11.6.0 hecad31d_11 anaconda/cloud/conda-forge
cudatoolkit 11.6.1 h775ab47_12 anaconda/cloud/conda-forge
cudatoolkit 11.6.1 h775ab47_13 anaconda/cloud/conda-forge
cudatoolkit 11.6.2 hfc3e2af_12 anaconda/cloud/conda-forge
cudatoolkit 11.6.2 hfc3e2af_13 anaconda/cloud/conda-forge
cudatoolkit 11.7.0 hd8887f6_10 anaconda/cloud/conda-forge
cudatoolkit 11.7.0 hd8887f6_11 anaconda/cloud/conda-forge
cudatoolkit 11.7.1 h4bc3d14_12 anaconda/cloud/conda-forge
cudatoolkit 11.7.1 h4bc3d14_13 anaconda/cloud/conda-forge
cudatoolkit 11.8.0 h37601d7_10 anaconda/cloud/conda-forge
cudatoolkit 11.8.0 h37601d7_11 anaconda/cloud/conda-forge
cudatoolkit 11.8.0 h4ba93d1_12 anaconda/cloud/conda-forge
cudatoolkit 11.8.0 h4ba93d1_13 anaconda/cloud/conda-forge
cudatoolkit 11.8.0 h6a678d5_0 anaconda/pkgs/main
cudatoolkit 11.8.0 h6a678d5_0 anaconda/pkgs/main
cudatoolkit 11.8.0 h6a678d5_0 pkgs/main
conda install cudatoolkit==11.8.0
五、安装cudnn
conda search cudnn
conda install cudnn==8.9.2.26
六、安装pytorch
不装,sd运行是会安装
七、安装 Stable Diffusionn
下载stable-diffusion-webui
git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui
下载模型
cd stable-diffusion-webui/models/Stable-diffusion/
模型放在这里
启动sd
nohup ./webui.sh --listen --enable-insecure-extension-access --xformers --no-half-vae &
tail -f nohup.out
错误:Cannot locate TCMalloc. Do you have tcmalloc or google-perftool installed on your system? (improves CPU memory usage)
sudo apt-get install google-perftools
修改到国内镜像 sudo vi launch_utils.py
def prepare_environment():
# torch_index_url = os.environ.get('TORCH_INDEX_URL', "https://download.pytorch.org/whl/cu121")
# torch_command = os.environ.get('TORCH_COMMAND', f"pip install torch==2.1.2 torchvision==0.16.2 --extra-index-url {torch_index_url}")torch_index_url = os.environ.get('TORCH_INDEX_URL', "https://mirrors.aliyun.com/pytorch-wheels/cu121")
torch_command = os.environ.get('TORCH_COMMAND', f"pip install torch==2.1.2 torchvision==0.16.2 -f {torch_index_url}")