Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/streamdiffusion/acceleration/tensorrt/models/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,15 @@ def fold_constants(self, return_onnx=False):
# quantize), so is_fp8 is always False here for the UNet/ControlNet path. Gate on size
# too (same >2GB threshold Optimizer.infer_shapes uses below) so the doomed ORT attempt
# is skipped for any large graph. Small fp16/CLIP/VAE graphs keep the faster ORT path.
if len(self.graph.nodes) == 0:
# Catches a corrupt/truncated source ONNX (e.g. left behind by an interrupted
# export) here too -- CLIP's optimize() override (below) calls fold_constants()
# directly without going through BaseModel.optimize()'s equivalent guard, so that
# check alone doesn't cover every caller.
raise RuntimeError(
"Optimizer.fold_constants: input ONNX graph has 0 nodes -- the source ONNX is "
"empty or corrupt. Delete the cached .onnx file for this engine and rebuild."
)
onnx_graph = gs.export_onnx(self.graph)
is_fp8 = any(n.op in ("QuantizeLinear", "DequantizeLinear") for n in self.graph.nodes)
is_large = onnx_graph.ByteSize() > 2147483648
Expand Down
Loading