File tree Expand file tree Collapse file tree 4 files changed +25
-16
lines changed Expand file tree Collapse file tree 4 files changed +25
-16
lines changed Original file line number Diff line number Diff line change @@ -179,13 +179,15 @@ def check_user_config(self):
179
179
f"{ self .NAME } does not support fp8-quanto. Please use fp8-torchao or int8 precision level instead."
180
180
)
181
181
t5_max_length = 120
182
- if (
183
- self .config .tokenizer_max_length is None
184
- or int (self .config .tokenizer_max_length ) > t5_max_length
185
- ):
182
+ if self .config .tokenizer_max_length is None or self .config .tokenizer_max_length == 0 :
183
+ logger .warning (
184
+ f"Setting T5 XXL tokeniser max length to { t5_max_length } for { self .NAME } ."
185
+ )
186
+ self .config .tokenizer_max_length = t5_max_length
187
+ if int (self .config .tokenizer_max_length ) > t5_max_length :
186
188
if not self .config .i_know_what_i_am_doing :
187
189
logger .warning (
188
- f"Updating T5 XXL tokeniser max length to { t5_max_length } for { self .NAME } ."
190
+ f"Overriding T5 XXL tokeniser max length to { t5_max_length } for { self .NAME } because `--i_know_what_i_am_doing` has not been set ."
189
191
)
190
192
self .config .tokenizer_max_length = t5_max_length
191
193
else :
Original file line number Diff line number Diff line change @@ -658,7 +658,7 @@ def encode_prompt(
658
658
negative_prompt_embeds : Optional [torch .Tensor ] = None ,
659
659
prompt_attention_mask : Optional [torch .Tensor ] = None ,
660
660
negative_prompt_attention_mask : Optional [torch .Tensor ] = None ,
661
- max_sequence_length : int = 256 ,
661
+ max_sequence_length : int = 120 ,
662
662
lora_scale : Optional [float ] = None ,
663
663
):
664
664
r"""
Original file line number Diff line number Diff line change @@ -306,14 +306,15 @@ def check_user_config(self):
306
306
raise ValueError (
307
307
f"{ self .NAME } does not support fp8-quanto. Please use fp8-torchao or int8 precision level instead."
308
308
)
309
- t5_max_length = 128
310
- if (
311
- self .config .tokenizer_max_length is None
312
- or int (self .config .tokenizer_max_length ) > t5_max_length
313
- ):
309
+ if self .config .tokenizer_max_length is None or self .config .tokenizer_max_length == 0 :
310
+ logger .warning (
311
+ f"Setting T5 XXL tokeniser max length to { t5_max_length } for { self .NAME } ."
312
+ )
313
+ self .config .tokenizer_max_length = t5_max_length
314
+ if int (self .config .tokenizer_max_length ) > t5_max_length :
314
315
if not self .config .i_know_what_i_am_doing :
315
316
logger .warning (
316
- f"Updating T5 XXL tokeniser max length to { t5_max_length } for { self .NAME } ."
317
+ f"Overriding T5 XXL tokeniser max length to { t5_max_length } for { self .NAME } because `--i_know_what_i_am_doing` has not been set ."
317
318
)
318
319
self .config .tokenizer_max_length = t5_max_length
319
320
else :
Original file line number Diff line number Diff line change @@ -944,7 +944,7 @@ def validate_prompt(
944
944
):
945
945
"""Generate validation images for a single prompt."""
946
946
# Placeholder for actual image generation and logging
947
- logger .debug (f"Validating prompt: { prompt } " )
947
+ logger .debug (f"Validating ( { validation_shortname } ) prompt: { prompt } " )
948
948
# benchmarked / stitched validation images
949
949
stitched_validation_images = {}
950
950
# untouched / un-stitched validation images
@@ -1179,9 +1179,15 @@ def validate_prompt(
1179
1179
validation_image_results
1180
1180
)
1181
1181
if self .config .use_ema :
1182
- ema_validation_images [validation_shortname ].extend (
1183
- ema_image_results
1184
- )
1182
+ if validation_shortname in ema_validation_images and ema_image_results is not None :
1183
+ if ema_validation_images [validation_shortname ] is None :
1184
+ # init the value
1185
+ ema_validation_images [validation_shortname ] = []
1186
+ if isinstance (ema_validation_images [validation_shortname ], list ):
1187
+ # if we have a list of images, we can stitch them.
1188
+ ema_validation_images [validation_shortname ].extend (
1189
+ ema_image_results
1190
+ )
1185
1191
1186
1192
except Exception as e :
1187
1193
import traceback
You can’t perform that action at this time.
0 commit comments