-
Notifications
You must be signed in to change notification settings - Fork 974
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
模型转为diffusers有精度损失 #655
Comments
这个模型应该用FP16进行转换和推理,在转换的时候,应该用FP32载VAE模块。 |
刚才代码发错了。应该不是数据格式问题,以下是转化代码,还是有精度损失
transformer转化直接跑不起来,需要手动移除一些算子 |
跑不起来的报错事? |
这行代码改为False能正常跑transformer.load_state_dict(original_state_dict, strict=False) 不然需要移除conditioner和first_stage_model算子,对于cogvideo 5b还需要移除patch_embed.pos_embedding才能加载 但是2b转模型后会多生成物体,或者生成物体的位置不对,例如杯子放在了桌子旁边空中 |
System Info / 系統信息
diffusers:0.32.dev0
cuda:12.0
Information / 问题信息
Reproduction / 复现过程
使用convert_weight_sat2hf.py转化2b全参微调的模型,然后用下面命令加载推理,视频有较大的精度损失
pipe = CogVideoXPipeline.from_pretrained(args.pretrained_model_name_or_path, torch_dtype=torch.float16).to(device)
pipe.scheduler = CogVideoXDPMScheduler.from_config(pipe.scheduler.config, timestep_spacing="trailing")
Expected behavior / 期待表现
模型转化后无太大精度损失
The text was updated successfully, but these errors were encountered: