MCPcopy Create free account
hub / github.com/Audio-AGI/AudioSep / patch_float

Function patch_float

models/CLAP/open_clip/openai.py:131–148  ·  view source on GitHub ↗
(module)

Source from the content-addressed store, hash-verified

129 float_node = float_input.node()
130
131 def patch_float(module):
132 try:
133 graphs = [module.graph] if hasattr(module, "graph") else []
134 except RuntimeError:
135 graphs = []
136
137 if hasattr(module, "forward1"):
138 graphs.append(module.forward1.graph)
139
140 for graph in graphs:
141 for node in graph.findAllNodes("aten::to"):
142 inputs = list(node.inputs())
143 for i in [
144 1,
145 2,
146 ]: # dtype can be the second or third argument to aten::to()
147 if inputs[i].node()["value"] == 5:
148 inputs[i].node().copyAttributes(float_node)
149
150 model.apply(patch_float)
151 patch_float(model.encode_audio)

Callers 1

load_openai_modelFunction · 0.85

Calls 1

appendMethod · 0.80

Tested by

no test coverage detected