diff --git a/more_math/BatchLoraNode.py b/more_math/BatchLoraNode.py index 236034e..9c3d682 100644 --- a/more_math/BatchLoraNode.py +++ b/more_math/BatchLoraNode.py @@ -1,4 +1,3 @@ -from email.mime import base from comfy_api.latest import io import folder_paths diff --git a/more_math/LatentMathNode.py b/more_math/LatentMathNode.py index a6a4c18..ee97a2c 100644 --- a/more_math/LatentMathNode.py +++ b/more_math/LatentMathNode.py @@ -16,7 +16,6 @@ from .helper_functions import ( from .Parser.UnifiedMathVisitor import UnifiedMathVisitor import comfy import torch -from comfy.nested_tensor import NestedTensor from .Stack import MrmthStack from .ParseTree import MrmthParseTree import copy diff --git a/more_math/Parser/grammer/MathExprParser.py b/more_math/Parser/grammer/MathExprParser.py index 9720e5a..e3ff4ea 100644 --- a/more_math/Parser/grammer/MathExprParser.py +++ b/more_math/Parser/grammer/MathExprParser.py @@ -1740,7 +1740,7 @@ class MathExprParser ( Parser ): self.stmt() pass - + self.state = 79 self._errHandler.sync(self) _alt = self._interp.adaptivePredict(self._input,1,self._ctx) @@ -1777,7 +1777,7 @@ class MathExprParser ( Parser ): def getRuleIndex(self): return MathExprParser.RULE_funcDef - + def copyFrom(self, ctx:ParserRuleContext): super().copyFrom(ctx) @@ -2085,7 +2085,7 @@ class MathExprParser ( Parser ): def getRuleIndex(self): return MathExprParser.RULE_stmt - + def copyFrom(self, ctx:ParserRuleContext): super().copyFrom(ctx) @@ -3120,7 +3120,7 @@ class MathExprParser ( Parser ): def getRuleIndex(self): return MathExprParser.RULE_lambdaExpr - + def copyFrom(self, ctx:ParserRuleContext): super().copyFrom(ctx) @@ -3213,7 +3213,7 @@ class MathExprParser ( Parser ): def getRuleIndex(self): return MathExprParser.RULE_ternaryExpr - + def copyFrom(self, ctx:ParserRuleContext): super().copyFrom(ctx) @@ -3292,7 +3292,7 @@ class MathExprParser ( Parser ): def getRuleIndex(self): return MathExprParser.RULE_compExpr - + def copyFrom(self, ctx:ParserRuleContext): super().copyFrom(ctx) @@ -3436,7 +3436,7 @@ class MathExprParser ( Parser ): self.relationalExpr(0) pass - + self.state = 236 self._errHandler.sync(self) _alt = self._interp.adaptivePredict(self._input,17,self._ctx) @@ -3461,7 +3461,7 @@ class MathExprParser ( Parser ): def getRuleIndex(self): return MathExprParser.RULE_relationalExpr - + def copyFrom(self, ctx:ParserRuleContext): super().copyFrom(ctx) @@ -3691,7 +3691,7 @@ class MathExprParser ( Parser ): self.shiftExpr(0) pass - + self.state = 256 self._errHandler.sync(self) _alt = self._interp.adaptivePredict(self._input,19,self._ctx) @@ -3716,7 +3716,7 @@ class MathExprParser ( Parser ): def getRuleIndex(self): return MathExprParser.RULE_addExpr - + def copyFrom(self, ctx:ParserRuleContext): super().copyFrom(ctx) @@ -3860,7 +3860,7 @@ class MathExprParser ( Parser ): self.mulExpr(0) pass - + self.state = 270 self._errHandler.sync(self) _alt = self._interp.adaptivePredict(self._input,21,self._ctx) @@ -3885,7 +3885,7 @@ class MathExprParser ( Parser ): def getRuleIndex(self): return MathExprParser.RULE_mulExpr - + def copyFrom(self, ctx:ParserRuleContext): super().copyFrom(ctx) @@ -4072,7 +4072,7 @@ class MathExprParser ( Parser ): self.powExpr() pass - + self.state = 287 self._errHandler.sync(self) _alt = self._interp.adaptivePredict(self._input,23,self._ctx) @@ -4097,7 +4097,7 @@ class MathExprParser ( Parser ): def getRuleIndex(self): return MathExprParser.RULE_shiftExpr - + def copyFrom(self, ctx:ParserRuleContext): super().copyFrom(ctx) @@ -4241,7 +4241,7 @@ class MathExprParser ( Parser ): self.addExpr(0) pass - + self.state = 301 self._errHandler.sync(self) _alt = self._interp.adaptivePredict(self._input,25,self._ctx) @@ -4266,7 +4266,7 @@ class MathExprParser ( Parser ): def getRuleIndex(self): return MathExprParser.RULE_powExpr - + def copyFrom(self, ctx:ParserRuleContext): super().copyFrom(ctx) @@ -4375,7 +4375,7 @@ class MathExprParser ( Parser ): def getRuleIndex(self): return MathExprParser.RULE_unaryExpr - + def copyFrom(self, ctx:ParserRuleContext): super().copyFrom(ctx) @@ -4514,7 +4514,7 @@ class MathExprParser ( Parser ): def getRuleIndex(self): return MathExprParser.RULE_indexExpr - + def copyFrom(self, ctx:ParserRuleContext): super().copyFrom(ctx) @@ -4658,7 +4658,7 @@ class MathExprParser ( Parser ): def getRuleIndex(self): return MathExprParser.RULE_sliceElement - + def copyFrom(self, ctx:ParserRuleContext): super().copyFrom(ctx) @@ -5051,7 +5051,7 @@ class MathExprParser ( Parser ): def getRuleIndex(self): return MathExprParser.RULE_atom - + def copyFrom(self, ctx:ParserRuleContext): super().copyFrom(ctx) @@ -5879,7 +5879,7 @@ class MathExprParser ( Parser ): def getRuleIndex(self): return MathExprParser.RULE_func0 - + def copyFrom(self, ctx:ParserRuleContext): super().copyFrom(ctx) @@ -5947,7 +5947,7 @@ class MathExprParser ( Parser ): def getRuleIndex(self): return MathExprParser.RULE_func1 - + def copyFrom(self, ctx:ParserRuleContext): super().copyFrom(ctx) @@ -10980,7 +10980,7 @@ class MathExprParser ( Parser ): def getRuleIndex(self): return MathExprParser.RULE_func2 - + def copyFrom(self, ctx:ParserRuleContext): super().copyFrom(ctx) @@ -15284,7 +15284,7 @@ class MathExprParser ( Parser ): def getRuleIndex(self): return MathExprParser.RULE_func3 - + def copyFrom(self, ctx:ParserRuleContext): super().copyFrom(ctx) @@ -17621,7 +17621,7 @@ class MathExprParser ( Parser ): def getRuleIndex(self): return MathExprParser.RULE_func4 - + def copyFrom(self, ctx:ParserRuleContext): super().copyFrom(ctx) @@ -17974,7 +17974,7 @@ class MathExprParser ( Parser ): def getRuleIndex(self): return MathExprParser.RULE_func5 - + def copyFrom(self, ctx:ParserRuleContext): super().copyFrom(ctx) @@ -18165,7 +18165,7 @@ class MathExprParser ( Parser ): def getRuleIndex(self): return MathExprParser.RULE_funcN - + def copyFrom(self, ctx:ParserRuleContext): super().copyFrom(ctx) @@ -19346,7 +19346,7 @@ class MathExprParser ( Parser ): def getRuleIndex(self): return MathExprParser.RULE_funcNoise - + def copyFrom(self, ctx:ParserRuleContext): super().copyFrom(ctx) @@ -20876,64 +20876,64 @@ class MathExprParser ( Parser ): def compExpr_sempred(self, localctx:CompExprContext, predIndex:int): if predIndex == 0: return self.precpred(self._ctx, 3) - + if predIndex == 1: return self.precpred(self._ctx, 2) - + def relationalExpr_sempred(self, localctx:RelationalExprContext, predIndex:int): if predIndex == 2: return self.precpred(self._ctx, 5) - + if predIndex == 3: return self.precpred(self._ctx, 4) - + if predIndex == 4: return self.precpred(self._ctx, 3) - + if predIndex == 5: return self.precpred(self._ctx, 2) - + def addExpr_sempred(self, localctx:AddExprContext, predIndex:int): if predIndex == 6: return self.precpred(self._ctx, 3) - + if predIndex == 7: return self.precpred(self._ctx, 2) - + def mulExpr_sempred(self, localctx:MulExprContext, predIndex:int): if predIndex == 8: return self.precpred(self._ctx, 4) - + if predIndex == 9: return self.precpred(self._ctx, 3) - + if predIndex == 10: return self.precpred(self._ctx, 2) - + def shiftExpr_sempred(self, localctx:ShiftExprContext, predIndex:int): if predIndex == 11: return self.precpred(self._ctx, 3) - + if predIndex == 12: return self.precpred(self._ctx, 2) - + def indexExpr_sempred(self, localctx:IndexExprContext, predIndex:int): if predIndex == 13: return self.precpred(self._ctx, 2) - + diff --git a/more_math/Parser/legacy/MathExprParser.py b/more_math/Parser/legacy/MathExprParser.py index 06fc75b..719b737 100644 --- a/more_math/Parser/legacy/MathExprParser.py +++ b/more_math/Parser/legacy/MathExprParser.py @@ -2079,7 +2079,7 @@ class MathExprParser ( Parser ): self.stmt() pass - + self.state = 79 self._errHandler.sync(self) _alt = self._interp.adaptivePredict(self._input,1,self._ctx) @@ -2116,7 +2116,7 @@ class MathExprParser ( Parser ): def getRuleIndex(self): return MathExprParser.RULE_funcDef - + def copyFrom(self, ctx:ParserRuleContext): super().copyFrom(ctx) @@ -2424,7 +2424,7 @@ class MathExprParser ( Parser ): def getRuleIndex(self): return MathExprParser.RULE_stmt - + def copyFrom(self, ctx:ParserRuleContext): super().copyFrom(ctx) @@ -3459,7 +3459,7 @@ class MathExprParser ( Parser ): def getRuleIndex(self): return MathExprParser.RULE_lambdaExpr - + def copyFrom(self, ctx:ParserRuleContext): super().copyFrom(ctx) @@ -3552,7 +3552,7 @@ class MathExprParser ( Parser ): def getRuleIndex(self): return MathExprParser.RULE_ternaryExpr - + def copyFrom(self, ctx:ParserRuleContext): super().copyFrom(ctx) @@ -3631,7 +3631,7 @@ class MathExprParser ( Parser ): def getRuleIndex(self): return MathExprParser.RULE_compExpr - + def copyFrom(self, ctx:ParserRuleContext): super().copyFrom(ctx) @@ -3775,7 +3775,7 @@ class MathExprParser ( Parser ): self.relationalExpr(0) pass - + self.state = 236 self._errHandler.sync(self) _alt = self._interp.adaptivePredict(self._input,17,self._ctx) @@ -3800,7 +3800,7 @@ class MathExprParser ( Parser ): def getRuleIndex(self): return MathExprParser.RULE_relationalExpr - + def copyFrom(self, ctx:ParserRuleContext): super().copyFrom(ctx) @@ -4030,7 +4030,7 @@ class MathExprParser ( Parser ): self.shiftExpr(0) pass - + self.state = 256 self._errHandler.sync(self) _alt = self._interp.adaptivePredict(self._input,19,self._ctx) @@ -4055,7 +4055,7 @@ class MathExprParser ( Parser ): def getRuleIndex(self): return MathExprParser.RULE_addExpr - + def copyFrom(self, ctx:ParserRuleContext): super().copyFrom(ctx) @@ -4199,7 +4199,7 @@ class MathExprParser ( Parser ): self.mulExpr(0) pass - + self.state = 270 self._errHandler.sync(self) _alt = self._interp.adaptivePredict(self._input,21,self._ctx) @@ -4224,7 +4224,7 @@ class MathExprParser ( Parser ): def getRuleIndex(self): return MathExprParser.RULE_mulExpr - + def copyFrom(self, ctx:ParserRuleContext): super().copyFrom(ctx) @@ -4411,7 +4411,7 @@ class MathExprParser ( Parser ): self.powExpr() pass - + self.state = 287 self._errHandler.sync(self) _alt = self._interp.adaptivePredict(self._input,23,self._ctx) @@ -4436,7 +4436,7 @@ class MathExprParser ( Parser ): def getRuleIndex(self): return MathExprParser.RULE_shiftExpr - + def copyFrom(self, ctx:ParserRuleContext): super().copyFrom(ctx) @@ -4580,7 +4580,7 @@ class MathExprParser ( Parser ): self.addExpr(0) pass - + self.state = 301 self._errHandler.sync(self) _alt = self._interp.adaptivePredict(self._input,25,self._ctx) @@ -4605,7 +4605,7 @@ class MathExprParser ( Parser ): def getRuleIndex(self): return MathExprParser.RULE_powExpr - + def copyFrom(self, ctx:ParserRuleContext): super().copyFrom(ctx) @@ -4714,7 +4714,7 @@ class MathExprParser ( Parser ): def getRuleIndex(self): return MathExprParser.RULE_unaryExpr - + def copyFrom(self, ctx:ParserRuleContext): super().copyFrom(ctx) @@ -4853,7 +4853,7 @@ class MathExprParser ( Parser ): def getRuleIndex(self): return MathExprParser.RULE_indexExpr - + def copyFrom(self, ctx:ParserRuleContext): super().copyFrom(ctx) @@ -4997,7 +4997,7 @@ class MathExprParser ( Parser ): def getRuleIndex(self): return MathExprParser.RULE_sliceElement - + def copyFrom(self, ctx:ParserRuleContext): super().copyFrom(ctx) @@ -5390,7 +5390,7 @@ class MathExprParser ( Parser ): def getRuleIndex(self): return MathExprParser.RULE_atom - + def copyFrom(self, ctx:ParserRuleContext): super().copyFrom(ctx) @@ -6218,7 +6218,7 @@ class MathExprParser ( Parser ): def getRuleIndex(self): return MathExprParser.RULE_func0 - + def copyFrom(self, ctx:ParserRuleContext): super().copyFrom(ctx) @@ -6286,7 +6286,7 @@ class MathExprParser ( Parser ): def getRuleIndex(self): return MathExprParser.RULE_func1 - + def copyFrom(self, ctx:ParserRuleContext): super().copyFrom(ctx) @@ -11319,7 +11319,7 @@ class MathExprParser ( Parser ): def getRuleIndex(self): return MathExprParser.RULE_func2 - + def copyFrom(self, ctx:ParserRuleContext): super().copyFrom(ctx) @@ -15623,7 +15623,7 @@ class MathExprParser ( Parser ): def getRuleIndex(self): return MathExprParser.RULE_func3 - + def copyFrom(self, ctx:ParserRuleContext): super().copyFrom(ctx) @@ -17960,7 +17960,7 @@ class MathExprParser ( Parser ): def getRuleIndex(self): return MathExprParser.RULE_func4 - + def copyFrom(self, ctx:ParserRuleContext): super().copyFrom(ctx) @@ -18313,7 +18313,7 @@ class MathExprParser ( Parser ): def getRuleIndex(self): return MathExprParser.RULE_func5 - + def copyFrom(self, ctx:ParserRuleContext): super().copyFrom(ctx) @@ -18504,7 +18504,7 @@ class MathExprParser ( Parser ): def getRuleIndex(self): return MathExprParser.RULE_funcN - + def copyFrom(self, ctx:ParserRuleContext): super().copyFrom(ctx) @@ -19685,7 +19685,7 @@ class MathExprParser ( Parser ): def getRuleIndex(self): return MathExprParser.RULE_funcNoise - + def copyFrom(self, ctx:ParserRuleContext): super().copyFrom(ctx) @@ -21215,64 +21215,64 @@ class MathExprParser ( Parser ): def compExpr_sempred(self, localctx:CompExprContext, predIndex:int): if predIndex == 0: return self.precpred(self._ctx, 3) - + if predIndex == 1: return self.precpred(self._ctx, 2) - + def relationalExpr_sempred(self, localctx:RelationalExprContext, predIndex:int): if predIndex == 2: return self.precpred(self._ctx, 5) - + if predIndex == 3: return self.precpred(self._ctx, 4) - + if predIndex == 4: return self.precpred(self._ctx, 3) - + if predIndex == 5: return self.precpred(self._ctx, 2) - + def addExpr_sempred(self, localctx:AddExprContext, predIndex:int): if predIndex == 6: return self.precpred(self._ctx, 3) - + if predIndex == 7: return self.precpred(self._ctx, 2) - + def mulExpr_sempred(self, localctx:MulExprContext, predIndex:int): if predIndex == 8: return self.precpred(self._ctx, 4) - + if predIndex == 9: return self.precpred(self._ctx, 3) - + if predIndex == 10: return self.precpred(self._ctx, 2) - + def shiftExpr_sempred(self, localctx:ShiftExprContext, predIndex:int): if predIndex == 11: return self.precpred(self._ctx, 3) - + if predIndex == 12: return self.precpred(self._ctx, 2) - + def indexExpr_sempred(self, localctx:IndexExprContext, predIndex:int): if predIndex == 13: return self.precpred(self._ctx, 2) - + diff --git a/more_math/SelectiveGuiderMathNode.py b/more_math/SelectiveGuiderMathNode.py index 52b7f15..13e7cff 100644 --- a/more_math/SelectiveGuiderMathNode.py +++ b/more_math/SelectiveGuiderMathNode.py @@ -748,6 +748,6 @@ class SelectiveGuiderMathNode(io.ComfyNode): dbg(f"HOOK SUMMARY ITEM {item}") return result - + def tensor_shape(x): return list(x.shape) if isinstance(x, torch.Tensor) else [] \ No newline at end of file diff --git a/more_math/modelLikeCommon.py b/more_math/modelLikeCommon.py index 804a087..ffc202c 100644 --- a/more_math/modelLikeCommon.py +++ b/more_math/modelLikeCommon.py @@ -288,7 +288,7 @@ def calculate_patches_autogrow(Expr, V, F, pbar=None, mapping=None, stack=None, # In autogrow mode, expression must return a single tensor (patch for this key) # If a dict is returned, that's an error - use dict_mode instead if isinstance(res, dict) and not isinstance(res, torch.Tensor): - raise ValueError(f"Autogrow mode expects tensor output, got dict. Use dict_mode=True for dict output.") + raise ValueError("Autogrow mode expects tensor output, got dict. Use dict_mode=True for dict output.") res = as_tensor(res, ref_tensor.shape)