開源通義萬相本地部署方案,文生視頻、圖生視頻、視頻生成大模型,支持消費(fèi)級(jí)顯卡!萬相2.1開源
近日,大模型萬相2.1(Wan)重磅開源,此次開源采用Apache2.0協(xié)議,14B和1.3B兩個(gè)參數(shù)規(guī)格的全部推理代碼和權(quán)重全部開源,同時(shí)支持文生視頻和圖生視頻任務(wù),全球開發(fā)者可在Github、HuggingFace、魔搭社區(qū)下載體驗(yàn)。
此次開源的兩個(gè)參數(shù)版本模型:
14B版本萬相模型
14B版本萬相模型在指令遵循、復(fù)雜運(yùn)動(dòng)生成、物理建模、文字視頻生成等方面表現(xiàn)突出,在權(quán)威評(píng)測(cè)集Vbench中,萬相2.1以總分86.22%大幅超越Sora、Luma、Pika等國內(nèi)外模型,穩(wěn)居榜首位置。
1.3B版本
1.3B版本萬相模型不僅超過了更大尺寸的開源模型,甚至還和一些閉源的模型結(jié)果接近,同時(shí)能在消費(fèi)級(jí)顯卡運(yùn)行,僅需8.2GB顯存就可以生成480P視頻,適用于二次模型開發(fā)和學(xué)術(shù)研究。

Github: https://github.com/Wan-Video/Wan2.1
HuggingFace: https://huggingface.co/Wan-AI
魔搭社區(qū):https://modelscope.cn/organization/Wan-AI
通義萬相:https://tongyi.aliyun.com/wanxiang/videoCreation
本地搭建 硬件介紹
本測(cè)試的硬件
系統(tǒng):Windows11專業(yè)版
CPU: 英特爾I7-13700KF
內(nèi)存: 32G
硬盤:1T nvme +4T 機(jī)械
顯卡:RTX 4070 Ti
搭建說明
起初按照官方推薦的方案搭建
搭建方案一 1.下載安裝ComfyUI
一鍵安裝包 :
【點(diǎn)擊前往 】https://www.comfy.org/ 支持 Windows 和 mac 系統(tǒng),我這里下載Windows系統(tǒng)的
選擇GPU

安裝位置,一般默認(rèn),如果C盤空間不夠,可以改成其他位置
我這里改成D盤,D:\AI\ComfyUI

其他默認(rèn)
點(diǎn)擊安裝即可
安裝完成之后,點(diǎn)擊下載模型。

下載umt5_xxl_fp8_e4m3fn_scaled.safetensors ,
地址:https://huggingface.co/Comfy-Org/Wan_2.1_ComfyUI_repackaged/tree/main/split_files/text_encoders
如果顯卡顯存低于8G選擇下載:“umt5_xxl_fp8_e4m3fn_scaled.safetensors”,如果你的顯卡顯存大于12G可以選擇“umt5_xxl_fp16.safetensors”。
我這演示下載,umt5_xxl_fp8_e4m3fn_scaled.safetensors
將下載好的文件放入:ComfyUI/models/text_encoders/
wan_2.1_vae.safetensors
地址:https://huggingface.co/Comfy-Org/Wan_2.1_ComfyUI_repackaged/blob/main/split_files/vae/wan_2.1_vae.safetensors

放入:ComfyUI/models/vae/
**3、**下載視頻生成模型
【點(diǎn)擊下載】地址:https://huggingface.co/Comfy-Org/Wan_2.1_ComfyUI_repackaged/tree/main/split_files/diffusion_models
注意:建議使用 fp16 版本而不是 bf16 版本,因?yàn)樗鼈儠?huì)產(chǎn)生更好的結(jié)果。
質(zhì)量等級(jí)(從高到低):fp16 > bf16 > fp8_scaled > fp8_e4m3fn
根據(jù)你自己的電腦配置選擇。
我這里演示下載“wan2.1_t2v_1.3B_fp16.safetensors”
這些文件位于:ComfyUI/models/diffusion_models/
這些示例使用 16 位文件,但如果內(nèi)存不足,則可以使用 fp8 文件。
4、文字轉(zhuǎn)視頻工作流
下載 Json 格式的工作流,地址:https://comfyanonymous.github.io/ComfyUI_examples/wan/text_to_video_wan.json
5.導(dǎo)入工作流
重啟 ComfyUI

修改提示詞,生成視頻,以下圖片為wan2.1生成的。
一位時(shí)尚的女士在充滿溫暖發(fā)光的霓虹燈和動(dòng)畫城市標(biāo)志的東京街道上行走。她穿著黑色皮夾克,一條長紅裙和黑色靴子,背著黑色手提包。她戴著太陽鏡和紅色口紅。她走路自信而隨意。街道潮濕而具有反射性,營造出五光十色燈光的鏡面效果。許多行人在四處走動(dòng)。

再讓deepseek生成一些提示詞
美女滑雪
場(chǎng)景:雪山、滑雪道 主角:一位年輕女性,穿著時(shí)尚的滑雪服 動(dòng)作:她快速下坡、做出流暢的轉(zhuǎn)彎動(dòng)作,偶爾做一些高難度的跳躍或花式動(dòng)作 環(huán)境:陽光明媚,雪地反射出耀眼的光芒,遠(yuǎn)處是白雪覆蓋的山脈,滑雪道上還有其他滑雪者 情感:展現(xiàn)出她的自信、優(yōu)雅和速度感,鏡頭捕捉她興奮和專注的表情 音樂:動(dòng)感的電子音樂或極限運(yùn)動(dòng)風(fēng)格的背景音樂 細(xì)節(jié):鏡頭可以聚焦她的滑雪裝備,或者快速轉(zhuǎn)場(chǎng)展示她與雪地環(huán)境的互動(dòng)。

場(chǎng)景:溫馨的家中環(huán)境,陽光透過窗戶照進(jìn)房間,地板干凈整潔 主角:一只可愛的小貓,毛茸茸的,顏色可以是橙色、黑白相間或其他可愛配色 動(dòng)作:小貓隨著音樂的節(jié)奏輕巧地跳舞,做出小范圍的旋轉(zhuǎn)、擺動(dòng)或是可愛的舞步,甚至可能用爪子打節(jié)奏 環(huán)境:房間里可能有玩具球、毯子等小貓常見的物品,增添趣味性 音樂:歡快的、輕松的背景音樂,適合小貓的動(dòng)作和氣氛,可以是一些童趣或電子風(fēng)格的旋律 情感:表現(xiàn)出小貓調(diào)皮、活潑的一面,配合鏡頭捕捉它快樂、專注、或者搞怪的表情 細(xì)節(jié):可以特寫小貓的腳步或尾巴的擺動(dòng),展示其動(dòng)作的協(xié)調(diào)性和可愛程度,偶爾做些搞笑或意外的動(dòng)作來增加趣味性。

地址: https://huggingface.co/Comfy-Org/Wan_2.1_ComfyUI_repackaged/tree/main/split_files/diffusion_models
根據(jù)自己的顯存大小選擇,我這里選擇小一點(diǎn)的 wan2.1_t2v_1.3B_bf16.safetensors
將其放入:ComfyUI/models/diffusion_models/

下載 clip_vision_h.safetensors 文件
地址:https://huggingface.co/Comfy-Org/Wan_2.1_ComfyUI_repackaged/blob/main/split_files/clip_vision/clip_vision_h.safetensors

放入:ComfyUI/models/clip_vision/
請(qǐng)注意,此示例僅生成 512×512 的 33 幀,因?yàn)槲蚁M子谠L問,但模型可以做的不止這些。如果您有硬件/耐心運(yùn)行它,720p 模型就相當(dāng)不錯(cuò)。
Json 格式的工作流
輸入圖像可以在通量頁面上找到。
以下是720p 型號(hào)的相同示例:
山羊打架
原圖:

生成之后的視頻(截圖)

由于方案二搭建方案一直報(bào)錯(cuò),這種方法不推薦,僅作為筆者記錄采坑!
1.安裝Python
去python官網(wǎng)下載:
https://www.python.org/downloads/
我這邊下載的是 python-3.13.2-amd64.exe
安裝python
勾選下面兩項(xiàng),再點(diǎn)擊 install now,安裝軟件。

pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple/
在命令行中執(zhí)行:
image-20250307161525029 3.克隆項(xiàng)目Wan2.1
克隆項(xiàng)目
git clone https://github.com/Wan-Video/Wan2.1.git cd Wan2.1
安裝依賴
Install dependencies: 查看版本: pip --version pip 24.3.1 # Ensure torch >= 2.4.0 pip install -r requirements.txt

報(bào)錯(cuò)1:
---------------------------------------- 1.3/1.3 MB 506.7 kB/s eta 0:00:00 Collecting imageio-ffmpeg (from -r requirements.txt (line 13)) Downloading https://pypi.tuna.tsinghua.edu.cn/packages/2c/c6/fa760e12a2483469e2bf5058c5faff664acf66cadb4df2ad6205b016a73d/imageio_ffmpeg-0.6.0-py3-none-win_amd64.whl (31.2 MB) -------------------------------------- 31.2/31.2 MB 565.4 kB/s eta 0:00:00 Collecting flash_attn (from -r requirements.txt (line 14)) Downloading https://pypi.tuna.tsinghua.edu.cn/packages/11/34/9bf60e736ed7bbe15055ac2dab48ec67d9dbd088d2b4ae318fd77190ab4e/flash_attn-2.7.4.post1.tar.gz (6.0 MB) ---------------------------------------- 6.0/6.0 MB 872.1 kB/s eta 0:00:00 ERROR: Could not install packages due to an OSError: [Errno 2] No such file or directory: 'C:\\Users\\Administrator\\AppData\\Local\\Temp\\pip-install-8t1fvex0\\flash-attn_355b4bf0645846d5946da128691050af\\csrc\\composable_kernel\\client_example\\24_grouped_conv_activation\\grouped_convnd_fwd_scaleadd_scaleadd_relu\\grouped_conv_fwd_scaleadd_scaleadd_relu_bf16.cpp' HINT: This error might have occurred since this system does not have Windows Long Path support enabled. You can find information on how to enable this at https://pip.pypa.io/warnings/enable-long-paths [notice] A new release of pip is available: 24.3.1 -> 25.0.1 [notice] To update, run: python.exe -m pip install --upgrade pip
解決:
python.exe -m pip install --upgrade pip pip --version pip 25.0.1
報(bào)錯(cuò)2:
Collecting flash_attn (from -r requirements.txt (line 14)) Using cached https://pypi.tuna.tsinghua.edu.cn/packages/11/34/9bf60e736ed7bbe15055ac2dab48ec67d9dbd088d2b4ae318fd77190ab4e/flash_attn-2.7.4.post1.tar.gz (6.0 MB) ERROR: Could not install packages due to an OSError: [Errno 2] No such file or directory: 'C:\\Users\\Administrator\\AppData\\Local\\Temp\\pip-install-kgnff0x2\\flash-attn_f6b86d432d5f493d9ccd50fb1e950e0e\\csrc\\composable_kernel\\client_example\\24_grouped_conv_activation\\grouped_convnd_fwd_scaleadd_scaleadd_relu\\grouped_conv_fwd_scaleadd_scaleadd_relu_bf16.cpp' HINT: This error might have occurred since this system does not have Windows Long Path support enabled. You can find information on how to enable this at https://pip.pypa.io/warnings/enable-long-paths
啟用Windows長路徑支持從Windows 10版本1607開始,Microsoft引入了對(duì)長路徑的支持,但需要手動(dòng)啟用。
1.通過注冊(cè)表啟用長路徑支持
或者,你可以使用以下PowerShell命令(需要管理員權(quán)限):
powershell
New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem" -Name "LongPathsEnabled" -Value 1 -PropertyType DWORD -Force
? 按下
Win + R
,打開運(yùn)行對(duì)話框,輸入regedit
并回車,打開注冊(cè)表編輯器。? 導(dǎo)航到以下路徑:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem
? 在右側(cè)窗格中找到名為
LongPathsEnabled
的DWORD值。如果沒有,右鍵單擊空白處,選擇新建 -> DWORD(32位)值,并命名為LongPathsEnabled
。? 雙擊
LongPathsEnabled
,將其值設(shè)置為1
。? 關(guān)閉注冊(cè)表編輯器。

報(bào)錯(cuò)3
Getting requirements to build wheel did not run successfully. exit code: 1 [23 lines of output] Traceback (most recent call last): File "C:\Users\Administrator\AppData\Local\Programs\Python\Python313\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 389, in main() ~~~~^^ File "C:\Users\Administrator\AppData\Local\Programs\Python\Python313\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 373, in main json_out["return_val"] = hook(**hook_input["kwargs"]) ~~~~^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Administrator\AppData\Local\Programs\Python\Python313\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 143, in get_requires_for_build_wheel return hook(config_settings) File "C:\Users\Administrator\AppData\Local\Temp\pip-build-env-jbn4g9x9\overlay\Lib\site-packages\setuptools\build_meta.py", line 334, in get_requires_for_build_wheel return self._get_build_requires(config_settings, requirements=[]) ~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Administrator\AppData\Local\Temp\pip-build-env-jbn4g9x9\overlay\Lib\site-packages\
查看NVIDIA的版本
https://developer.nvidia.com/cuda-toolkit-archive

安裝軟件

驗(yàn)證
nvcc --version nvcc: NVIDIA (R) Cuda compiler driver Copyright (c) 2005-2024 NVIDIA Corporation Built on Wed_Oct_30_01:18:48_Pacific_Daylight_Time_2024 Cuda compilation tools, release 12.6, V12.6.85 Build cuda_12.6.r12.6/compiler.35059454_0
安裝flash_attnpip install flash_attn -i https://mirrors.aliyun.com/pypi/simple/
遇到報(bào)錯(cuò):
pip install flash_attn -i https://mirrors.aliyun.com/pypi/simple/ Looking in indexes: https://mirrors.aliyun.com/pypi/simple/ Collecting flash_attn Using cached https://mirrors.aliyun.com/pypi/packages/11/34/9bf60e736ed7bbe15055ac2dab48ec67d9dbd088d2b4ae318fd77190ab4e/flash_attn-2.7.4.post1.tar.gz (6.0 MB) Installing build dependencies ... done Getting requirements to build wheel ... error error: subprocess-exited-with-error × Getting requirements to build wheel did not run successfully. │ exit code: 1 ╰─> [23 lines of output] Traceback (most recent call last): File "C:\Users\Administrator\AppData\Local\Programs\Python\Python313\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 389, in main() ~~~~^^ File "C:\Users\Administrator\AppData\Local\Programs\Python\Python313\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 373, in main json_out["return_val"] = hook(**hook_input["kwargs"]) ~~~~^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Administrator\AppData\Local\Programs\Python\Python313\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 143, in get_requires_for_build_wheel return hook(config_settings) File "C:\Users\Administrator\AppData\Local\Temp\pip-build-env-1qn6p69k\overlay\Lib\site-packages\setuptools\build_meta.py", line 334, in get_requires_for_build_wheel return self._get_build_requires(config_settings, requirements=[]) ~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Administrator\AppData\Local\Temp\pip-build-env-1qn6p69k\overlay\Lib\site-packages\setuptools\build_meta.py", line 304, in _get_build_requires self.run_setup() ~~~~~~~~~~~~~~^^ File "C:\Users\Administrator\AppData\Local\Temp\pip-build-env-1qn6p69k\overlay\Lib\site-packages\setuptools\build_meta.py", line 522, in run_setup super().run_setup(setup_script=setup_script) ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Administrator\AppData\Local\Temp\pip-build-env-1qn6p69k\overlay\Lib\site-packages\setuptools\build_meta.py", line 320, in run_setup exec(code, locals()) ~~~~^^^^^^^^^^^^^^^^ File " ", line 22, in ModuleNotFoundError: No module named 'torch' [end of output] note: This error originates from a subprocess, and is likely not a problem with pip. error: subprocess-exited-with-error × Getting requirements to build wheel did not run successfully. │ exit code: 1 ╰─> See above for output. note: This error originates from a subprocess, and is likely not a problem with pip.
試了很多方法一直報(bào)錯(cuò),放棄了
結(jié)束
這就是部署開源通義萬相本地部署方案,簡直是視頻生成領(lǐng)域的一大福音。它降低了使用門檻,讓更多人能體驗(yàn)到AI視頻生成的樂趣。如果你對(duì)視頻創(chuàng)作、AI技術(shù)感興趣,那可千萬別錯(cuò)過。
寫文不易,如果你都看到了這里,請(qǐng)點(diǎn)個(gè)贊和在看,分享給更多的朋友;也別忘了關(guān)注星哥玩云!這里有滿滿的干貨分享,還有輕松有趣的技術(shù)交流~點(diǎn)個(gè)贊、分享給身邊的小伙伴,一起成長,一起玩轉(zhuǎn)技術(shù)世界吧!
熱門跟貼