MCPcopy Create free account
hub / github.com/OpenDriveLab/ReSim / __init__

Method __init__

sat/sgm/modules/diffusionmodules/openaimodel.py:527–934  ·  view source on GitHub ↗
(
        self,
        in_channels,
        model_channels,
        out_channels,
        num_res_blocks,
        attention_resolutions,
        dropout=0,
        channel_mult=(1, 2, 4, 8),
        conv_resample=True,
        dims=2,
        num_classes=None,
        use_checkpoint=False,
        use_fp16=False,
        num_heads=-1,
        num_head_channels=-1,
        num_heads_upsample=-1,
        use_scale_shift_norm=False,
        resblock_updown=False,
        use_new_attention_order=False,
        use_spatial_transformer=False,  # custom transformer support
        transformer_depth=1,  # custom transformer support
        context_dim=None,  # custom transformer support
        n_embed=None,  # custom support for prediction of discrete ids into codebook of first stage vq model
        legacy=True,
        disable_self_attentions=None,
        num_attention_blocks=None,
        disable_middle_self_attn=False,
        use_linear_in_transformer=False,
        spatial_transformer_attn_type="softmax",
        adm_in_channels=None,
        use_fairscale_checkpoint=False,
        offload_to_cpu=False,
        transformer_depth_middle=None,
        dtype="fp32",
        lora_init=False,
        lora_rank=4,
        lora_scale=1.0,
        lora_weight_path=None,
    )

Source from the content-addressed store, hash-verified

525 """
526
527 def __init__(
528 self,
529 in_channels,
530 model_channels,
531 out_channels,
532 num_res_blocks,
533 attention_resolutions,
534 dropout=0,
535 channel_mult=(1, 2, 4, 8),
536 conv_resample=True,
537 dims=2,
538 num_classes=None,
539 use_checkpoint=False,
540 use_fp16=False,
541 num_heads=-1,
542 num_head_channels=-1,
543 num_heads_upsample=-1,
544 use_scale_shift_norm=False,
545 resblock_updown=False,
546 use_new_attention_order=False,
547 use_spatial_transformer=False, # custom transformer support
548 transformer_depth=1, # custom transformer support
549 context_dim=None, # custom transformer support
550 n_embed=None, # custom support for prediction of discrete ids into codebook of first stage vq model
551 legacy=True,
552 disable_self_attentions=None,
553 num_attention_blocks=None,
554 disable_middle_self_attn=False,
555 use_linear_in_transformer=False,
556 spatial_transformer_attn_type="softmax",
557 adm_in_channels=None,
558 use_fairscale_checkpoint=False,
559 offload_to_cpu=False,
560 transformer_depth_middle=None,
561 dtype="fp32",
562 lora_init=False,
563 lora_rank=4,
564 lora_scale=1.0,
565 lora_weight_path=None,
566 ):
567 super().__init__()
568 from omegaconf.listconfig import ListConfig
569
570 self.dtype = str_to_dtype[dtype]
571
572 if use_spatial_transformer:
573 assert (
574 context_dim is not None
575 ), "Fool!! You forgot to include the dimension of your cross-attention conditioning..."
576
577 if context_dim is not None:
578 assert (
579 use_spatial_transformer
580 ), "Fool!! You forgot to use the spatial transformer for your cross-attention conditioning..."
581 if type(context_dim) == ListConfig:
582 context_dim = list(context_dim)
583
584 if num_heads_upsample == -1:

Callers

nothing calls this directly

Calls 15

_init_loraMethod · 0.95
linearFunction · 0.85
TimestepClass · 0.85
conv_ndFunction · 0.85
AttentionBlockClass · 0.85
normalizationFunction · 0.85
appendMethod · 0.80
ResBlockClass · 0.70
DownsampleClass · 0.70
UpsampleClass · 0.70
zero_moduleFunction · 0.70

Tested by

no test coverage detected