Spaces:
				
			
			
	
			
			
		Runtime error
		
	
	
	
			
			
	
	
	
	
		
		
		Runtime error
		
	Update app.py
Browse files
    	
        app.py
    CHANGED
    
    | @@ -9,39 +9,26 @@ from huggingface_hub import snapshot_download | |
| 9 |  | 
| 10 | 
             
            # Download All Required Models using `snapshot_download`
         | 
| 11 |  | 
| 12 | 
            -
             | 
| 13 | 
            -
             | 
| 14 | 
            -
                 | 
| 15 | 
            -
                "" | 
| 16 | 
            -
                 | 
| 17 | 
            -
             | 
| 18 | 
            -
                # Use snapshot_download with optional custom cache
         | 
| 19 | 
            -
                snapshot_path = snapshot_download(
         | 
| 20 | 
            -
                    repo_id=repo_id,
         | 
| 21 | 
            -
                    cache_dir=cache_dir,  # You can pass a shared cache path here
         | 
| 22 | 
            -
                    local_dir=None,       # Ensure it's using the actual cache
         | 
| 23 | 
            -
                    local_dir_use_symlinks=False
         | 
| 24 | 
            -
                )
         | 
| 25 | 
            -
             | 
| 26 | 
            -
                # Copy from cache to target directory
         | 
| 27 | 
            -
                if not os.path.exists(target_dir) or not os.listdir(target_dir):
         | 
| 28 | 
            -
                    os.makedirs(target_dir, exist_ok=True)
         | 
| 29 | 
            -
                    shutil.copytree(snapshot_path, target_dir, dirs_exist_ok=True)
         | 
| 30 | 
            -
                    print(f"Copied {repo_id} to {target_dir}")
         | 
| 31 | 
            -
                else:
         | 
| 32 | 
            -
                    print(f"{target_dir} already populated. Skipping copy.")
         | 
| 33 | 
            -
             | 
| 34 | 
            -
                return target_dir
         | 
| 35 | 
            -
             | 
| 36 | 
            -
             | 
| 37 | 
            -
            # Optional: share one cache location across all models
         | 
| 38 | 
            -
            custom_cache = "./hf_cache"
         | 
| 39 | 
            -
             | 
| 40 | 
            -
            wan_model_path = download_and_extract("Wan-AI/Wan2.1-I2V-14B-480P", "./weights/Wan2.1-I2V-14B-480P", cache_dir=custom_cache)
         | 
| 41 | 
            -
            wav2vec_path   = download_and_extract("TencentGameMate/chinese-wav2vec2-base", "./weights/chinese-wav2vec2-base", cache_dir=custom_cache)
         | 
| 42 | 
            -
            multitalk_path = download_and_extract("MeiGen-AI/MeiGen-MultiTalk", "./weights/MeiGen-MultiTalk", cache_dir=custom_cache)
         | 
| 43 |  | 
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
| 44 |  | 
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
| 45 |  | 
| 46 | 
             
            # Define paths
         | 
| 47 | 
             
            base_model_dir = "./weights/Wan2.1-I2V-14B-480P"
         | 
| @@ -137,8 +124,8 @@ def infer(prompt, cond_image_path, cond_audio_path): | |
| 137 | 
             
                    "--ckpt_dir", "weights/Wan2.1-I2V-14B-480P",
         | 
| 138 | 
             
                    "--wav2vec_dir", "weights/chinese-wav2vec2-base",
         | 
| 139 | 
             
                    "--input_json", "./examples/single_example_1.json",
         | 
| 140 | 
            -
                    "--sample_steps", " | 
| 141 | 
            -
                    "--num_persistent_param_in_dit", str( | 
| 142 | 
             
                    "--mode", "streaming",
         | 
| 143 | 
             
                    "--use_teacache",
         | 
| 144 | 
             
                    "--save_file", "multi_long_mediumvram_exp"
         | 
|  | |
| 9 |  | 
| 10 | 
             
            # Download All Required Models using `snapshot_download`
         | 
| 11 |  | 
| 12 | 
            +
            # Download Wan2.1-I2V-14B-480P model
         | 
| 13 | 
            +
            wan_model_path = snapshot_download(
         | 
| 14 | 
            +
                repo_id="Wan-AI/Wan2.1-I2V-14B-480P",
         | 
| 15 | 
            +
                local_dir="./weights/Wan2.1-I2V-14B-480P",
         | 
| 16 | 
            +
                #local_dir_use_symlinks=False
         | 
| 17 | 
            +
            )
         | 
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
| 18 |  | 
| 19 | 
            +
            # Download Chinese wav2vec2 model
         | 
| 20 | 
            +
            wav2vec_path = snapshot_download(
         | 
| 21 | 
            +
                repo_id="TencentGameMate/chinese-wav2vec2-base",
         | 
| 22 | 
            +
                local_dir="./weights/chinese-wav2vec2-base",
         | 
| 23 | 
            +
                #local_dir_use_symlinks=False
         | 
| 24 | 
            +
            )
         | 
| 25 |  | 
| 26 | 
            +
            # Download MeiGen MultiTalk weights
         | 
| 27 | 
            +
            multitalk_path = snapshot_download(
         | 
| 28 | 
            +
                repo_id="MeiGen-AI/MeiGen-MultiTalk",
         | 
| 29 | 
            +
                local_dir="./weights/MeiGen-MultiTalk",
         | 
| 30 | 
            +
                #local_dir_use_symlinks=False
         | 
| 31 | 
            +
            )
         | 
| 32 |  | 
| 33 | 
             
            # Define paths
         | 
| 34 | 
             
            base_model_dir = "./weights/Wan2.1-I2V-14B-480P"
         | 
|  | |
| 124 | 
             
                    "--ckpt_dir", "weights/Wan2.1-I2V-14B-480P",
         | 
| 125 | 
             
                    "--wav2vec_dir", "weights/chinese-wav2vec2-base",
         | 
| 126 | 
             
                    "--input_json", "./examples/single_example_1.json",
         | 
| 127 | 
            +
                    "--sample_steps", "4",
         | 
| 128 | 
            +
                    "--num_persistent_param_in_dit", str(0),
         | 
| 129 | 
             
                    "--mode", "streaming",
         | 
| 130 | 
             
                    "--use_teacache",
         | 
| 131 | 
             
                    "--save_file", "multi_long_mediumvram_exp"
         | 
