Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -47,6 +47,13 @@ SLIDER_MIN_W, SLIDER_MAX_W = 128, 1280
|
|
| 47 |
print("Initializing WanTI2V pipeline...")
|
| 48 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
| 49 |
device_id = 0 if torch.cuda.is_available() else -1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 50 |
pipeline = wan.WanTI2V(
|
| 51 |
config=cfg,
|
| 52 |
checkpoint_dir=ckpt_dir,
|
|
@@ -55,8 +62,8 @@ pipeline = wan.WanTI2V(
|
|
| 55 |
t5_fsdp=False,
|
| 56 |
dit_fsdp=False,
|
| 57 |
use_sp=False,
|
| 58 |
-
t5_cpu=
|
| 59 |
-
init_on_cpu=
|
| 60 |
convert_model_dtype=True,
|
| 61 |
)
|
| 62 |
print("Pipeline initialized and ready.")
|
|
|
|
| 47 |
print("Initializing WanTI2V pipeline...")
|
| 48 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
| 49 |
device_id = 0 if torch.cuda.is_available() else -1
|
| 50 |
+
# Set CUDA memory allocation configuration
|
| 51 |
+
os.environ['PYTORCH_CUDA_ALLOC_CONF'] = 'expandable_segments:True'
|
| 52 |
+
|
| 53 |
+
# Clear CUDA cache before model initialization
|
| 54 |
+
if torch.cuda.is_available():
|
| 55 |
+
torch.cuda.empty_cache()
|
| 56 |
+
|
| 57 |
pipeline = wan.WanTI2V(
|
| 58 |
config=cfg,
|
| 59 |
checkpoint_dir=ckpt_dir,
|
|
|
|
| 62 |
t5_fsdp=False,
|
| 63 |
dit_fsdp=False,
|
| 64 |
use_sp=False,
|
| 65 |
+
t5_cpu=True, # Use CPU for T5 model
|
| 66 |
+
init_on_cpu=True, # Initialize on CPU first
|
| 67 |
convert_model_dtype=True,
|
| 68 |
)
|
| 69 |
print("Pipeline initialized and ready.")
|