__init__.py 581 B

1234567891011121314151617
  1. import math
  2. from methods.abstractdiffusion import TiledDiffusion
  3. from methods.multidiffusion import MultiDiffusion
  4. from methods.mixtureofdiffusers import MixtureOfDiffusers
  5. def splitable(w, h, tile_w, tile_h, overlap):
  6. w, h = w//8, h//8
  7. min_tile_size = min(tile_w, tile_h)
  8. if overlap >= min_tile_size:
  9. overlap = min_tile_size - 4
  10. non_overlap_width = tile_w - overlap
  11. non_overlap_height = tile_h - overlap
  12. cols = math.ceil((w - overlap) / non_overlap_width)
  13. rows = math.ceil((h - overlap) / non_overlap_height)
  14. return cols > 1 or rows > 1