MCPcopy
hub / github.com/showlab/Show-o / from_pretrained

Method from_pretrained

models/training_utils.py:117–124  ·  view source on GitHub ↗
(cls, path, model_cls)

Source from the content-addressed store, hash-verified

115
116 @classmethod
117 def from_pretrained(cls, path, model_cls) -> "EMA":
118 _, ema_kwargs = model_cls.load_config(path, return_unused_kwargs=True)
119 model = model_cls.from_pretrained(path)
120
121 ema_model = cls(model.parameters(), model_cls=model_cls, model_config=model.config)
122
123 ema_model.load_state_dict(ema_kwargs)
124 return ema_model
125
126 def save_pretrained(self, path):
127 if self.model_cls is None:

Callers 13

inference_mmu.pyFile · 0.45
inference_t2i.pyFile · 0.45
__init__Method · 0.45
__init__Method · 0.45
mainFunction · 0.45
mainFunction · 0.45
__init__Method · 0.45
__init__Method · 0.45
load_modelMethod · 0.45

Calls 1

load_state_dictMethod · 0.80

Tested by

no test coverage detected