Add toggle
This commit is contained in:
+15
-7
@@ -1,20 +1,28 @@
|
||||
class TileModel:
|
||||
class SeamlessTile:
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
return {"required":
|
||||
{"model": ("MODEL",)},
|
||||
{"model": ("MODEL",),
|
||||
"tiling": (["enable", "disable"],),
|
||||
},
|
||||
}
|
||||
|
||||
CATEGORY = "conditioning"
|
||||
|
||||
RETURN_TYPES = ("MODEL",)
|
||||
FUNCTION = "run"
|
||||
def run(self, model):
|
||||
make_circular(model.model)
|
||||
def run(self, model, tiling):
|
||||
if tiling == "enable":
|
||||
modify(model.model, circular=True)
|
||||
else:
|
||||
modify(model.model, circular=False)
|
||||
return (model,)
|
||||
|
||||
def make_circular(m):
|
||||
def modify(m, circular=True):
|
||||
for child in m.children():
|
||||
if "Conv2d" in str(type(child)):
|
||||
child.padding_mode = "circular"
|
||||
make_circular(child)
|
||||
if circular:
|
||||
child.padding_mode = "circular"
|
||||
else:
|
||||
child.padding_mode = "zeros"
|
||||
modify(child, circular)
|
||||
Reference in New Issue
Block a user