Kwai-Kolors / Kolors

Kolors Team
Apache License 2.0
3.43k stars 219 forks source link

sample_ipadapter_plus 's error: Input type (torch.cuda.HalfTensor) and weight type (torch.HalfTensor) should be the same #72

Open ChenTao98 opened 1 month ago

ChenTao98 commented 1 month ago

In the code of sample_ipadapter_plus.py ,if comments pipe.enable_model_cpu_offload(),there is error: Input type (torch.cuda.HalfTensor) and weight type (torch.HalfTensor) should be the same. How can I load all the weight into cuda, not retain some weight in cpu.

    pipe = pipe.to("cuda")
    #pipe.enable_model_cpu_offload()

    if hasattr(pipe.unet, 'encoder_hid_proj'):
        pipe.unet.text_encoder_hid_proj = pipe.unet.encoder_hid_proj

    pipe.load_ip_adapter( f'{root_dir}/weights/Kolors-IP-Adapter-Plus' , subfolder="", weight_name=["ip_adapter_plus_general.bin"])