最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

CloudStudio之ComfyUI上使用Wan2.1输出高质量视频

网站源码admin7浏览0评论

CloudStudio之ComfyUI上使用Wan2.1输出高质量视频

原文链接:


就在2月25日,阿里开源了Wan2.1模型的模型文件和代码以及权重。今天咋们就使用CloudStudio是一个免费提供10000分钟的开箱及用的一个AI应用平台,可免费运行T4显卡,滴滴滴,快上车。

1 环境准备

  1. 浏览器打开Cloud Studio的官网Cloud Studio
  2. 使用微信等账号登录网站后,点击“高性能工作空间”
  3. 点击右侧“新建”按钮。
  4. 选择“基础型”或“HAI进阶型”。基础性每个月10000分钟免费时长。
  5. 输入“空间名称”以及选择“应用模版”为Pytorch2.0.0后点击“新建”。
  6. 待新建的空间显示“运行中”后点击名称,跳转IDE环境。

2 部署前环境检查

  1. 点击IDE环境顶部“终端”>“新建终端”。
  2. 在弹出的终端界面,输入nvidia-smi检查显卡型号、CUDA版本等信息。

    代码语言:javascript代码运行次数:0运行复制
    (base) root@VM-0-224-ubuntu:/workspace# nvidia-smi 
    Sun Mar  2 15:09:23 2025       
    +-----------------------------------------------------------------------------+
    | NVIDIA-SMI 525.105.17   Driver Version: 525.105.17   CUDA Version: 12.0     |
    |-------------------------------+----------------------+----------------------+
    | GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
    | Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
    |                               |                      |               MIG M. |
    |===============================+======================+======================|
    |   0  Tesla T4            On   | 00000000:00:09.0 Off |                  Off |
    | N/A   45C    P0    26W /  70W |  12987MiB / 16384MiB |      0%      Default |
    |                               |                      |                  N/A |
    +-------------------------------+----------------------+----------------------+
                                                                                   
    +-----------------------------------------------------------------------------+
    | Processes:                                                                  |
    |  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
    |        ID   ID                                                   Usage      |
    |=============================================================================|
    +-----------------------------------------------------------------------------+

    3 部署ComfyUI项目

3.1 配置环境

本案例依赖Python3.11.11及以上环境,因此我们首先创建虚拟环境:

代码语言:javascript代码运行次数:0运行复制
conda clean -i

conda create -n python-3.11.11 python=3.11.11 -y --override-channels --channel 

3.2 安装基础依赖库

代码语言:javascript代码运行次数:0运行复制
/root/miniforge3/envs/python-3.11.11/bin/pip install --upgrade pip

/root/miniforge3/envs/python-3.11.11/bin/pip install torch==2.0.1 torchvision==0.15.2 torchaudio==2.0.2

/root/miniforge3/envs/python-3.11.11/bin/pip install diffusers==0.30.0 transformers==4.44.0 accelerate==0.33.0 peft==0.12.0 gradio==3.41.2 safetensors==0.4.2 controlnet-aux==0.0.9 mediapipe==0.10.14 xformers==0.0.21 sentencepiece==0.2.0

/root/miniforge3/envs/python-3.11.11/bin/pip install python-multipart==0.0.13 ipywidgets==7.7.1

3.3 配置加速

代码语言:javascript代码运行次数:0运行复制
git config --global http.proxy :8081
git config --global https.proxy :8081
export http_proxy=:8081
export HTTP_PROXY=:8081
export https_proxy=:8081
export HTTPS_PROXY=:8081

3.4 拉取ComfyUI软件包

代码语言:javascript代码运行次数:0运行复制
cd /workspace/ && git clone .git

3.5 安装ComfyUI依赖库

代码语言:javascript代码运行次数:0运行复制
cd /workspace/ComfyUI
/root/miniforge3/envs/python-3.11.11/bin/pip install -r requirements.txt
/root/miniforge3/envs/python-3.11.11/bin/pip install sentencepiece

3.6 拉取工作流模板

代码语言:javascript代码运行次数:0运行复制
mkdir -p /workspace/ComfyUI/user/default/workflows
cd /workspace/ComfyUI/user/default/workflows
git clone .git
git clone .git

3.7 安装插件

代码语言:javascript代码运行次数:0运行复制
cd /workspace/ComfyUI/custom_nodes

git clone .git

git clone .git

git clone .git

git clone .git

git clone .git

git clone .git

git clone .git

git clone .git

git clone .git

git clone .git

git clone .git

cd /workspace/ComfyUI/custom_nodes/ComfyUI-Custom-Scripts/user && wget .csv && mv Tags-zh-full-pack.csv autocomplete.txt && wget .txt && cat danbooru-tags.txt >>  autocomplete.txt && rm -rf danbooru-tags.txt

cd /workspace/ComfyUI/custom_nodes/comfyui-workspace-manager/ && find . -type f -exec sed -i 's||/api|g' {} +

cd /workspace/ComfyUI/custom_nodes/ComfyUI-GGUF && /root/miniforge3/envs/python-3.11.11/bin/pip install -r requirements.txt

cd /workspace/ComfyUI/custom_nodes/ComfyUI-Crystools && /root/miniforge3/envs/python-3.11.11/bin/pip install -r requirements.txt

cd /workspace/ComfyUI/custom_nodes/ComfyUI-VideoHelperSuite && /root/miniforge3/envs/python-3.11.11/bin/pip install -r requirements.txt

cd /workspace/ComfyUI/custom_nodes/ComfyUI-WanVideoWrapper && /root/miniforge3/envs/python-3.11.11/bin/pip install -r requirements.txt

3.8 启动服务

代码语言:javascript代码运行次数:0运行复制
/root/miniforge3/envs/python-3.11.11/bin/python3 /workspace/ComfyUI/main.py

4 打开ComfyUI面板

启动后默认监听8188端口,直接在空间地址例如/修改成/即可打开项目网站。

5 加载Wan 2.1工作流

  1. 浏览器打开ComfyUI-WanVideoWrapper/example_workflows at main · kijai/ComfyUI-WanVideoWrapper可以看到有4个工作流。 wanvideo_480p_I2V_example_01.json 图片到视频 wanvideo_T2V_example_01.json 文字到视频 wanvideo_long_T2V_example_01.json 长文字到视频 wanvideo_vid2vid_example_01.json 视频到视频
  2. 这里我们先演示wanvideo_T2V_example_01.json 文字到视频,先下载这个工作流到本地。
  3. 工作流拖入ComfyUI面板中加载。

6 下载Wan2.1模型

模型地址:Kijai/WanVideo_comfy at main

  1. 执行如下命令,下载clip模型文件

    代码语言:javascript代码运行次数:0运行复制
    aria2c -x 16 -s 16 ".safetensors" -o umt5-xxl-enc-fp8_e4m3fn.safetensors -d /workspace/ComfyUI/models/clip/

  2. 执行如下命令,下载diffusion_models模型文件

    代码语言:javascript代码运行次数:0运行复制
    aria2c -x 16 -s 16 ".safetensors" -o Wan2_1-T2V-14B_fp8_e4m3fn.safetensors -d /workspace/ComfyUI/models/diffusion_models

  3. 执行如下命令,下载vae模型文件

    代码语言:javascript代码运行次数:0运行复制
    aria2c -x 16 -s 16 ".safetensors" -o Wan2_1_VAE_bf16.safetensors -d /workspace/ComfyUI/models/vae

  4. 如果是I2V则还需要导入clip_vision模型文件

    代码语言:javascript代码运行次数:0运行复制
    aria2c -x 16 -s 16 ".safetensors" -o open-clip-xlm-roberta-large-vit-huge-14_visual_fp16.safetensors -d /workspace/ComfyUI/models/clip_vision

7 工作流中模型确认

当模型都下载完成后,切换到工作流界面,将模型文件进行一一选择。

  1. clip模型选择
    notion image
  2. diffusion_models模型选择
    notion image
  3. vae模型选择
    notion image

8 执行

notion image

9 预览视频

notion image

END

免责声明:

  • 笔者水平有限,尽管经过多次验证和检查,尽力确保内容的准确性,但仍可能存在疏漏之处。敬请业界专家大佬不吝指教。
  • 本文所述内容仅通过实战环境验证测试,读者可学习、借鉴,但严禁直接用于生产环境由此引发的任何问题,作者概不负责
发布评论

评论列表(0)

  1. 暂无评论