mirror of
				https://github.com/Wan-Video/Wan2.1.git
				synced 2025-11-04 06:15:17 +00:00 
			
		
		
		
	Merge remote-tracking branch 'myfork/main'
This commit is contained in:
		
						commit
						04bf7390fe
					
				@ -79,6 +79,11 @@ pip install "huggingface_hub[cli]"
 | 
			
		||||
huggingface-cli download Wan-AI/Wan2.1-T2V-14B --local-dir ./Wan2.1-T2V-14B
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Download models using modelscope-cli:
 | 
			
		||||
```
 | 
			
		||||
pip install modelscope
 | 
			
		||||
modelscope download Wan-AI/Wan2.1-T2V-14B --local_dir ./Wan2.1-T2V-14B
 | 
			
		||||
```
 | 
			
		||||
#### Run Text-to-Video Generation
 | 
			
		||||
 | 
			
		||||
This repository supports two Text-to-Video models (1.3B and 14B) and two resolutions (480P and 720P). The parameters and configurations for these models are as follows:
 | 
			
		||||
 | 
			
		||||
@ -2,6 +2,7 @@
 | 
			
		||||
import argparse
 | 
			
		||||
import gc
 | 
			
		||||
import os.path as osp
 | 
			
		||||
import os
 | 
			
		||||
import sys
 | 
			
		||||
import warnings
 | 
			
		||||
 | 
			
		||||
@ -10,7 +11,7 @@ import gradio as gr
 | 
			
		||||
warnings.filterwarnings('ignore')
 | 
			
		||||
 | 
			
		||||
# Model
 | 
			
		||||
sys.path.insert(0, '/'.join(osp.realpath(__file__).split('/')[:-2]))
 | 
			
		||||
sys.path.insert(0, os.path.sep.join(osp.realpath(__file__).split(os.path.sep)[:-2]))
 | 
			
		||||
import wan
 | 
			
		||||
from wan.configs import MAX_AREA_CONFIGS, WAN_CONFIGS
 | 
			
		||||
from wan.utils.prompt_extend import DashScopePromptExpander, QwenPromptExpander
 | 
			
		||||
 | 
			
		||||
@ -1,6 +1,7 @@
 | 
			
		||||
# Copyright 2024-2025 The Alibaba Wan Team Authors. All rights reserved.
 | 
			
		||||
import argparse
 | 
			
		||||
import os.path as osp
 | 
			
		||||
import os
 | 
			
		||||
import sys
 | 
			
		||||
import warnings
 | 
			
		||||
 | 
			
		||||
@ -9,7 +10,7 @@ import gradio as gr
 | 
			
		||||
warnings.filterwarnings('ignore')
 | 
			
		||||
 | 
			
		||||
# Model
 | 
			
		||||
sys.path.insert(0, '/'.join(osp.realpath(__file__).split('/')[:-2]))
 | 
			
		||||
sys.path.insert(0, os.path.sep.join(osp.realpath(__file__).split(os.path.sep)[:-2]))
 | 
			
		||||
import wan
 | 
			
		||||
from wan.configs import WAN_CONFIGS
 | 
			
		||||
from wan.utils.prompt_extend import DashScopePromptExpander, QwenPromptExpander
 | 
			
		||||
 | 
			
		||||
@ -1,6 +1,7 @@
 | 
			
		||||
# Copyright 2024-2025 The Alibaba Wan Team Authors. All rights reserved.
 | 
			
		||||
import argparse
 | 
			
		||||
import os.path as osp
 | 
			
		||||
import os
 | 
			
		||||
import sys
 | 
			
		||||
import warnings
 | 
			
		||||
 | 
			
		||||
@ -9,7 +10,7 @@ import gradio as gr
 | 
			
		||||
warnings.filterwarnings('ignore')
 | 
			
		||||
 | 
			
		||||
# Model
 | 
			
		||||
sys.path.insert(0, '/'.join(osp.realpath(__file__).split('/')[:-2]))
 | 
			
		||||
sys.path.insert(0, os.path.sep.join(osp.realpath(__file__).split(os.path.sep)[:-2]))
 | 
			
		||||
import wan
 | 
			
		||||
from wan.configs import WAN_CONFIGS
 | 
			
		||||
from wan.utils.prompt_extend import DashScopePromptExpander, QwenPromptExpander
 | 
			
		||||
@ -45,7 +46,7 @@ def t2v_generation(txt2vid_prompt, resolution, sd_steps, guide_scale,
 | 
			
		||||
        guide_scale=guide_scale,
 | 
			
		||||
        n_prompt=n_prompt,
 | 
			
		||||
        seed=seed,
 | 
			
		||||
        offload_model=False)
 | 
			
		||||
        offload_model=True)
 | 
			
		||||
 | 
			
		||||
    cache_video(
 | 
			
		||||
        tensor=video[None],
 | 
			
		||||
 | 
			
		||||
@ -1,6 +1,7 @@
 | 
			
		||||
# Copyright 2024-2025 The Alibaba Wan Team Authors. All rights reserved.
 | 
			
		||||
import argparse
 | 
			
		||||
import os.path as osp
 | 
			
		||||
import os
 | 
			
		||||
import sys
 | 
			
		||||
import warnings
 | 
			
		||||
 | 
			
		||||
@ -9,7 +10,7 @@ import gradio as gr
 | 
			
		||||
warnings.filterwarnings('ignore')
 | 
			
		||||
 | 
			
		||||
# Model
 | 
			
		||||
sys.path.insert(0, '/'.join(osp.realpath(__file__).split('/')[:-2]))
 | 
			
		||||
sys.path.insert(0, os.path.sep.join(osp.realpath(__file__).split(os.path.sep)[:-2]))
 | 
			
		||||
import wan
 | 
			
		||||
from wan.configs import WAN_CONFIGS
 | 
			
		||||
from wan.utils.prompt_extend import DashScopePromptExpander, QwenPromptExpander
 | 
			
		||||
 | 
			
		||||
@ -252,6 +252,7 @@ class WanT2V:
 | 
			
		||||
            x0 = latents
 | 
			
		||||
            if offload_model:
 | 
			
		||||
                self.model.cpu()
 | 
			
		||||
                torch.cuda.empty_cache()
 | 
			
		||||
            if self.rank == 0:
 | 
			
		||||
                videos = self.vae.decode(x0)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user