Upload handler.py
Browse files- handler.py +5 -3
handler.py
CHANGED
|
@@ -25,7 +25,7 @@ print("Device Capability:", torch.cuda.get_device_capability())
|
|
| 25 |
|
| 26 |
IS_TURBO = False
|
| 27 |
IS_4BIT = False
|
| 28 |
-
IS_PARA =
|
| 29 |
IS_LVRAM = False
|
| 30 |
IS_COMPILE = True
|
| 31 |
IS_AUTOQ = False
|
|
@@ -158,14 +158,16 @@ def load_pipeline_opt(repo_id: str, dtype: torch.dtype) -> Any:
|
|
| 158 |
elif IS_CC89: quantize_(transformer, float8_dynamic_activation_float8_weight(), device="cuda")
|
| 159 |
else: quantize_(transformer, weight, device="cuda")
|
| 160 |
transformer.to(memory_format=torch.channels_last)
|
| 161 |
-
transformer = torch.compile(transformer, mode="max-autotune", fullgraph=True)
|
|
|
|
| 162 |
vae = AutoencoderKL.from_pretrained(repo_id, subfolder="vae", torch_dtype=dtype)
|
| 163 |
vae.fuse_qkv_projections()
|
| 164 |
if IS_CC90: quantize_(vae, float8_dynamic_activation_float8_weight(granularity=PerRow()), device="cuda")
|
| 165 |
elif IS_CC89: quantize_(vae, float8_dynamic_activation_float8_weight(), device="cuda")
|
| 166 |
else: quantize_(vae, weight, device="cuda")
|
| 167 |
vae.to(memory_format=torch.channels_last)
|
| 168 |
-
vae = torch.compile(vae, mode="max-autotune", fullgraph=True)
|
|
|
|
| 169 |
pipe = FluxPipeline.from_pretrained(repo_id, transformer=None, vae=None, torch_dtype=dtype, quantization_config=quantization_config)
|
| 170 |
pipe.transformer = transformer
|
| 171 |
pipe.vae = vae
|
|
|
|
| 25 |
|
| 26 |
IS_TURBO = False
|
| 27 |
IS_4BIT = False
|
| 28 |
+
IS_PARA = True
|
| 29 |
IS_LVRAM = False
|
| 30 |
IS_COMPILE = True
|
| 31 |
IS_AUTOQ = False
|
|
|
|
| 158 |
elif IS_CC89: quantize_(transformer, float8_dynamic_activation_float8_weight(), device="cuda")
|
| 159 |
else: quantize_(transformer, weight, device="cuda")
|
| 160 |
transformer.to(memory_format=torch.channels_last)
|
| 161 |
+
#transformer = torch.compile(transformer, mode="max-autotune", fullgraph=True)
|
| 162 |
+
transformer = torch.compile(transformer, mode="reduce-overhead", fullgraph=False)
|
| 163 |
vae = AutoencoderKL.from_pretrained(repo_id, subfolder="vae", torch_dtype=dtype)
|
| 164 |
vae.fuse_qkv_projections()
|
| 165 |
if IS_CC90: quantize_(vae, float8_dynamic_activation_float8_weight(granularity=PerRow()), device="cuda")
|
| 166 |
elif IS_CC89: quantize_(vae, float8_dynamic_activation_float8_weight(), device="cuda")
|
| 167 |
else: quantize_(vae, weight, device="cuda")
|
| 168 |
vae.to(memory_format=torch.channels_last)
|
| 169 |
+
#vae = torch.compile(vae, mode="max-autotune", fullgraph=True)
|
| 170 |
+
vae = torch.compile(vae, mode="reduce-overhead", fullgraph=False)
|
| 171 |
pipe = FluxPipeline.from_pretrained(repo_id, transformer=None, vae=None, torch_dtype=dtype, quantization_config=quantization_config)
|
| 172 |
pipe.transformer = transformer
|
| 173 |
pipe.vae = vae
|