在服务器Ubuntu22.04系统下,stable-fast-3d的部署
创始人
2024-09-25 14:22:35
0

在服务器Ubuntu22.04系统下,stable-fast-3d的部署

  • 一、安装环境:ubuntu基本环境配置
      • 1.更新包列表:
      • 2. 安装GPU驱动程序
      • 3.查看显卡信息
      • 4.下载并安装 CUDA 12.3
  • 二、安装miniconda环境
      • 1. 下载miniconda3
      • 2. 安装miniconda3
      • 3. 打开用户环境编辑页面
      • 4. 重新加载用户环境变量
      • 5.conda配置
      • 6. 创建stable-fast-3d需要的环境
  • 三、克隆stable-fast-3d仓库

一、安装环境:ubuntu基本环境配置

1.更新包列表:

修改配置文件

vi /etc/apt/sources.list 

将原有的内容注释(每行最前面加#)
在最后添加以下内容

########   Ubuntu22.04LTS 清华镜像源   ############### # 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释 deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiverse # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiverse deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-security main restricted universe multiverse # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-security main restricted universe multiverse   # 预发布软件源,不建议启用 # deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-proposed main restricted universe multiverse # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-proposed main restricted universe multiverse 

更新软件列表

sudo apt-get update 

更新本地软件

sudo apt upgrade 

更新时间较长,请耐心等待

2. 安装GPU驱动程序

  • 这个命令会列出您的系统硬件信息,以及推荐的驱动程序版本
ubuntu-drivers devices 
  • 这里的4090建议安装 nvidia-driver-535 驱动程序
sudo apt update sudo apt install nvidia-driver-535 
  • 安装完成后,请务必重启您的系统,以便新的驱动程序生效。
reboot 

3.查看显卡信息

nvidia-smi 

在这里插入图片描述

4.下载并安装 CUDA 12.3

访问 NVIDIA CUDA Toolkit 下载页面,选择 CUDA 12.3 版本。对于 Ubuntu,您可能需要运行类似以下的命令:

wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-ubuntu2204.pin sudo mv cuda-ubuntu2204.pin /etc/apt/preferences.d/cuda-repository-pin-600 wget https://developer.download.nvidia.com/compute/cuda/12.3.0/local_installers/cuda-repo-ubuntu2204-12-3-local_12.3.0-545.23.06-1_amd64.deb sudo dpkg -i cuda-repo-ubuntu2204-12-3-local_12.3.0-545.23.06-1_amd64.deb sudo cp /var/cuda-repo-ubuntu2204-12-3-local/cuda-*-keyring.gpg /usr/share/keyrings/ sudo apt-get update sudo apt-get -y install cuda-toolkit-12-3 
  • 设置环境变量: 编辑 vi ~/.bashrc 文件,添加以下行:
export PATH=/usr/local/cuda-12.3/bin${PATH:+:${PATH}} export LD_LIBRARY_PATH=/usr/local/cuda-12.3/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}} 
  • 应用环境变量更改:
source ~/.bashrc 
  • 验证安装:
nvcc --version 

在这里插入图片描述

二、安装miniconda环境

1. 下载miniconda3

wget https://mirrors.cqupt.edu.cn/anaconda/miniconda/Miniconda3-py310_23.10.0-1-Linux-x86_64.sh 

2. 安装miniconda3

bash Miniconda3-py310_23.10.0-1-Linux-x86_64.sh -u 

直接一直enter键,到输入路径和yes
这边建议路径为:miniconda3

3. 打开用户环境编辑页面

vim ~/.bashrc  
  • 点击键盘I键进入编辑模式,在最下方输入以下代码
export PATH="/root/miniconda3/bin:$PATH" 

4. 重新加载用户环境变量

source ~/.bashrc 
  • 初始化conda
conda init bash 

5.conda配置

  • 配置清华镜像源
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/ 
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/ 
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/ 
  • 设置搜索时显示通道地址
conda config --set show_channel_urls yes 
  • 配置pip 镜像源
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple 

6. 创建stable-fast-3d需要的环境

conda create -n 3d python=3.9 conda activate 3d 

三、克隆stable-fast-3d仓库

官网地址:stable-fast-3d的GitHub地址

git clone https://github.com/Stability-AI/stable-fast-3d.git 

如果下载速度较慢可添加https://mirror.ghproxy.com/镜像源

git clone https://mirror.ghproxy.com/https://github.com/Stability-AI/stable-fast-3d.git 
  • 进入到stable-fast-3d文件夹内
cd stable-fast-3d 
  • 修改requirement.txt
git+https://github.com/vork/PyNanoInstantMeshes.git 

改为

git+https://mirror.ghproxy.com/https://github.com/vork/PyNanoInstantMeshes.git 
  • 安装依赖库
pip install -r requirements.txt pip install -r requirements-dev.txt pip install -r requirements-demo.txt 

设置镜像地址

export HF_ENDPOINT=https://hf-mirror.com 
  • 启动服务
python gradio_app.py 
  • 此时下载模型一般会报错或失败,可以先手动下载所需模型
wget https://mirror.ghproxy.com/https://github.com/danielgatis/rembg/releases/download/v0.0.0/u2net.onnx /root/.u2net/u2net.onnx 

·下载stable-fast-3d模型

mkdir models cd models pip install modelscope modelscope download --model maple77/stable-fast-3d --local_dir './' 
  • 修改gradio_app.py
model = SF3D.from_pretrained(     "stabilityai/stable-fast-3d",     config_name="config.yaml",     weight_name="model.safetensors", ) 

模型文件路径指定到刚才下载的路径

model = SF3D.from_pretrained(     "/root/project/stable-fast-3d/models/",     config_name="config.yaml",     weight_name="model.safetensors", ) 
  • 此外还要修改最后一行启动命令
demo.queue().launch(share=False) 

改为

demo.queue().launch(server_name="0.0.0.0", server_port=15119) 

server_port变量为设置服务器监听的端口为业务端口,此处改为业务端口。
然后在启动服务

python gradio_app.py 

在这里插入图片描述

启动成功后,访问http://主机IP:端口
在这里插入图片描述

相关内容

热门资讯

一分钟了解!金花房卡官网大众互... 微信游戏中心:大众互娱房卡在哪里买打开微信,添加客服微信【88355042】,进入游戏中心或相关小程...
科普解答!微信群开牛牛房卡/新... 打开微信,添加客服【66336574】,进入游戏中心或相关小程序,搜索“微信金花房卡”,选择购买方式...
一分钟了解“链接金花房卡哪里买... 海贝之城是一款非常受欢迎的棋牌游戏,咨询房/卡添加微信:44346008许多玩家在游戏中会购买房卡来...
科普教程!拼三张正规房卡总代理... 微信游戏中心:微信牌九房卡在哪里买打开微信,添加客服【82606316】,进入游戏中心或相关小程序,...
ia攻略/金花房卡是正规的兄弟... 微信游戏中心:兄弟大厅/新道游房卡在哪里买打开微信,添加客服微信【88355042】,进入游戏中心或...
科技实测!金花房卡如何购买新天... 科技实测!金花房卡如何购买新天王/皇豪互众/上游房卡多少钱一张Sa9Ix苹果iPhone 17手机即...
科技实测!牛牛房卡制作链接新海... 新海贝大厅/新神兽房卡更多详情添加微:33549083、 2、在商城页面中选择房卡选项。 ...
终于找到“如何在微信上购买金花... 道游大厅是一款非常受欢迎的棋牌游戏,咨询房/卡添加微信:44346008许多玩家在游戏中会购买房卡来...
科普解答!微信群炸金花房间买房... 打开微信,添加客服【71319951】,进入游戏中心或相关小程序,搜索“微信金花房卡”,选择购买方式...
IA解析/牛牛房卡制作链接老神... 老神兽/皇豪互众是一款非常受欢迎的棋牌游戏,咨询房/卡添加微信:【3329006910】或QQ:33...
科技实测!游戏推荐斗牛房卡出售... 科技实测!游戏推荐斗牛房卡出售高朋联盟/房卡最便宜的中心Sa9Ix苹果iPhone 17手机即将进入...
推荐一款!金花房卡制作链接新超... 您好!微信新超圣/樱花大厅大厅链接获取房卡可以通过以下几种方式购买: 1.微信渠道:(新超圣/樱花...
科普教程!微信拼三张房间卡在哪... 微信游戏中心:微信链接牌九房卡在哪里买打开微信,添加客服【82606316】,进入游戏中心或相关小程...
重大通报,金花房卡出售九神联盟... 重大通报,金花房卡出售九神联盟/房卡客服九神联盟是一款非常受欢迎的游戏,咨询房/卡添加微信:8835...
正版授权“购买斗牛房卡联系方式... 新天道是一款非常受欢迎的棋牌游戏,咨询房/卡添加微信:86909166许多玩家在游戏中会购买房卡来享...
正版授权!牛牛房卡官网芝麻大厅... 正版授权!牛牛房卡官网芝麻大厅/房卡在哪里购买Sa9Ix苹果iPhone 17手机即将进入量产阶段。...
科普解答!微信买链接牛牛房卡/... 打开微信,添加客服【56001354】,进入游戏中心或相关小程序,搜索“微信金花房卡”,选择购买方式...
头条推荐!斗牛房间怎么创建的老... 今 日消息,老神兽/海贝大厅房卡添加微信33549083 苹果今日发布了 iOS 16.1 正式版更...
科技实测!斗牛房间怎么创建的蝴... 蝴蝶大厅房卡更多详情添加微:33549083、 2、在商城页面中选择房卡选项。 3、根...
一分钟了解!金花房卡批发价鸿运... 一分钟了解!金花房卡批发价鸿运大厅/微信链接房卡充值链接鸿运大厅是一款非常受欢迎的游戏,咨询房/卡添...