Commit 847474c9 authored by kurumuz's avatar kurumuz

seed for stage 2

parent bbcb482d
...@@ -316,6 +316,10 @@ class StableDiffusionModel(nn.Module): ...@@ -316,6 +316,10 @@ class StableDiffusionModel(nn.Module):
x_samples_ddim = torch.clamp((x_samples_ddim + 1.0) / 2.0, min=0.0, max=1.0).squeeze(0) x_samples_ddim = torch.clamp((x_samples_ddim + 1.0) / 2.0, min=0.0, max=1.0).squeeze(0)
x_samples_ddim = pil_upscale(x_samples_ddim, scale=2) x_samples_ddim = pil_upscale(x_samples_ddim, scale=2)
if request.stage_two_seed is not None:
torch.manual_seed(request.stage_two_seed)
np.random.seed(request.stage_two_seed)
with torch.autocast("cuda", enabled=self.config.amp): with torch.autocast("cuda", enabled=self.config.amp):
with self.model.ema_scope(): with self.model.ema_scope():
init_latent = self.model.get_first_stage_encoding(self.model.encode_first_stage(x_samples_ddim)) init_latent = self.model.get_first_stage_encoding(self.model.encode_first_stage(x_samples_ddim))
......
...@@ -18,6 +18,7 @@ v1pp_defaults = { ...@@ -18,6 +18,7 @@ v1pp_defaults = {
'scale': 7.0, 'scale': 7.0,
'dynamic_threshold': None, 'dynamic_threshold': None,
'seed': None, 'seed': None,
'stage_two_seed': None,
} }
v1pp_forced_defaults = { v1pp_forced_defaults = {
......
...@@ -71,6 +71,7 @@ class GenerationRequest(BaseModel): ...@@ -71,6 +71,7 @@ class GenerationRequest(BaseModel):
top_k: int = 256 top_k: int = 256
grid_size: int = 4 grid_size: int = 4
advanced: bool = False advanced: bool = False
stage_two_seed: int = None
strength: float = 0.69 strength: float = 0.69
noise: float = 0.667 noise: float = 0.667
......
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