diff --git a/README.md b/README.md index c5f12a5..ce0fa4f 100644 --- a/README.md +++ b/README.md @@ -49,7 +49,7 @@ display(image) ``` min-dalle -If the model is being used interactively (e.g. in a notebook) `generate_image_stream` can be used to generate a stream of images as it the model is decoding. The detokenizer adds a slight delay for each intermediate image. Setting `log2_mid_count` to 3 results in a total of `2 ** 3 = 8` generated images. The only valid values for `log2_mid_count` are 0, 1, 2, 3, 4. +If the model is being used interactively (e.g. in a notebook) `generate_image_stream` can be used to generate a stream of images as the model is decoding. The detokenizer adds a slight delay for each image. Setting `log2_mid_count` to 3 results in a total of `2 ** 3 = 8` generated images. The only valid values for `log2_mid_count` are 0, 1, 2, 3, 4. ```python image_stream = model.generate_image_stream( diff --git a/min_dalle/min_dalle.py b/min_dalle/min_dalle.py index 76b2bd1..3f23878 100644 --- a/min_dalle/min_dalle.py +++ b/min_dalle/min_dalle.py @@ -168,6 +168,7 @@ class MinDalle: log2_supercondition_factor: int = 3, is_verbose: bool = False ) -> Iterator[Image.Image]: + assert(log2_mid_count in range(5)) if is_verbose: print("tokenizing text") tokens = self.tokenizer.tokenize(text, is_verbose=is_verbose) if is_verbose: print("text tokens", tokens)