| 229 | Dequantize weights on the fly before doing the compute |
| 230 | """ |
| 231 | class Linear(GGMLLayer, comfy.ops.manual_cast.Linear): |
| 232 | def __init__(self, in_features, out_features, bias=True, device=None, dtype=None): |
| 233 | torch.nn.Module.__init__(self) |
| 234 | # TODO: better workaround for reserved memory spike on windows |
| 235 | # Issue is with `torch.empty` still reserving the full memory for the layer |
| 236 | # Windows doesn't over-commit memory so without this 24GB+ of pagefile is used |
| 237 | self.in_features = in_features |
| 238 | self.out_features = out_features |
| 239 | self.weight = None |
| 240 | self.bias = None |
| 241 | |
| 242 | def forward_ggml_cast_weights(self, input): |
| 243 | weight, bias = self.cast_bias_weight(input) |
| 244 | return torch.nn.functional.linear(input, weight, bias) |
| 245 | |
| 246 | class Conv2d(GGMLLayer, comfy.ops.manual_cast.Conv2d): |
| 247 | def forward_ggml_cast_weights(self, input): |
nothing calls this directly
no outgoing calls
no test coverage detected