[Question]: 跑AltDiffusion-m18模型推理时报错
smallhackeryifa opened this issue · comments
Description
在AltDiffusion-m18目录下执行generate.py文件报如下错误
******************** text2img altdiffusion-m18
LatentDiffusion: Running in eps-prediction mode
DiffusionWrapper has 865.91 M params.
No module 'xformers'. Proceeding without it.
making attention of type 'vanilla' with 512 in_channels
Working with z of shape (1, 4, 32, 32) = 4096 dimensions.
making attention of type 'vanilla' with 512 in_channels
Traceback (most recent call last):
File "/root/FlagAI/examples/AltDiffusion-m18/generate.py", line 11, in
loader = AutoLoader(task_name="text2img", #contrastive learning
File "/root/miniconda3/envs/FlagAI/lib/python3.9/site-packages/flagai/auto_model/auto_loader.py", line 216, in init
self.model = getattr(LazyImport(self.model_name[0]),
File "/root/miniconda3/envs/FlagAI/lib/python3.9/site-packages/flagai/model/base_model.py", line 178, in from_pretrain
return load_diffusion_local(yaml_path, only_download_config=only_download_config, **kwargs)
File "/root/miniconda3/envs/FlagAI/lib/python3.9/site-packages/flagai/model/base_model.py", line 166, in load_diffusion_local
model = cls(**kwargs)
File "/root/miniconda3/envs/FlagAI/lib/python3.9/site-packages/flagai/model/mm/AltDiffusionM18.py", line 569, in init
self.instantiate_cond_stage(cond_stage_config)
File "/root/miniconda3/envs/FlagAI/lib/python3.9/site-packages/flagai/model/mm/AltDiffusionM18.py", line 645, in instantiate_cond_stage
model = instantiate_from_config(config)
File "/root/miniconda3/envs/FlagAI/lib/python3.9/site-packages/flagai/model/mm/utils.py", line 112, in instantiate_from_config
return get_obj_from_str(config["target"])(**config.get("params", dict()))
File "/root/miniconda3/envs/FlagAI/lib/python3.9/site-packages/flagai/model/mm/modeling_berts_m18.py", line 61, in init
self.roberta = AltRobertaModel(config, add_pooling_layer=False)
File "/root/miniconda3/envs/FlagAI/lib/python3.9/site-packages/flagai/model/mm/modeling_altclip.py", line 909, in init
self.post_init()
File "/root/miniconda3/envs/FlagAI/lib/python3.9/site-packages/transformers/modeling_utils.py", line 1034, in post_init
self.init_weights()
File "/root/miniconda3/envs/FlagAI/lib/python3.9/site-packages/transformers/modeling_utils.py", line 1486, in init_weights
self.apply(self._init_weights)
File "/root/miniconda3/envs/FlagAI/lib/python3.9/site-packages/torch/nn/modules/module.py", line 884, in apply
module.apply(fn)
File "/root/miniconda3/envs/FlagAI/lib/python3.9/site-packages/torch/nn/modules/module.py", line 884, in apply
module.apply(fn)
File "/root/miniconda3/envs/FlagAI/lib/python3.9/site-packages/torch/nn/modules/module.py", line 885, in apply
fn(self)
File "/root/miniconda3/envs/FlagAI/lib/python3.9/site-packages/transformers/modeling_utils.py", line 1149, in _init_weights
raise NotImplementedError(f"Make sure _init_weights
is implemented for {self.class}")
NotImplementedError: Make sure _init_weights
is implemented for <class 'flagai.model.mm.modeling_altclip.AltRobertaModel'>
Alternatives
No response
没能复现出这个错,能确认用的最新的代码吗