SYMBOL INDEX (668 symbols across 42 files) FILE: ctrl_model/diffusion_ctrl.py class DiffusionEngineCtrl (line 23) | class DiffusionEngineCtrl(DiffusionEngine): method __init__ (line 24) | def __init__( class CtrlNetWrapper (line 90) | class CtrlNetWrapper(OpenAIWrapper): method __init__ (line 91) | def __init__(self, diffusion_model, compile_model: bool = False, ctrln... method forward (line 95) | def forward( FILE: ctrl_model/svd_ctrl.py class ControledVideoUnet (line 20) | class ControledVideoUnet(VideoUNet): method forward (line 24) | def forward( class ControlNetConditioningEmbedding (line 92) | class ControlNetConditioningEmbedding(nn.Module): method __init__ (line 93) | def __init__( method forward (line 115) | def forward(self, conditioning): class MaskEmbedding (line 128) | class MaskEmbedding(nn.Module): method __init__ (line 129) | def __init__( method forward (line 151) | def forward(self, conditioning): class WeightEmbedding (line 164) | class WeightEmbedding(nn.Module): method __init__ (line 165) | def __init__( method forward (line 189) | def forward(self, conditioning, t, cond_embeddings, mask_embeddings): class VideoCtrlNet (line 208) | class VideoCtrlNet(nn.Module): method __init__ (line 209) | def __init__( method make_zero_conv (line 531) | def make_zero_conv(self, channels): method init_from_ckpt (line 534) | def init_from_ckpt(self, ckpt_path=None): method init_from_unet (line 559) | def init_from_unet(self, unet): method forward (line 564) | def forward( FILE: main/inference/sample_constant_motion.py function sample (line 32) | def sample( function get_parser (line 275) | def get_parser(): FILE: main/inference/sample_multi_region.py function sample (line 29) | def sample( function get_parser (line 289) | def get_parser(): FILE: main/inference/sample_single_region.py function sample (line 31) | def sample( function get_parser (line 285) | def get_parser(): FILE: sgm/inference/api.py class ModelArchitecture (line 19) | class ModelArchitecture(str, Enum): class Sampler (line 28) | class Sampler(str, Enum): class Discretization (line 37) | class Discretization(str, Enum): class Guider (line 42) | class Guider(str, Enum): class Thresholder (line 47) | class Thresholder(str, Enum): class SamplingParams (line 52) | class SamplingParams: class SamplingSpec (line 80) | class SamplingSpec: class SamplingPipeline (line 155) | class SamplingPipeline: method __init__ (line 156) | def __init__( method _load_model (line 173) | def _load_model(self, device="cuda", use_fp16=True): method text_to_image (line 184) | def text_to_image( method image_to_image (line 212) | def image_to_image( method refiner (line 245) | def refiner( function get_guider_config (line 280) | def get_guider_config(params: SamplingParams): function get_discretization_config (line 306) | def get_discretization_config(params: SamplingParams): function get_sampler_config (line 325) | def get_sampler_config(params: SamplingParams): FILE: sgm/inference/helpers.py class WatermarkEmbedder (line 16) | class WatermarkEmbedder: method __init__ (line 17) | def __init__(self, watermark): method __call__ (line 23) | def __call__(self, image: torch.Tensor) -> torch.Tensor: function get_unique_embedder_keys_from_conditioner (line 61) | def get_unique_embedder_keys_from_conditioner(conditioner): function perform_save_locally (line 65) | def perform_save_locally(save_path, samples): class Img2ImgDiscretizationWrapper (line 77) | class Img2ImgDiscretizationWrapper: method __init__ (line 84) | def __init__(self, discretization, strength: float = 1.0): method __call__ (line 89) | def __call__(self, *args, **kwargs): function do_sample (line 101) | def do_sample( function get_batch (line 173) | def get_batch(keys, value_dict, N: Union[List, ListConfig], device="cuda"): function get_input_image_tensor (line 230) | def get_input_image_tensor(image: Image.Image, device="cuda"): function do_img2img (line 243) | def do_img2img( FILE: sgm/lr_scheduler.py class LambdaWarmUpCosineScheduler (line 4) | class LambdaWarmUpCosineScheduler: method __init__ (line 9) | def __init__( method schedule (line 26) | def schedule(self, n, **kwargs): method __call__ (line 47) | def __call__(self, n, **kwargs): class LambdaWarmUpCosineScheduler2 (line 51) | class LambdaWarmUpCosineScheduler2: method __init__ (line 57) | def __init__( method find_in_interval (line 76) | def find_in_interval(self, n): method schedule (line 83) | def schedule(self, n, **kwargs): method __call__ (line 109) | def __call__(self, n, **kwargs): class LambdaLinearScheduler (line 113) | class LambdaLinearScheduler(LambdaWarmUpCosineScheduler2): method schedule (line 114) | def schedule(self, n, **kwargs): FILE: sgm/models/autoencoder.py class AbstractAutoencoder (line 22) | class AbstractAutoencoder(pl.LightningModule): method __init__ (line 29) | def __init__( method apply_ckpt (line 49) | def apply_ckpt(self, ckpt: Union[None, str, dict]): method get_input (line 61) | def get_input(self, batch) -> Any: method on_train_batch_end (line 64) | def on_train_batch_end(self, *args, **kwargs): method ema_scope (line 70) | def ema_scope(self, context=None): method encode (line 85) | def encode(self, *args, **kwargs) -> torch.Tensor: method decode (line 89) | def decode(self, *args, **kwargs) -> torch.Tensor: method instantiate_optimizer_from_config (line 92) | def instantiate_optimizer_from_config(self, params, lr, cfg): method configure_optimizers (line 98) | def configure_optimizers(self) -> Any: class AutoencodingEngine (line 102) | class AutoencodingEngine(AbstractAutoencoder): method __init__ (line 109) | def __init__( method get_input (line 170) | def get_input(self, batch: Dict) -> torch.Tensor: method get_autoencoder_params (line 176) | def get_autoencoder_params(self) -> list: method get_discriminator_params (line 186) | def get_discriminator_params(self) -> list: method get_last_layer (line 193) | def get_last_layer(self): method encode (line 196) | def encode( method decode (line 210) | def decode(self, z: torch.Tensor, **kwargs) -> torch.Tensor: method forward (line 214) | def forward( method inner_training_step (line 221) | def inner_training_step( method training_step (line 281) | def training_step(self, batch: dict, batch_idx: int): method validation_step (line 298) | def validation_step(self, batch: dict, batch_idx: int) -> Dict: method _validation_step (line 305) | def _validation_step(self, batch: dict, batch_idx: int, postfix: str =... method get_param_groups (line 343) | def get_param_groups( method configure_optimizers (line 363) | def configure_optimizers(self) -> List[torch.optim.Optimizer]: method log_images (line 395) | def log_images( class AutoencodingEngineLegacy (line 437) | class AutoencodingEngineLegacy(AutoencodingEngine): method __init__ (line 438) | def __init__(self, embed_dim: int, **kwargs): method get_autoencoder_params (line 464) | def get_autoencoder_params(self) -> list: method encode (line 468) | def encode( method decode (line 490) | def decode(self, z: torch.Tensor, **decoder_kwargs) -> torch.Tensor: class AutoencoderKL (line 508) | class AutoencoderKL(AutoencodingEngineLegacy): method __init__ (line 509) | def __init__(self, **kwargs): class AutoencoderLegacyVQ (line 523) | class AutoencoderLegacyVQ(AutoencodingEngineLegacy): method __init__ (line 524) | def __init__( class IdentityFirstStage (line 549) | class IdentityFirstStage(AbstractAutoencoder): method __init__ (line 550) | def __init__(self, *args, **kwargs): method get_input (line 553) | def get_input(self, x: Any) -> Any: method encode (line 556) | def encode(self, x: Any, *args, **kwargs) -> Any: method decode (line 559) | def decode(self, x: Any, *args, **kwargs) -> Any: class AEIntegerWrapper (line 563) | class AEIntegerWrapper(nn.Module): method __init__ (line 564) | def __init__( method encode (line 580) | def encode(self, x) -> torch.Tensor: method decode (line 589) | def decode( class AutoencoderKLModeOnly (line 602) | class AutoencoderKLModeOnly(AutoencodingEngineLegacy): method __init__ (line 603) | def __init__(self, **kwargs): FILE: sgm/models/diffusion.py class DiffusionEngine (line 19) | class DiffusionEngine(pl.LightningModule): method __init__ (line 20) | def __init__( method init_from_ckpt (line 82) | def init_from_ckpt( method _init_first_stage (line 104) | def _init_first_stage(self, config): method decode_first_stage (line 112) | def decode_first_stage(self, z): method decode_first_stage_train (line 132) | def decode_first_stage_train(self, z): method encode_first_stage (line 152) | def encode_first_stage(self, x): method forward (line 167) | def forward(self, x, batch): method get_input (line 173) | def get_input(self, batch): method shared_step (line 180) | def shared_step(self, batch: Dict) -> Any: method training_step (line 187) | def training_step(self, batch, batch_idx): method on_train_start (line 198) | def on_train_start(self, *args, **kwargs): method on_train_batch_end (line 202) | def on_train_batch_end(self, *args, **kwargs): method ema_scope (line 207) | def ema_scope(self, context=None): method instantiate_optimizer_from_config (line 221) | def instantiate_optimizer_from_config(self, params, lr, cfg): method configure_optimizers (line 226) | def configure_optimizers(self): method sample (line 249) | def sample( method log_conditionings (line 266) | def log_conditionings(self, batch: Dict, n: int) -> Dict: method log_images (line 305) | def log_images( FILE: sgm/modules/attention.py function exists (line 61) | def exists(val): function uniq (line 65) | def uniq(arr): function default (line 69) | def default(val, d): function max_neg_value (line 75) | def max_neg_value(t): function init_ (line 79) | def init_(tensor): class GEGLU (line 87) | class GEGLU(nn.Module): method __init__ (line 88) | def __init__(self, dim_in, dim_out): method forward (line 92) | def forward(self, x): class FeedForward (line 97) | class FeedForward(nn.Module): method __init__ (line 98) | def __init__(self, dim, dim_out=None, mult=4, glu=False, dropout=0.0): method forward (line 112) | def forward(self, x): function zero_module (line 116) | def zero_module(module): function Normalize (line 125) | def Normalize(in_channels): class LinearAttention (line 131) | class LinearAttention(nn.Module): method __init__ (line 132) | def __init__(self, dim, heads=4, dim_head=32): method forward (line 139) | def forward(self, x): class SelfAttention (line 154) | class SelfAttention(nn.Module): method __init__ (line 157) | def __init__( method forward (line 179) | def forward(self, x: torch.Tensor) -> torch.Tensor: class SpatialSelfAttention (line 210) | class SpatialSelfAttention(nn.Module): method __init__ (line 211) | def __init__(self, in_channels): method forward (line 229) | def forward(self, x): class CrossAttention (line 255) | class CrossAttention(nn.Module): method __init__ (line 256) | def __init__( method forward (line 281) | def forward( class MemoryEfficientCrossAttention (line 347) | class MemoryEfficientCrossAttention(nn.Module): method __init__ (line 349) | def __init__( method forward (line 373) | def forward( class BasicTransformerBlock (line 463) | class BasicTransformerBlock(nn.Module): method __init__ (line 469) | def __init__( method forward (line 534) | def forward( method _forward (line 558) | def _forward( class BasicTransformerSingleLayerBlock (line 582) | class BasicTransformerSingleLayerBlock(nn.Module): method __init__ (line 589) | def __init__( method forward (line 615) | def forward(self, x, context=None): method _forward (line 620) | def _forward(self, x, context=None): class SpatialTransformer (line 626) | class SpatialTransformer(nn.Module): method __init__ (line 636) | def __init__( method forward (line 709) | def forward(self, x, context=None): class SimpleTransformer (line 733) | class SimpleTransformer(nn.Module): method __init__ (line 734) | def __init__( method forward (line 759) | def forward( FILE: sgm/modules/autoencoding/losses/discriminator_loss.py class GeneralLPIPSWithDiscriminator (line 17) | class GeneralLPIPSWithDiscriminator(nn.Module): method __init__ (line 18) | def __init__( method get_trainable_parameters (line 85) | def get_trainable_parameters(self) -> Iterator[nn.Parameter]: method get_trainable_autoencoder_parameters (line 88) | def get_trainable_autoencoder_parameters(self) -> Iterator[nn.Parameter]: method log_images (line 94) | def log_images( method calculate_adaptive_weight (line 196) | def calculate_adaptive_weight( method forward (line 207) | def forward( method get_nll_loss (line 294) | def get_nll_loss( FILE: sgm/modules/autoencoding/losses/lpips.py class LatentLPIPS (line 8) | class LatentLPIPS(nn.Module): method __init__ (line 9) | def __init__( method init_decoder (line 27) | def init_decoder(self, config): method forward (line 32) | def forward(self, latent_inputs, latent_predictions, image_inputs, spl... FILE: sgm/modules/autoencoding/lpips/loss/lpips.py class LPIPS (line 12) | class LPIPS(nn.Module): method __init__ (line 14) | def __init__(self, use_dropout=True): method load_from_pretrained (line 28) | def load_from_pretrained(self, name="vgg_lpips"): method from_pretrained (line 36) | def from_pretrained(cls, name="vgg_lpips"): method forward (line 46) | def forward(self, input, target): class ScalingLayer (line 70) | class ScalingLayer(nn.Module): method __init__ (line 71) | def __init__(self): method forward (line 80) | def forward(self, inp): class NetLinLayer (line 84) | class NetLinLayer(nn.Module): method __init__ (line 87) | def __init__(self, chn_in, chn_out=1, use_dropout=False): class vgg16 (line 102) | class vgg16(torch.nn.Module): method __init__ (line 103) | def __init__(self, requires_grad=False, pretrained=True): method forward (line 126) | def forward(self, X): function normalize_tensor (line 144) | def normalize_tensor(x, eps=1e-10): function spatial_average (line 149) | def spatial_average(x, keepdim=True): FILE: sgm/modules/autoencoding/lpips/model/model.py function weights_init (line 8) | def weights_init(m): class NLayerDiscriminator (line 17) | class NLayerDiscriminator(nn.Module): method __init__ (line 22) | def __init__(self, input_nc=3, ndf=64, n_layers=3, use_actnorm=False): method forward (line 86) | def forward(self, input): FILE: sgm/modules/autoencoding/lpips/util.py function download (line 16) | def download(url, local_path, chunk_size=1024): function md5_hash (line 28) | def md5_hash(path): function get_ckpt_path (line 34) | def get_ckpt_path(name, root, check=False): class ActNorm (line 45) | class ActNorm(nn.Module): method __init__ (line 46) | def __init__( method initialize (line 58) | def initialize(self, input): method forward (line 79) | def forward(self, input, reverse=False): method reverse (line 107) | def reverse(self, output): FILE: sgm/modules/autoencoding/lpips/vqperceptual.py function hinge_d_loss (line 5) | def hinge_d_loss(logits_real, logits_fake): function vanilla_d_loss (line 12) | def vanilla_d_loss(logits_real, logits_fake): FILE: sgm/modules/autoencoding/regularizers/__init__.py class DiagonalGaussianRegularizer (line 13) | class DiagonalGaussianRegularizer(AbstractRegularizer): method __init__ (line 14) | def __init__(self, sample: bool = True): method get_trainable_parameters (line 18) | def get_trainable_parameters(self) -> Any: method forward (line 21) | def forward(self, z: torch.Tensor) -> Tuple[torch.Tensor, dict]: FILE: sgm/modules/autoencoding/regularizers/base.py class AbstractRegularizer (line 9) | class AbstractRegularizer(nn.Module): method __init__ (line 10) | def __init__(self): method forward (line 13) | def forward(self, z: torch.Tensor) -> Tuple[torch.Tensor, dict]: method get_trainable_parameters (line 17) | def get_trainable_parameters(self) -> Any: class IdentityRegularizer (line 21) | class IdentityRegularizer(AbstractRegularizer): method forward (line 22) | def forward(self, z: torch.Tensor) -> Tuple[torch.Tensor, dict]: method get_trainable_parameters (line 25) | def get_trainable_parameters(self) -> Any: function measure_perplexity (line 29) | def measure_perplexity( FILE: sgm/modules/autoencoding/regularizers/quantize.py class AbstractQuantizer (line 17) | class AbstractQuantizer(AbstractRegularizer): method __init__ (line 18) | def __init__(self): method remap_to_used (line 26) | def remap_to_used(self, inds: torch.Tensor) -> torch.Tensor: method unmap_to_all (line 43) | def unmap_to_all(self, inds: torch.Tensor) -> torch.Tensor: method get_codebook_entry (line 55) | def get_codebook_entry( method get_trainable_parameters (line 60) | def get_trainable_parameters(self) -> Iterator[torch.nn.Parameter]: class GumbelQuantizer (line 64) | class GumbelQuantizer(AbstractQuantizer): method __init__ (line 73) | def __init__( method forward (line 119) | def forward( method get_codebook_entry (line 158) | def get_codebook_entry(self, indices, shape): class VectorQuantizer (line 172) | class VectorQuantizer(AbstractQuantizer): method __init__ (line 184) | def __init__( method forward (line 234) | def forward( method get_codebook_entry (line 302) | def get_codebook_entry( class EmbeddingEMA (line 323) | class EmbeddingEMA(nn.Module): method __init__ (line 324) | def __init__(self, num_tokens, codebook_dim, decay=0.99, eps=1e-5): method forward (line 334) | def forward(self, embed_id): method cluster_size_ema_update (line 337) | def cluster_size_ema_update(self, new_cluster_size): method embed_avg_ema_update (line 342) | def embed_avg_ema_update(self, new_embed_avg): method weight_update (line 345) | def weight_update(self, num_tokens): class EMAVectorQuantizer (line 355) | class EMAVectorQuantizer(AbstractQuantizer): method __init__ (line 356) | def __init__( method forward (line 396) | def forward(self, z: torch.Tensor) -> Tuple[torch.Tensor, Dict]: class VectorQuantizerWithInputProjection (line 446) | class VectorQuantizerWithInputProjection(VectorQuantizer): method __init__ (line 447) | def __init__( method forward (line 464) | def forward(self, z: torch.Tensor) -> Tuple[torch.Tensor, Dict]: FILE: sgm/modules/autoencoding/temporal_ae.py class VideoResBlock (line 18) | class VideoResBlock(ResnetBlock): method __init__ (line 19) | def __init__( method get_alpha (line 56) | def get_alpha(self, bs): method forward (line 64) | def forward(self, x, temb, skip_video=False, timesteps=None): class AE3DConv (line 86) | class AE3DConv(torch.nn.Conv2d): method __init__ (line 87) | def __init__(self, in_channels, out_channels, video_kernel_size=3, *ar... method forward (line 101) | def forward(self, input, timesteps, skip_video=False): class VideoBlock (line 110) | class VideoBlock(AttnBlock): method __init__ (line 111) | def __init__( method forward (line 142) | def forward(self, x, timesteps, skip_video=False): method get_alpha (line 169) | def get_alpha( class MemoryEfficientVideoBlock (line 180) | class MemoryEfficientVideoBlock(MemoryEfficientAttnBlock): method __init__ (line 181) | def __init__( method forward (line 212) | def forward(self, x, timesteps, skip_time_block=False): method get_alpha (line 239) | def get_alpha( function make_time_attn (line 250) | def make_time_attn( class Conv2DWrapper (line 288) | class Conv2DWrapper(torch.nn.Conv2d): method forward (line 289) | def forward(self, input: torch.Tensor, **kwargs) -> torch.Tensor: class VideoDecoder (line 293) | class VideoDecoder(Decoder): method __init__ (line 296) | def __init__( method get_last_layer (line 314) | def get_last_layer(self, skip_time_mix=False, **kwargs): method _make_attn (line 324) | def _make_attn(self) -> Callable: method _make_conv (line 334) | def _make_conv(self) -> Callable: method _make_resblock (line 340) | def _make_resblock(self) -> Callable: FILE: sgm/modules/diffusionmodules/denoiser.py class Denoiser (line 11) | class Denoiser(nn.Module): method __init__ (line 12) | def __init__(self, scaling_config: Dict): method possibly_quantize_sigma (line 17) | def possibly_quantize_sigma(self, sigma: torch.Tensor) -> torch.Tensor: method possibly_quantize_c_noise (line 20) | def possibly_quantize_c_noise(self, c_noise: torch.Tensor) -> torch.Te... method forward (line 23) | def forward( class DiscreteDenoiser (line 44) | class DiscreteDenoiser(Denoiser): method __init__ (line 45) | def __init__( method sigma_to_idx (line 63) | def sigma_to_idx(self, sigma: torch.Tensor) -> torch.Tensor: method idx_to_sigma (line 67) | def idx_to_sigma(self, idx: Union[torch.Tensor, int]) -> torch.Tensor: method possibly_quantize_sigma (line 70) | def possibly_quantize_sigma(self, sigma: torch.Tensor) -> torch.Tensor: method possibly_quantize_c_noise (line 73) | def possibly_quantize_c_noise(self, c_noise: torch.Tensor) -> torch.Te... FILE: sgm/modules/diffusionmodules/denoiser_scaling.py class DenoiserScaling (line 7) | class DenoiserScaling(ABC): method __call__ (line 9) | def __call__( class EDMScaling (line 15) | class EDMScaling: method __init__ (line 16) | def __init__(self, sigma_data: float = 0.5): method __call__ (line 19) | def __call__( class EpsScaling (line 29) | class EpsScaling: method __call__ (line 30) | def __call__( class VScaling (line 40) | class VScaling: method __call__ (line 41) | def __call__( class VScalingWithEDMcNoise (line 51) | class VScalingWithEDMcNoise(DenoiserScaling): method __call__ (line 52) | def __call__( class VScalingWithEDMcNoise_fp16 (line 62) | class VScalingWithEDMcNoise_fp16(DenoiserScaling): method __call__ (line 63) | def __call__( FILE: sgm/modules/diffusionmodules/denoiser_weighting.py class UnitWeighting (line 4) | class UnitWeighting: method __call__ (line 5) | def __call__(self, sigma): class EDMWeighting (line 9) | class EDMWeighting: method __init__ (line 10) | def __init__(self, sigma_data=0.5): method __call__ (line 13) | def __call__(self, sigma): class VWeighting (line 17) | class VWeighting(EDMWeighting): method __init__ (line 18) | def __init__(self): class EpsWeighting (line 22) | class EpsWeighting: method __call__ (line 23) | def __call__(self, sigma): FILE: sgm/modules/diffusionmodules/discretizer.py function generate_roughly_equally_spaced_steps (line 11) | def generate_roughly_equally_spaced_steps( class Discretization (line 17) | class Discretization: method __call__ (line 18) | def __call__(self, n, do_append_zero=True, device="cpu", flip=False): method get_sigmas (line 24) | def get_sigmas(self, n, device): class EDMDiscretization (line 28) | class EDMDiscretization(Discretization): method __init__ (line 29) | def __init__(self, sigma_min=0.002, sigma_max=80.0, rho=7.0): method get_sigmas (line 34) | def get_sigmas(self, n, device="cpu"): class LegacyDDPMDiscretization (line 42) | class LegacyDDPMDiscretization(Discretization): method __init__ (line 43) | def __init__( method get_sigmas (line 58) | def get_sigmas(self, n, device="cpu"): FILE: sgm/modules/diffusionmodules/guiders.py class Guider (line 13) | class Guider(ABC): method __call__ (line 15) | def __call__(self, x: torch.Tensor, sigma: float) -> torch.Tensor: method prepare_inputs (line 18) | def prepare_inputs( class VanillaCFG (line 24) | class VanillaCFG(Guider): method __init__ (line 25) | def __init__(self, scale: float): method __call__ (line 28) | def __call__(self, x: torch.Tensor, sigma: torch.Tensor) -> torch.Tensor: method prepare_inputs (line 33) | def prepare_inputs(self, x, s, c, uc): class IdentityGuider (line 45) | class IdentityGuider(Guider): method __call__ (line 46) | def __call__(self, x: torch.Tensor, sigma: float) -> torch.Tensor: method prepare_inputs (line 49) | def prepare_inputs( class LinearPredictionGuider (line 60) | class LinearPredictionGuider(Guider): method __init__ (line 61) | def __init__( method __call__ (line 78) | def __call__(self, x: torch.Tensor, sigma: torch.Tensor) -> torch.Tensor: method prepare_inputs (line 89) | def prepare_inputs( class LinearPredictionGuider_fp16 (line 102) | class LinearPredictionGuider_fp16(Guider): method __init__ (line 103) | def __init__( method __call__ (line 120) | def __call__(self, x: torch.Tensor, sigma: torch.Tensor) -> torch.Tensor: method prepare_inputs (line 130) | def prepare_inputs( FILE: sgm/modules/diffusionmodules/model.py function get_timestep_embedding (line 26) | def get_timestep_embedding(timesteps, embedding_dim): function nonlinearity (line 47) | def nonlinearity(x): function Normalize (line 52) | def Normalize(in_channels, num_groups=32): class Upsample (line 58) | class Upsample(nn.Module): method __init__ (line 59) | def __init__(self, in_channels, with_conv): method forward (line 67) | def forward(self, x): class Downsample (line 74) | class Downsample(nn.Module): method __init__ (line 75) | def __init__(self, in_channels, with_conv): method forward (line 84) | def forward(self, x): class ResnetBlock (line 94) | class ResnetBlock(nn.Module): method __init__ (line 95) | def __init__( method forward (line 131) | def forward(self, x, temb): class LinAttnBlock (line 154) | class LinAttnBlock(LinearAttention): method __init__ (line 157) | def __init__(self, in_channels): class AttnBlock (line 161) | class AttnBlock(nn.Module): method __init__ (line 162) | def __init__(self, in_channels): method attention (line 180) | def attention(self, h_: torch.Tensor) -> torch.Tensor: method forward (line 197) | def forward(self, x, **kwargs): class MemoryEfficientAttnBlock (line 204) | class MemoryEfficientAttnBlock(nn.Module): method __init__ (line 212) | def __init__(self, in_channels): method attention (line 231) | def attention(self, h_: torch.Tensor) -> torch.Tensor: method forward (line 261) | def forward(self, x, **kwargs): class MemoryEfficientCrossAttentionWrapper (line 268) | class MemoryEfficientCrossAttentionWrapper(MemoryEfficientCrossAttention): method forward (line 269) | def forward(self, x, context=None, mask=None, **unused_kwargs): function make_attn (line 277) | def make_attn(in_channels, attn_type="vanilla", attn_kwargs=None): class Model (line 312) | class Model(nn.Module): method __init__ (line 313) | def __init__( method forward (line 434) | def forward(self, x, t=None, context=None): method get_last_layer (line 483) | def get_last_layer(self): class Encoder (line 487) | class Encoder(nn.Module): method __init__ (line 488) | def __init__( method forward (line 576) | def forward(self, x): class Decoder (line 604) | class Decoder(nn.Module): method __init__ (line 605) | def __init__( method _make_attn (line 703) | def _make_attn(self) -> Callable: method _make_resblock (line 706) | def _make_resblock(self) -> Callable: method _make_conv (line 709) | def _make_conv(self) -> Callable: method get_last_layer (line 712) | def get_last_layer(self, **kwargs): method forward (line 715) | def forward(self, z, **kwargs): FILE: sgm/modules/diffusionmodules/openaimodel.py class AttentionPool2d (line 22) | class AttentionPool2d(nn.Module): method __init__ (line 27) | def __init__( method forward (line 43) | def forward(self, x: th.Tensor) -> th.Tensor: class TimestepBlock (line 54) | class TimestepBlock(nn.Module): method forward (line 60) | def forward(self, x: th.Tensor, emb: th.Tensor): class TimestepEmbedSequential (line 66) | class TimestepEmbedSequential(nn.Sequential, TimestepBlock): method forward (line 72) | def forward( class Upsample (line 107) | class Upsample(nn.Module): method __init__ (line 116) | def __init__( method forward (line 139) | def forward(self, x: th.Tensor) -> th.Tensor: class Downsample (line 160) | class Downsample(nn.Module): method __init__ (line 169) | def __init__( method forward (line 204) | def forward(self, x: th.Tensor) -> th.Tensor: class ResBlock (line 210) | class ResBlock(TimestepBlock): method __init__ (line 226) | def __init__( method forward (line 316) | def forward(self, x: th.Tensor, emb: th.Tensor) -> th.Tensor: method _forward (line 328) | def _forward(self, x: th.Tensor, emb: th.Tensor) -> th.Tensor: class AttentionBlock (line 357) | class AttentionBlock(nn.Module): method __init__ (line 364) | def __init__( method forward (line 393) | def forward(self, x: th.Tensor, **kwargs) -> th.Tensor: method _forward (line 396) | def _forward(self, x: th.Tensor) -> th.Tensor: class QKVAttentionLegacy (line 405) | class QKVAttentionLegacy(nn.Module): method __init__ (line 410) | def __init__(self, n_heads: int): method forward (line 414) | def forward(self, qkv: th.Tensor) -> th.Tensor: class QKVAttention (line 433) | class QKVAttention(nn.Module): method __init__ (line 438) | def __init__(self, n_heads: int): method forward (line 442) | def forward(self, qkv: th.Tensor) -> th.Tensor: class Timestep (line 463) | class Timestep(nn.Module): method __init__ (line 464) | def __init__(self, dim: int): method forward (line 468) | def forward(self, t: th.Tensor) -> th.Tensor: class UNetModel (line 472) | class UNetModel(nn.Module): method __init__ (line 502) | def __init__( method forward (line 816) | def forward( FILE: sgm/modules/diffusionmodules/sampling.py class BaseDiffusionSampler (line 21) | class BaseDiffusionSampler: method __init__ (line 22) | def __init__( method prepare_sampling_loop (line 41) | def prepare_sampling_loop(self, x, cond, uc=None, num_steps=None): method denoise (line 54) | def denoise(self, x, denoiser, sigma, cond, uc): method get_sigma_gen (line 60) | def get_sigma_gen(self, num_sigmas): class SingleStepDiffusionSampler (line 75) | class SingleStepDiffusionSampler(BaseDiffusionSampler): method sampler_step (line 76) | def sampler_step(self, sigma, next_sigma, denoiser, x, cond, uc, *args... method euler_step (line 79) | def euler_step(self, x, d, dt): class EDMSampler (line 83) | class EDMSampler(SingleStepDiffusionSampler): method __init__ (line 84) | def __init__( method sampler_step (line 94) | def sampler_step(self, sigma, next_sigma, denoiser, x, cond, uc=None, ... method __call__ (line 112) | def __call__(self, denoiser, x, cond, uc=None, num_steps=None): class AncestralSampler (line 136) | class AncestralSampler(SingleStepDiffusionSampler): method __init__ (line 137) | def __init__(self, eta=1.0, s_noise=1.0, *args, **kwargs): method ancestral_euler_step (line 144) | def ancestral_euler_step(self, x, denoised, sigma, sigma_down): method ancestral_step (line 150) | def ancestral_step(self, x, sigma, next_sigma, sigma_up): method __call__ (line 158) | def __call__(self, denoiser, x, cond, uc=None, num_steps=None): class LinearMultistepSampler (line 176) | class LinearMultistepSampler(BaseDiffusionSampler): method __init__ (line 177) | def __init__( method __call__ (line 187) | def __call__(self, denoiser, x, cond, uc=None, num_steps=None, **kwargs): class EulerEDMSampler (line 214) | class EulerEDMSampler(EDMSampler): method possible_correction_step (line 215) | def possible_correction_step( class HeunEDMSampler (line 221) | class HeunEDMSampler(EDMSampler): method possible_correction_step (line 222) | def possible_correction_step( class EulerAncestralSampler (line 240) | class EulerAncestralSampler(AncestralSampler): method sampler_step (line 241) | def sampler_step(self, sigma, next_sigma, denoiser, x, cond, uc): class DPMPP2SAncestralSampler (line 250) | class DPMPP2SAncestralSampler(AncestralSampler): method get_variables (line 251) | def get_variables(self, sigma, sigma_down): method get_mult (line 257) | def get_mult(self, h, s, t, t_next): method sampler_step (line 265) | def sampler_step(self, sigma, next_sigma, denoiser, x, cond, uc=None, ... class DPMPP2MSampler (line 290) | class DPMPP2MSampler(BaseDiffusionSampler): method get_variables (line 291) | def get_variables(self, sigma, next_sigma, previous_sigma=None): method get_mult (line 302) | def get_mult(self, h, r, t, t_next, previous_sigma): method sampler_step (line 313) | def sampler_step( method __call__ (line 347) | def __call__(self, denoiser, x, cond, uc=None, num_steps=None, **kwargs): FILE: sgm/modules/diffusionmodules/sampling_utils.py function linear_multistep_coeff (line 7) | def linear_multistep_coeff(order, t, i, j, epsrel=1e-4): function get_ancestral_step (line 22) | def get_ancestral_step(sigma_from, sigma_to, eta=1.0): function to_d (line 34) | def to_d(x, sigma, denoised): function to_neg_log_sigma (line 38) | def to_neg_log_sigma(sigma): function to_sigma (line 42) | def to_sigma(neg_log_sigma): FILE: sgm/modules/diffusionmodules/sigma_sampling.py class EDMSampling (line 6) | class EDMSampling: method __init__ (line 7) | def __init__(self, p_mean=-1.2, p_std=1.2): method __call__ (line 11) | def __call__(self, n_samples, rand=None): class DiscreteSampling (line 16) | class DiscreteSampling: method __init__ (line 17) | def __init__(self, discretization_config, num_idx, do_append_zero=Fals... method idx_to_sigma (line 23) | def idx_to_sigma(self, idx): method __call__ (line 26) | def __call__(self, n_samples, rand=None): FILE: sgm/modules/diffusionmodules/util.py function make_beta_schedule (line 20) | def make_beta_schedule( function extract_into_tensor (line 36) | def extract_into_tensor(a, t, x_shape): function mixed_checkpoint (line 42) | def mixed_checkpoint(func, inputs: dict, params, flag): class MixedCheckpointFunction (line 78) | class MixedCheckpointFunction(torch.autograd.Function): method forward (line 80) | def forward( method backward (line 120) | def backward(ctx, *output_grads): function checkpoint (line 155) | def checkpoint(func, inputs, params, flag): class CheckpointFunction (line 173) | class CheckpointFunction(torch.autograd.Function): method forward (line 175) | def forward(ctx, run_function, length, *args): method backward (line 189) | def backward(ctx, *output_grads): function timestep_embedding (line 209) | def timestep_embedding(timesteps, dim, max_period=10000, repeat_only=Fal... function zero_module (line 236) | def zero_module(module): function scale_module (line 245) | def scale_module(module, scale): function mean_flat (line 254) | def mean_flat(tensor): function normalization (line 261) | def normalization(channels): class SiLU (line 271) | class SiLU(nn.Module): method forward (line 272) | def forward(self, x): class GroupNorm32 (line 275) | class GroupNorm32(nn.GroupNorm): method forward (line 276) | def forward(self, x): function conv_nd (line 279) | def conv_nd(dims, *args, **kwargs): function linear (line 292) | def linear(*args, **kwargs): function avg_pool_nd (line 299) | def avg_pool_nd(dims, *args, **kwargs): class AlphaBlender (line 312) | class AlphaBlender(nn.Module): method __init__ (line 315) | def __init__( method get_alpha (line 341) | def get_alpha(self, image_only_indicator: torch.Tensor) -> torch.Tensor: method forward (line 358) | def forward( FILE: sgm/modules/diffusionmodules/video_model.py class VideoResBlock (line 13) | class VideoResBlock(ResBlock): method __init__ (line 14) | def __init__( method forward (line 63) | def forward( class VideoUNet (line 85) | class VideoUNet(nn.Module): method __init__ (line 86) | def __init__( method forward (line 444) | def forward( FILE: sgm/modules/diffusionmodules/wrappers.py class IdentityWrapper (line 8) | class IdentityWrapper(nn.Module): method __init__ (line 9) | def __init__(self, diffusion_model, compile_model: bool = False): method forward (line 19) | def forward(self, *args, **kwargs): class OpenAIWrapper (line 23) | class OpenAIWrapper(IdentityWrapper): method forward (line 24) | def forward( FILE: sgm/modules/distributions/distributions.py class AbstractDistribution (line 5) | class AbstractDistribution: method sample (line 6) | def sample(self): method mode (line 9) | def mode(self): class DiracDistribution (line 13) | class DiracDistribution(AbstractDistribution): method __init__ (line 14) | def __init__(self, value): method sample (line 17) | def sample(self): method mode (line 20) | def mode(self): class DiagonalGaussianDistribution (line 24) | class DiagonalGaussianDistribution(object): method __init__ (line 25) | def __init__(self, parameters, deterministic=False): method sample (line 37) | def sample(self): method kl (line 43) | def kl(self, other=None): method nll (line 62) | def nll(self, sample, dims=[1, 2, 3]): method mode (line 71) | def mode(self): function normal_kl (line 75) | def normal_kl(mean1, logvar1, mean2, logvar2): FILE: sgm/modules/ema.py class LitEma (line 5) | class LitEma(nn.Module): method __init__ (line 6) | def __init__(self, model, decay=0.9999, use_num_upates=True): method reset_num_updates (line 29) | def reset_num_updates(self): method forward (line 33) | def forward(self, model): method copy_to (line 56) | def copy_to(self, model): method store (line 65) | def store(self, parameters): method restore (line 74) | def restore(self, parameters): FILE: sgm/modules/encoders/modules.py class AbstractEmbModel (line 27) | class AbstractEmbModel(nn.Module): method __init__ (line 28) | def __init__(self): method is_trainable (line 35) | def is_trainable(self) -> bool: method ucg_rate (line 39) | def ucg_rate(self) -> Union[float, torch.Tensor]: method input_key (line 43) | def input_key(self) -> str: method is_trainable (line 47) | def is_trainable(self, value: bool): method ucg_rate (line 51) | def ucg_rate(self, value: Union[float, torch.Tensor]): method input_key (line 55) | def input_key(self, value: str): method is_trainable (line 59) | def is_trainable(self): method ucg_rate (line 63) | def ucg_rate(self): method input_key (line 67) | def input_key(self): class GeneralConditioner (line 71) | class GeneralConditioner(nn.Module): method __init__ (line 75) | def __init__(self, emb_models: Union[List, ListConfig]): method possibly_get_ucg_val (line 111) | def possibly_get_ucg_val(self, embedder: AbstractEmbModel, batch: Dict... method forward (line 120) | def forward( method get_unconditional_conditioning (line 167) | def get_unconditional_conditioning( class InceptionV3 (line 188) | class InceptionV3(nn.Module): method __init__ (line 192) | def __init__(self, normalize_input=False, **kwargs): method forward (line 199) | def forward(self, inp): class IdentityEncoder (line 208) | class IdentityEncoder(AbstractEmbModel): method encode (line 209) | def encode(self, x): method forward (line 212) | def forward(self, x): class ClassEmbedder (line 216) | class ClassEmbedder(AbstractEmbModel): method __init__ (line 217) | def __init__(self, embed_dim, n_classes=1000, add_sequence_dim=False): method forward (line 223) | def forward(self, c): method get_unconditional_conditioning (line 229) | def get_unconditional_conditioning(self, bs, device="cuda"): class ClassEmbedderForMultiCond (line 238) | class ClassEmbedderForMultiCond(ClassEmbedder): method forward (line 239) | def forward(self, batch, key=None, disable_dropout=False): class FrozenT5Embedder (line 250) | class FrozenT5Embedder(AbstractEmbModel): method __init__ (line 253) | def __init__( method freeze (line 264) | def freeze(self): method forward (line 270) | def forward(self, text): method encode (line 286) | def encode(self, text): class FrozenByT5Embedder (line 290) | class FrozenByT5Embedder(AbstractEmbModel): method __init__ (line 295) | def __init__( method freeze (line 306) | def freeze(self): method forward (line 312) | def forward(self, text): method encode (line 328) | def encode(self, text): class FrozenCLIPEmbedder (line 332) | class FrozenCLIPEmbedder(AbstractEmbModel): method __init__ (line 337) | def __init__( method freeze (line 362) | def freeze(self): method forward (line 369) | def forward(self, text): method encode (line 393) | def encode(self, text): class FrozenOpenCLIPEmbedder2 (line 397) | class FrozenOpenCLIPEmbedder2(AbstractEmbModel): method __init__ (line 404) | def __init__( method freeze (line 439) | def freeze(self): method forward (line 445) | def forward(self, text): method encode_with_transformer (line 455) | def encode_with_transformer(self, text): method pool (line 472) | def pool(self, x, text): method text_transformer_forward (line 480) | def text_transformer_forward(self, x: torch.Tensor, attn_mask=None): method encode (line 495) | def encode(self, text): class FrozenOpenCLIPEmbedder (line 499) | class FrozenOpenCLIPEmbedder(AbstractEmbModel): method __init__ (line 506) | def __init__( method freeze (line 535) | def freeze(self): method forward (line 540) | def forward(self, text): method encode_with_transformer (line 545) | def encode_with_transformer(self, text): method text_transformer_forward (line 554) | def text_transformer_forward(self, x: torch.Tensor, attn_mask=None): method encode (line 567) | def encode(self, text): class FrozenOpenCLIPImageEmbedder (line 571) | class FrozenOpenCLIPImageEmbedder(AbstractEmbModel): method __init__ (line 576) | def __init__( method preprocess (line 621) | def preprocess(self, x): method freeze (line 635) | def freeze(self): method forward (line 641) | def forward(self, image, no_dropout=False): method encode_with_vision_transformer (line 694) | def encode_with_vision_transformer(self, img): method encode (line 728) | def encode(self, text): class FrozenCLIPT5Encoder (line 732) | class FrozenCLIPT5Encoder(AbstractEmbModel): method __init__ (line 733) | def __init__( method encode (line 751) | def encode(self, text): method forward (line 754) | def forward(self, text): class SpatialRescaler (line 760) | class SpatialRescaler(nn.Module): method __init__ (line 761) | def __init__( method forward (line 800) | def forward(self, x): method encode (line 816) | def encode(self, x): class LowScaleEncoder (line 820) | class LowScaleEncoder(nn.Module): method __init__ (line 821) | def __init__( method register_schedule (line 840) | def register_schedule( method q_sample (line 888) | def q_sample(self, x_start, t, noise=None): method forward (line 896) | def forward(self, x): method decode (line 909) | def decode(self, z): class ConcatTimestepEmbedderND (line 914) | class ConcatTimestepEmbedderND(AbstractEmbModel): method __init__ (line 917) | def __init__(self, outdim): method forward (line 922) | def forward(self, x): class GaussianEncoder (line 933) | class GaussianEncoder(Encoder, AbstractEmbModel): method __init__ (line 934) | def __init__( method forward (line 942) | def forward(self, x) -> Tuple[Dict, torch.Tensor]: class VideoPredictionEmbedderWithEncoder (line 952) | class VideoPredictionEmbedderWithEncoder(AbstractEmbModel): method __init__ (line 953) | def __init__( method forward (line 985) | def forward( class FrozenOpenCLIPImagePredictionEmbedder (line 1028) | class FrozenOpenCLIPImagePredictionEmbedder(AbstractEmbModel): method __init__ (line 1029) | def __init__( method forward (line 1041) | def forward(self, vid): FILE: sgm/modules/video_attention.py class TimeMixSequential (line 7) | class TimeMixSequential(nn.Sequential): method forward (line 8) | def forward(self, x, context=None, timesteps=None): class VideoTransformerBlock (line 15) | class VideoTransformerBlock(nn.Module): method __init__ (line 21) | def __init__( method forward (line 105) | def forward( method _forward (line 113) | def _forward(self, x, context=None, timesteps=None): method get_last_layer (line 156) | def get_last_layer(self): class SpatialVideoTransformer (line 160) | class SpatialVideoTransformer(SpatialTransformer): method __init__ (line 161) | def __init__( method forward (line 244) | def forward( FILE: sgm/util.py function disabled_train (line 14) | def disabled_train(self, mode=True): function get_string_from_tuple (line 20) | def get_string_from_tuple(s): function is_power_of_two (line 36) | def is_power_of_two(n): function autocast (line 52) | def autocast(f, enabled=True): function load_partial_from_config (line 64) | def load_partial_from_config(config): function log_txt_as_img (line 68) | def log_txt_as_img(wh, xc, size=10): function partialclass (line 98) | def partialclass(cls, *args, **kwargs): function make_path_absolute (line 105) | def make_path_absolute(path): function ismap (line 112) | def ismap(x): function isimage (line 118) | def isimage(x): function isheatmap (line 124) | def isheatmap(x): function isneighbors (line 131) | def isneighbors(x): function exists (line 137) | def exists(x): function expand_dims_like (line 141) | def expand_dims_like(x, y): function default (line 147) | def default(val, d): function mean_flat (line 153) | def mean_flat(tensor): function count_params (line 161) | def count_params(model, verbose=False): function instantiate_from_config (line 168) | def instantiate_from_config(config): function get_obj_from_str (line 178) | def get_obj_from_str(string, reload=False, invalidate_cache=True): function append_zero (line 188) | def append_zero(x): function append_dims (line 192) | def append_dims(x, target_dims): function load_model_from_config (line 202) | def load_model_from_config(config, ckpt, verbose=True, freeze=True): function get_configs_path (line 233) | def get_configs_path() -> str: function get_nested_attribute (line 251) | def get_nested_attribute(obj, attribute_path, depth=None, return_key=Fal... FILE: utils/save_video.py function frames_to_mp4 (line 15) | def frames_to_mp4(frame_dir, output_path, fps): function tensor_to_mp4 (line 28) | def tensor_to_mp4(video, savepath, fps, rescale=True, nrow=None): function tensor2videogrids (line 45) | def tensor2videogrids(video, root, filename, fps, rescale=True, clamp=Tr... function flow2rgb (line 63) | def flow2rgb(flow_map, max_value): function save_flow_video (line 77) | def save_flow_video(flow_tensor, output_file, fps=10, max_flow=None): function save_rgb_video (line 93) | def save_rgb_video(flow_tensor, output_file, fps=10, max_flow=None): function log_local (line 109) | def log_local(batch_logs, save_dir, filename, save_fps=10, rescale=True): function prepare_to_log (line 171) | def prepare_to_log(batch_logs, max_images=100000, clamp=True): function fill_with_black_squares (line 191) | def fill_with_black_squares(video, desired_len: int) -> Tensor: function load_num_videos (line 201) | def load_num_videos(data_path, num_videos): function npz_to_video_grid (line 214) | def npz_to_video_grid(data_path, out_path, num_frames, fps, num_videos=N... FILE: utils/tools.py function quick_freeze (line 11) | def quick_freeze(model): function get_gaussian_kernel (line 16) | def get_gaussian_kernel(kernel_size, sigma, channels): function resize_pil_image (line 40) | def resize_pil_image(image, max_resolution=768 * 768, resize_short_edge=... function get_unique_embedder_keys_from_conditioner (line 53) | def get_unique_embedder_keys_from_conditioner(conditioner): function get_batch (line 57) | def get_batch(keys, value_dict, N, T, device): function load_model (line 98) | def load_model( FILE: utils/visualizer.py function read_video_from_path (line 18) | def read_video_from_path(path): function draw_circle (line 30) | def draw_circle(rgb, coord, radius, color=(255, 0, 0), visible=True): function draw_line (line 45) | def draw_line(rgb, coord_y, coord_x, color, linewidth): function add_weighted (line 55) | def add_weighted(rgb, alpha, original, beta, gamma): class Visualizer (line 59) | class Visualizer: method __init__ (line 60) | def __init__( method visualize (line 84) | def visualize( method save_video (line 130) | def save_video(self, video, filename, writer=None, step=0): method draw_tracks_on_video (line 159) | def draw_tracks_on_video( method _draw_pred_tracks (line 281) | def _draw_pred_tracks( method _draw_gt_tracks (line 312) | def _draw_gt_tracks(