mirror of
https://github.com/vladmandic/automatic
synced 2026-09-19 17:24:32 +02:00
cleanup
This commit is contained in:
@@ -351,11 +351,10 @@ def validate_sample(tensor):
|
||||
cast = sample.astype(np.uint8)
|
||||
if len(w) > 0:
|
||||
nans = np.isnan(sample).sum()
|
||||
shared.log.error(f'Failed to validate samples: sample={sample.shape} invalid={nans}')
|
||||
cast = np.nan_to_num(sample)
|
||||
minimum, maximum, mean = np.min(cast), np.max(cast), np.mean(cast)
|
||||
cast = cast.astype(np.uint8)
|
||||
shared.log.warning(f'Attempted to correct samples: min={minimum:.2f} max={maximum:.2f} mean={mean:.2f}')
|
||||
shared.log.error(f'Failed to validate samples: sample={sample.shape} min={minimum:.2f} max={maximum:.2f} mean={mean:.2f} invalid={nans}')
|
||||
return cast
|
||||
|
||||
|
||||
|
||||
@@ -1296,8 +1296,7 @@ def switch_pipe(cls: diffusers.DiffusionPipeline, pipeline: diffusers.DiffusionP
|
||||
|
||||
|
||||
def clean_diffuser_pipe(pipe):
|
||||
n = getattr(pipe.__class__, '__name__', '')
|
||||
if 'StableDiffusionXL' in n and 'requires_aesthetics_score' in pipe.config and hasattr(pipe, '_internal_dict'):
|
||||
if pipe is not None and shared.sd_model_type == 'sdxl' and 'requires_aesthetics_score' in pipe.config and hasattr(pipe, '_internal_dict'):
|
||||
# diffusers adds requires_aesthetics_score with img2img and complains if requires_aesthetics_score exist in txt2img
|
||||
internal_dict = dict(pipe._internal_dict) # pylint: disable=protected-access
|
||||
internal_dict.pop('requires_aesthetics_score', None)
|
||||
|
||||
Reference in New Issue
Block a user