hyao1 / GLAD

The official code of "GLAD: Towards Better Reconstruction with Global and Local Adaptive Diffusion Models for Unsupervised Anomaly Detection"
54 stars 3 forks source link

作者您好,我训练完数据后,生成如下文件,未见pytorch_model.bin,导致无法进行测试 #8

Open isyzwang opened 1 month ago

isyzwang commented 1 month ago

image

hyao1 commented 1 month ago

你可能下载了新版本的accelerate,默认保存模型变为了safetensors格式。图中的model.safetensors就是训练好的模型,你可以直接加载这个模型参数。

isyzwang commented 1 month ago

是这样改吗? image 还是报错了! image

hyao1 commented 1 month ago

尝试这样加载: from safetensors.torch import load_file

val_pipe.unet.load_state_dict(load_file(args.output_dir + f"/checkpoint-{checkpoint_step}/unet_target/diffusion_pytorch_model.safetensors"))