Bug Fixes

This commit is contained in:
Jaret Burkett
2024-05-17 08:41:20 -06:00
parent 5a45c709cd
commit 68b7e159bc
4 changed files with 12 additions and 4 deletions

View File

@@ -1086,6 +1086,7 @@ class SDTrainer(BaseSDTrainProcess):
is_training=True,
has_been_preprocessed=True,
quad_count=quad_count,
batch_size=noisy_latents.shape[0]
)
with self.timer('encode_prompt'):

View File

@@ -705,10 +705,11 @@ class CustomAdapter(torch.nn.Module):
is_training=False,
has_been_preprocessed=False,
quad_count=4,
batch_size=1,
) -> PromptEmbeds:
if self.adapter_type == 'ilora' or self.adapter_type == 'vision_direct' or self.adapter_type == 'te_augmenter':
if tensors_0_1 is None:
tensors_0_1 = self.get_empty_clip_image(1)
tensors_0_1 = self.get_empty_clip_image(batch_size)
has_been_preprocessed = True
with torch.no_grad():

View File

@@ -78,7 +78,13 @@ class InstantLoRAMidModule(torch.nn.Module):
raise e
# apply tanh to limit values to -1 to 1
# scaler = torch.tanh(scaler)
return x * scaler
try:
return x * scaler
except Exception as e:
print(e)
print(x.shape)
print(scaler.shape)
raise e
class InstantLoRAModule(torch.nn.Module):

View File

@@ -39,7 +39,7 @@ from toolkit.pipelines import CustomStableDiffusionXLPipeline, CustomStableDiffu
StableDiffusionKDiffusionXLPipeline, StableDiffusionXLRefinerPipeline
from diffusers import StableDiffusionPipeline, StableDiffusionXLPipeline, T2IAdapter, DDPMScheduler, \
StableDiffusionXLAdapterPipeline, StableDiffusionAdapterPipeline, DiffusionPipeline, \
StableDiffusionXLImg2ImgPipeline, LCMScheduler, Transformer2DModel, AutoencoderTiny
StableDiffusionXLImg2ImgPipeline, LCMScheduler, Transformer2DModel, AutoencoderTiny, ControlNetModel
import diffusers
from diffusers import \
AutoencoderKL, \
@@ -142,7 +142,7 @@ class StableDiffusion:
# to hold network if there is one
self.network = None
self.adapter: Union['T2IAdapter', 'IPAdapter', 'ReferenceAdapter', None] = None
self.adapter: Union['ControlNetModel', 'T2IAdapter', 'IPAdapter', 'ReferenceAdapter', None] = None
self.is_xl = model_config.is_xl
self.is_v2 = model_config.is_v2
self.is_ssd = model_config.is_ssd