MCPcopy Create free account
hub / github.com/TencentARC/BrushNet / optimize

Function optimize

scripts/convert_stable_diffusion_controlnet_to_onnx.py:66–77  ·  view source on GitHub ↗
(onnx_graph, name, verbose)

Source from the content-addressed store, hash-verified

64
65
66def optimize(onnx_graph, name, verbose):
67 opt = Optimizer(onnx_graph, verbose=verbose)
68 opt.info(name + ": original")
69 opt.cleanup()
70 opt.info(name + ": cleanup")
71 opt.fold_constants()
72 opt.info(name + ": fold constants")
73 # opt.infer_shapes()
74 # opt.info(name + ': shape inference')
75 onnx_opt_graph = opt.cleanup(return_onnx=True)
76 opt.info(name + ": finished")
77 return onnx_opt_graph
78
79
80class UNet2DConditionControlNetModel(torch.nn.Module):

Callers 1

convert_modelsFunction · 0.85

Calls 4

infoMethod · 0.95
cleanupMethod · 0.95
fold_constantsMethod · 0.95
OptimizerClass · 0.70

Tested by

no test coverage detected