MCPcopy Create free account
hub / github.com/ali-vilab/ACE_plus / init_from_cfg

Method init_from_cfg

inference/ace_plus_diffusers.py:28–39  ·  view source on GitHub ↗
(self, cfg)

Source from the content-addressed store, hash-verified

26 self.output = {k.lower(): v for k, v in cfg.OUTPUT.items()}
27
28 def init_from_cfg(self, cfg):
29 self.max_seq_len = cfg.get("MAX_SEQ_LEN", 4096)
30 self.image_processor = ACEPlusImageProcessor(max_seq_len=self.max_seq_len)
31
32 local_folder = FS.get_dir_to_local_dir(cfg.MODEL.PRETRAINED_MODEL)
33
34 self.pipe = FluxFillPipeline.from_pretrained(local_folder, torch_dtype=torch.bfloat16).to(we.device_id)
35
36 tokenizer_2 = T5TokenizerFast.from_pretrained(os.path.join(local_folder, "tokenizer_2"),
37 additional_special_tokens=["{image}"])
38 self.pipe.tokenizer_2 = tokenizer_2
39 self.load_default(cfg.DEFAULT_PARAS)
40
41 def prepare_input(self,
42 image,

Callers 3

__init__Method · 0.80
change_modelMethod · 0.80
runFunction · 0.80

Calls 2

load_defaultMethod · 0.95

Tested by

no test coverage detected