Spaces:
Runtime error
Runtime error
subfolder param
Browse files
app.py
CHANGED
|
@@ -6,27 +6,7 @@ import spaces #[uncomment to use ZeroGPU]
|
|
| 6 |
from diffusers import DiffusionPipeline
|
| 7 |
import torch
|
| 8 |
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
if not os.path.exists(model_local_path):
|
| 12 |
-
potential_paths = [
|
| 13 |
-
"/home/user/Z-Image-De-Turbo",
|
| 14 |
-
os.path.expanduser("~/.cache/huggingface/hub/models--ostris--Z-Image-De-Turbo"),
|
| 15 |
-
]
|
| 16 |
-
for path in potential_paths:
|
| 17 |
-
if os.path.exists(path):
|
| 18 |
-
model_local_path = path
|
| 19 |
-
break
|
| 20 |
-
|
| 21 |
-
print(f"Пытаюсь загрузить модель из: {model_local_path}")
|
| 22 |
-
|
| 23 |
-
pipe = DiffusionPipeline.from_pretrained(
|
| 24 |
-
os.path.join(model_local_path, "transformer"),
|
| 25 |
-
torch_dtype=torch.bfloat16,
|
| 26 |
-
)
|
| 27 |
-
|
| 28 |
-
device = "cuda" if torch.cuda.is_available() else "cpu"
|
| 29 |
-
pipe.to(device)
|
| 30 |
|
| 31 |
MAX_SEED = np.iinfo(np.int32).max
|
| 32 |
MAX_IMAGE_SIZE = 1024
|
|
|
|
| 6 |
from diffusers import DiffusionPipeline
|
| 7 |
import torch
|
| 8 |
|
| 9 |
+
pipe = DiffusionPipeline.from_pretrained("ostris/Z-Image-De-Turbo", dtype=torch.bfloat16, subfolder='transformer', device_map="cuda")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
|
| 11 |
MAX_SEED = np.iinfo(np.int32).max
|
| 12 |
MAX_IMAGE_SIZE = 1024
|