Loader: accept both dtype/torch_dtype kwarg conventions (diffusers version drift)
Browse files
spi/renderers/cogvideo.py
CHANGED
|
@@ -85,7 +85,11 @@ class CogVideoRenderer:
|
|
| 85 |
from diffusers import CogVideoXPipeline
|
| 86 |
|
| 87 |
dtype = getattr(torch, kwargs.get("dtype", "float16")) # 2b requires fp16
|
| 88 |
-
pipe =
|
|
|
|
|
|
|
|
|
|
|
|
|
| 89 |
pipe.to(self.device or ("cuda" if torch.cuda.is_available() else "cpu"))
|
| 90 |
return pipe
|
| 91 |
|
|
|
|
| 85 |
from diffusers import CogVideoXPipeline
|
| 86 |
|
| 87 |
dtype = getattr(torch, kwargs.get("dtype", "float16")) # 2b requires fp16
|
| 88 |
+
pipe = None
|
| 89 |
+
try: # diffusers renamed dtype -> torch_dtype between versions; support both
|
| 90 |
+
pipe = CogVideoXPipeline.from_pretrained(self.model_id, dtype=dtype)
|
| 91 |
+
except (TypeError, ValueError):
|
| 92 |
+
pipe = CogVideoXPipeline.from_pretrained(self.model_id, torch_dtype=dtype)
|
| 93 |
pipe.to(self.device or ("cuda" if torch.cuda.is_available() else "cpu"))
|
| 94 |
return pipe
|
| 95 |
|