Skip to content

Commit 1422b35

Browse files
authored
Tiling parameter (#911)
* tiling * default to False
1 parent 4d76d67 commit 1422b35

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

scripts/relauncher.py

+4
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
# Creates a public xxxxx.gradio.app share link to allow others to use your interface (requires properly forwarded ports to work correctly)
2020
share = False
2121

22+
# Generate tiling images
23+
tiling = False
2224

2325
# Enter other `--arguments` you wish to use - Must be entered as a `--argument ` syntax
2426
additional_arguments = ""
@@ -37,6 +39,8 @@
3739
common_arguments += "--optimized-turbo "
3840
if optimized == True:
3941
common_arguments += "--optimized "
42+
if tiling == True:
43+
common_arguments += "--tiling "
4044
if share == True:
4145
common_arguments += "--share "
4246

scripts/webui.py

+13
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
parser.add_argument("--skip-save", action='store_true', help="do not save indiviual samples. For speed measurements.", default=False)
4646
parser.add_argument('--no-job-manager', action='store_true', help="Don't use the experimental job manager on top of gradio", default=False)
4747
parser.add_argument("--max-jobs", type=int, help="Maximum number of concurrent 'generate' commands", default=1)
48+
parser.add_argument("--tiling", action='store_true', help="Generate tiling images", default=False)
4849
opt = parser.parse_args()
4950

5051
#Should not be needed anymore
@@ -87,6 +88,18 @@
8788
from ldm.models.diffusion.plms import PLMSSampler
8889
from ldm.util import instantiate_from_config
8990

91+
# add global options to models
92+
def patch_conv(**patch):
93+
cls = torch.nn.Conv2d
94+
init = cls.__init__
95+
def __init__(self, *args, **kwargs):
96+
return init(self, *args, **kwargs, **patch)
97+
cls.__init__ = __init__
98+
99+
if opt.tiling:
100+
patch_conv(padding_mode='circular')
101+
print("patched for tiling")
102+
90103
try:
91104
# this silences the annoying "Some weights of the model checkpoint were not used when initializing..." message at start.
92105

0 commit comments

Comments
 (0)