MCPcopy Index your code
hub / github.com/VisionXLab/OF-Diff / __init__

Method __init__

ldm/models/diffusion/ddpm.py:1506–1527  ·  view source on GitHub ↗
(self,
                 concat_keys: tuple,
                 finetune_keys=("model.diffusion_model.input_blocks.0.0.weight",
                                "model_ema.diffusion_modelinput_blocks00weight"
                                ),
                 keep_finetune_dims=4,
                 # if model was trained without concat mode before and we would like to keep these channels
                 c_concat_log_start=None,  # to log reconstruction of c_concat codes
                 c_concat_log_end=None,
                 *args, **kwargs
                 )

Source from the content-addressed store, hash-verified

1504 """
1505
1506 def __init__(self,
1507 concat_keys: tuple,
1508 finetune_keys=("model.diffusion_model.input_blocks.0.0.weight",
1509 "model_ema.diffusion_modelinput_blocks00weight"
1510 ),
1511 keep_finetune_dims=4,
1512 # if model was trained without concat mode before and we would like to keep these channels
1513 c_concat_log_start=None, # to log reconstruction of c_concat codes
1514 c_concat_log_end=None,
1515 *args, **kwargs
1516 ):
1517 ckpt_path = kwargs.pop("ckpt_path", None)
1518 ignore_keys = kwargs.pop("ignore_keys", list())
1519 super().__init__(*args, **kwargs)
1520 self.finetune_keys = finetune_keys
1521 self.concat_keys = concat_keys
1522 self.keep_dims = keep_finetune_dims
1523 self.c_concat_log_start = c_concat_log_start
1524 self.c_concat_log_end = c_concat_log_end
1525 if exists(self.finetune_keys): assert exists(ckpt_path), 'can only finetune from a given checkpoint'
1526 if exists(ckpt_path):
1527 self.init_from_ckpt(ckpt_path, ignore_keys)
1528
1529 def init_from_ckpt(self, path, ignore_keys=list(), only_model=False):
1530 sd = torch.load(path, map_location="cpu")

Callers

nothing calls this directly

Calls 3

init_from_ckptMethod · 0.95
existsFunction · 0.90
__init__Method · 0.45

Tested by

no test coverage detected