Update src/pipeline.py
Browse files- src/pipeline.py +4 -3
src/pipeline.py
CHANGED
|
@@ -31,15 +31,16 @@ def load_pipeline() -> Pipeline:
|
|
| 31 |
ckpt_id, subfolder="vae", torch_dtype=torch.bfloat16
|
| 32 |
)#.to("cpu")
|
| 33 |
quantize_(vae, int8_weight_only())
|
| 34 |
-
|
| 35 |
-
if isinstance(module, torch.nn.Linear):
|
| 36 |
-
prune.random_unstructured(module, name="weight", amount=0.2)
|
| 37 |
# prune.l1_unstructured(module, 'weight', amount=0.1)
|
| 38 |
pipeline = DiffusionPipeline.from_pretrained(
|
| 39 |
ckpt_id,
|
| 40 |
vae=vae,
|
| 41 |
torch_dtype=dtype,
|
| 42 |
)#.to("cpu")
|
|
|
|
|
|
|
|
|
|
| 43 |
|
| 44 |
|
| 45 |
|
|
|
|
| 31 |
ckpt_id, subfolder="vae", torch_dtype=torch.bfloat16
|
| 32 |
)#.to("cpu")
|
| 33 |
quantize_(vae, int8_weight_only())
|
| 34 |
+
|
|
|
|
|
|
|
| 35 |
# prune.l1_unstructured(module, 'weight', amount=0.1)
|
| 36 |
pipeline = DiffusionPipeline.from_pretrained(
|
| 37 |
ckpt_id,
|
| 38 |
vae=vae,
|
| 39 |
torch_dtype=dtype,
|
| 40 |
)#.to("cpu")
|
| 41 |
+
for name, module in pipeline.transformer.named_modules():
|
| 42 |
+
if isinstance(module, torch.nn.Linear):
|
| 43 |
+
prune.random_unstructured(module, name="weight", amount=0.2)
|
| 44 |
|
| 45 |
|
| 46 |
|