Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -75,21 +75,24 @@ def load_models(model_path, enable_compile=False, attention_backend="native"):
|
|
| 75 |
|
| 76 |
if not os.path.exists(model_path):
|
| 77 |
vae = AutoencoderKL.from_pretrained(
|
| 78 |
-
f"{model_path}
|
|
|
|
| 79 |
torch_dtype=torch.bfloat16,
|
| 80 |
device_map="cuda",
|
| 81 |
use_auth_token=use_auth_token
|
| 82 |
)
|
| 83 |
|
| 84 |
text_encoder = AutoModel.from_pretrained(
|
| 85 |
-
f"{model_path}
|
|
|
|
| 86 |
torch_dtype=torch.bfloat16,
|
| 87 |
device_map="cuda",
|
| 88 |
use_auth_token=use_auth_token
|
| 89 |
).eval()
|
| 90 |
|
| 91 |
tokenizer = AutoTokenizer.from_pretrained(
|
| 92 |
-
f"{model_path}
|
|
|
|
| 93 |
use_auth_token=use_auth_token
|
| 94 |
)
|
| 95 |
else:
|
|
|
|
| 75 |
|
| 76 |
if not os.path.exists(model_path):
|
| 77 |
vae = AutoencoderKL.from_pretrained(
|
| 78 |
+
f"{model_path}",
|
| 79 |
+
subfolder="vae",
|
| 80 |
torch_dtype=torch.bfloat16,
|
| 81 |
device_map="cuda",
|
| 82 |
use_auth_token=use_auth_token
|
| 83 |
)
|
| 84 |
|
| 85 |
text_encoder = AutoModel.from_pretrained(
|
| 86 |
+
f"{model_path}",
|
| 87 |
+
subfolder="text_encoder",
|
| 88 |
torch_dtype=torch.bfloat16,
|
| 89 |
device_map="cuda",
|
| 90 |
use_auth_token=use_auth_token
|
| 91 |
).eval()
|
| 92 |
|
| 93 |
tokenizer = AutoTokenizer.from_pretrained(
|
| 94 |
+
f"{model_path}",
|
| 95 |
+
subfolder="tokenizer",
|
| 96 |
use_auth_token=use_auth_token
|
| 97 |
)
|
| 98 |
else:
|