log2_mid_count

This commit is contained in:
Brett Kuprel 2022-07-04 17:27:23 -04:00
parent 059d8f3448
commit 1702d3c439
3 changed files with 7 additions and 7 deletions

View File

@ -55,7 +55,7 @@ def generate_image(
image_tokens = model.generate_image_tokens(
text,
seed,
grid_size ** 2,
grid_size ** 2,
row_count,
is_verbose=True
)

View File

@ -165,7 +165,7 @@ class MinDalle:
seed: int,
grid_size: int,
row_count: int,
mid_count: int = None,
log2_mid_count: int = 0,
handle_intermediate_image: Callable[[int, Image.Image], None] = None,
is_verbose: bool = False
) -> LongTensor:
@ -206,8 +206,8 @@ class MinDalle:
attention_state,
image_tokens
)
if mid_count is not None:
if ((row_index + 1) * mid_count) % row_count == 0:
if handle_intermediate_image is not None:
if ((row_index + 1) * (2 ** log2_mid_count)) % row_count == 0:
tokens = image_tokens[:, 1:]
image = self.image_from_tokens(grid_size, tokens, is_verbose)
handle_intermediate_image(row_index, image)
@ -220,7 +220,7 @@ class MinDalle:
text: str,
seed: int = -1,
grid_size: int = 1,
mid_count: int = None,
log2_mid_count: int = None,
handle_intermediate_image: Callable[[Image.Image], None] = None,
is_verbose: bool = False
) -> Image.Image:
@ -229,7 +229,7 @@ class MinDalle:
seed,
grid_size,
row_count = 16,
mid_count = mid_count,
log2_mid_count = log2_mid_count,
handle_intermediate_image = handle_intermediate_image,
is_verbose = is_verbose
)

View File

@ -5,7 +5,7 @@ setuptools.setup(
name='min-dalle',
description = 'min(DALL·E)',
long_description=(Path(__file__).parent / "README.rst").read_text(),
version='0.2.21',
version='0.2.22',
author='Brett Kuprel',
author_email='brkuprel@gmail.com',
url='https://github.com/kuprel/min-dalle',