setting dimensions
This commit is contained in:
parent
40ee8700ad
commit
92554c42ab
|
@ -52,7 +52,6 @@ class DiffusersHolder():
|
||||||
self.width_latent = self.pipe.unet.config.sample_size
|
self.width_latent = self.pipe.unet.config.sample_size
|
||||||
self.height_latent = self.pipe.unet.config.sample_size
|
self.height_latent = self.pipe.unet.config.sample_size
|
||||||
|
|
||||||
|
|
||||||
def init_types(self):
|
def init_types(self):
|
||||||
assert hasattr(self.pipe, "__class__"), "No valid diffusers pipeline found."
|
assert hasattr(self.pipe, "__class__"), "No valid diffusers pipeline found."
|
||||||
assert hasattr(self.pipe.__class__, "__name__"), "No valid diffusers pipeline found."
|
assert hasattr(self.pipe.__class__, "__name__"), "No valid diffusers pipeline found."
|
||||||
|
@ -65,14 +64,13 @@ class DiffusersHolder():
|
||||||
prompt_embeds = self.pipe._encode_prompt("test", self.device, 1, True)
|
prompt_embeds = self.pipe._encode_prompt("test", self.device, 1, True)
|
||||||
self.dtype = prompt_embeds.dtype
|
self.dtype = prompt_embeds.dtype
|
||||||
|
|
||||||
|
|
||||||
def set_num_inference_steps(self, num_inference_steps):
|
def set_num_inference_steps(self, num_inference_steps):
|
||||||
self.num_inference_steps = num_inference_steps
|
self.num_inference_steps = num_inference_steps
|
||||||
if self.use_sd_xl:
|
if self.use_sd_xl:
|
||||||
self.pipe.scheduler.set_timesteps(self.num_inference_steps, device=self.device)
|
self.pipe.scheduler.set_timesteps(self.num_inference_steps, device=self.device)
|
||||||
|
|
||||||
|
def set_dimensions(self, size_output):
|
||||||
def set_dimensions(self, width, height):
|
width, height = size_output
|
||||||
s = self.pipe.vae_scale_factor
|
s = self.pipe.vae_scale_factor
|
||||||
if width is None:
|
if width is None:
|
||||||
self.width_latent = self.pipe.unet.config.sample_size
|
self.width_latent = self.pipe.unet.config.sample_size
|
||||||
|
@ -87,7 +85,7 @@ class DiffusersHolder():
|
||||||
else:
|
else:
|
||||||
self.height_img = int(round(height / s) * s)
|
self.height_img = int(round(height / s) * s)
|
||||||
self.height_latent = int(self.height_img / s)
|
self.height_latent = int(self.height_img / s)
|
||||||
|
print(f"set_dimensions to width={width} and height={height}")
|
||||||
|
|
||||||
def set_negative_prompt(self, negative_prompt):
|
def set_negative_prompt(self, negative_prompt):
|
||||||
r"""Set the negative prompt. Currenty only one negative prompt is supported
|
r"""Set the negative prompt. Currenty only one negative prompt is supported
|
||||||
|
@ -503,19 +501,6 @@ class DiffusersHolder():
|
||||||
else:
|
else:
|
||||||
return list_latents_out
|
return list_latents_out
|
||||||
|
|
||||||
#%%
|
|
||||||
|
|
||||||
"""
|
|
||||||
steps:
|
|
||||||
x get controlnet vanilla running.
|
|
||||||
- externalize conditions
|
|
||||||
- have conditions as input (use one list)
|
|
||||||
- include latent blending
|
|
||||||
- test latent blending
|
|
||||||
- have lora and latent blending
|
|
||||||
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#%%
|
#%%
|
||||||
|
@ -544,21 +529,3 @@ if __name__ == "__main__":
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# %%
|
|
||||||
|
|
||||||
"""
|
|
||||||
OPEN
|
|
||||||
- rename text encodings to conditionings
|
|
||||||
- other examples
|
|
||||||
- kill upscaling? or keep?
|
|
||||||
- cleanup
|
|
||||||
- ldh
|
|
||||||
- sdh class
|
|
||||||
- diffusion holder
|
|
||||||
- check linting
|
|
||||||
- check docstrings
|
|
||||||
- fix readme
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -111,11 +111,15 @@ class LatentBlending():
|
||||||
self.set_prompt1("")
|
self.set_prompt1("")
|
||||||
self.set_prompt2("")
|
self.set_prompt2("")
|
||||||
|
|
||||||
|
def set_dimensions(self, size_output=None):
|
||||||
def set_dimensions(self, width=None, height=None):
|
r"""
|
||||||
self.dh.set_dimensions(width, height)
|
sets the size of the output video.
|
||||||
|
Args:
|
||||||
|
size_output: tuple
|
||||||
|
width x height
|
||||||
|
Note: the size will get automatically adjusted to be divisable by 32.
|
||||||
|
"""
|
||||||
|
self.dh.set_dimensions(size_output)
|
||||||
|
|
||||||
def set_guidance_scale(self, guidance_scale):
|
def set_guidance_scale(self, guidance_scale):
|
||||||
r"""
|
r"""
|
||||||
|
|
Loading…
Reference in New Issue