Efficiency Nodes V2.0

This commit is contained in:
TSC
2023-10-20 15:49:32 -05:00
committed by GitHub
parent 749c42b69b
commit 93eb925686
41 changed files with 5013 additions and 888 deletions

16
py/cg_mixed_seed_noise.py Normal file
View File

@@ -0,0 +1,16 @@
# https://github.com/chrisgoringe/cg-noise
import torch
def get_mixed_noise_function(original_noise_function, variation_seed, variation_weight):
def prepare_mixed_noise(latent_image:torch.Tensor, seed, batch_inds):
single_image_latent = latent_image[0].unsqueeze_(0)
different_noise = original_noise_function(single_image_latent, variation_seed, batch_inds)
original_noise = original_noise_function(single_image_latent, seed, batch_inds)
if latent_image.shape[0]==1:
mixed_noise = original_noise * (1.0-variation_weight) + different_noise * (variation_weight)
else:
mixed_noise = torch.empty_like(latent_image)
for i in range(latent_image.shape[0]):
mixed_noise[i] = original_noise * (1.0-variation_weight*i) + different_noise * (variation_weight*i)
return mixed_noise
return prepare_mixed_noise