diff --git a/api/onnx_web/convert/diffusion/lora.py b/api/onnx_web/convert/diffusion/lora.py index 62a02898..a6b86900 100644 --- a/api/onnx_web/convert/diffusion/lora.py +++ b/api/onnx_web/convert/diffusion/lora.py @@ -129,7 +129,9 @@ def blend_loras( up_weight.shape, alpha, ) - weights = torch.nn.functional.conv2d(down_weight.permute(1, 0, 2, 3), up_weight).permute(1, 0, 2, 3) + weights = torch.nn.functional.conv2d( + down_weight.permute(1, 0, 2, 3), up_weight + ).permute(1, 0, 2, 3) np_weights = weights.numpy() * (alpha / dim) else: logger.warning( diff --git a/api/onnx_web/logging.py b/api/onnx_web/logging.py index 8e924058..fa0e5227 100644 --- a/api/onnx_web/logging.py +++ b/api/onnx_web/logging.py @@ -38,11 +38,11 @@ def addLoggingLevel(levelName, levelNum, methodName=None): methodName = levelName.lower() if hasattr(logging, levelName): - raise AttributeError('{} already defined in logging module'.format(levelName)) + raise AttributeError("{} already defined in logging module".format(levelName)) if hasattr(logging, methodName): - raise AttributeError('{} already defined in logging module'.format(methodName)) + raise AttributeError("{} already defined in logging module".format(methodName)) if hasattr(logging.getLoggerClass(), methodName): - raise AttributeError('{} already defined in logger class'.format(methodName)) + raise AttributeError("{} already defined in logger class".format(methodName)) # This method was inspired by the answers to Stack Overflow post # http://stackoverflow.com/q/2183233/2988730, especially @@ -50,6 +50,7 @@ def addLoggingLevel(levelName, levelNum, methodName=None): def logForLevel(self, message, *args, **kwargs): if self.isEnabledFor(levelNum): self._log(levelNum, message, args, **kwargs) + def logToRoot(message, *args, **kwargs): logging.log(levelNum, message, *args, **kwargs) @@ -65,6 +66,6 @@ try: with open(logging_path, "r") as f: config_logging = safe_load(f) dictConfig(config_logging) - addLoggingLevel('TRACE', logging.DEBUG - 5) + addLoggingLevel("TRACE", logging.DEBUG - 5) except Exception as err: print("error loading logging config: %s" % (err))