[BugFix] Fix MammothModa2 Text-to-Image Bug (#4299)
Signed-off-by: menjiantong <menjiantong@foxmail.com> Co-authored-by: menjiantong <menjiantong@foxmail.com> Co-authored-by: Didan Deng <33117903+wtomin@users.noreply.github.com>
This commit is contained in:
4 files changed
+116
-5
No files matched your search
@@ -231,7 +231,8 @@ class Mammothmoda2Config(PretrainedConfig):
|
||||
architectures: list[str] | None = None,
|
||||
**kwargs,
|
||||
) -> None:
|
||||
super().__init__(**kwargs)
|
||||
# Must set llm_config before super().__init__() because the parent's
|
||||
# validation calls get_text_config() which accesses self.llm_config
|
||||
self.llm_config = AutoConfig.for_model(**llm_config) if llm_config is not None else None
|
||||
self.gen_vae_config = gen_vae_config
|
||||
self.gen_dit_config = gen_dit_config
|
||||
@@ -245,8 +246,13 @@ class Mammothmoda2Config(PretrainedConfig):
|
||||
self.tokenizer_class = "MammothUTokenizer"
|
||||
self.architectures = ["Mammothmoda2Model"]
|
||||
|
||||
super().__init__(**kwargs)
|
||||
|
||||
def get_text_config(self, decoder: bool = False) -> PretrainedConfig: # noqa: ARG002
|
||||
return self.llm_config
|
||||
if self.llm_config is None:
|
||||
return None
|
||||
# llm_config is a Mammothmoda2Qwen2_5_VLConfig which has nested text_config
|
||||
return self.llm_config.text_config
|
||||
|
||||
def _require_llm_config(self) -> PretrainedConfig:
|
||||
if self.llm_config is None:
|
||||
|
||||
Reference in new issue
Block a user