-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcompress_diffusion.sh
More file actions
45 lines (39 loc) · 1.26 KB
/
Copy pathcompress_diffusion.sh
File metadata and controls
45 lines (39 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/bash
# Script to compress the diffusion model
echo "=================================="
echo "Compressing Diffusion Model"
echo "=================================="
echo ""
echo "Original model: diffusion_pytorch_model.safetensors"
echo "Original size: 1.7GB"
echo ""
# Step 1: Analyze the model
echo "Step 1: Analyzing model..."
python3 -m edge_compressor.cli \
--model diffusion_pytorch_model.safetensors \
--analyze-only
echo ""
echo "=================================="
echo "Step 2: Compressing with FP16..."
echo "=================================="
echo ""
# Step 2: Compress with FP16 (recommended)
python3 -m edge_compressor.cli \
--model diffusion_pytorch_model.safetensors \
--output compressed_diffusion_fp16 \
--quantization fp16 \
--no-pruning \
--save-metrics diffusion_compression_metrics.json \
--save-summary diffusion_compression_summary.json \
--verbose
echo ""
echo "=================================="
echo "Compression Complete!"
echo "=================================="
echo ""
echo "Results:"
echo " - Compressed model: compressed_diffusion_fp16.onnx"
echo " - Metrics: diffusion_compression_metrics.json"
echo " - Summary: diffusion_compression_summary.json"
echo ""
echo "Expected size reduction: ~50% (from 1.7GB to ~850MB)"