Commit da5dc4d0 authored by gd1551's avatar gd1551 Committed by GitHub

feat: add noise parameter

parent 641e39ea
......@@ -223,7 +223,7 @@ class StableDiffusionModel(nn.Module):
print("init latent shape:")
print(init_latent.shape)
init_latent = init_latent + (torch.randn_like(init_latent) * 0.667)
init_latent = init_latent + (torch.randn_like(init_latent) * request.noise)
uc = None
if request.scale != 1.0:
......
......@@ -62,6 +62,9 @@ def sanitize_stable_diffusion(request):
if request.strength < 0.0 or request.strength > 1.0:
return False, "strength should be more than 0.0 and less than 1.0"
if request.noise < 0.0 or request.noise > 1.0:
return False, "noise should be more than 0.0 and less than 1.0"
return True, request
def sanitize_dalle_mini(request):
......
......@@ -69,6 +69,7 @@ class GenerationRequest(BaseModel):
grid_size: int = 4
advanced: bool = False
strength: float = 0.69
noise: float = 0.667
class GenerationOutput(BaseModel):
output: List[str]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment