Skip to content

Got unsupported ScalarType BFloat16 when saving delta tuned model #80

@arwen-c

Description

@arwen-c

When training MiniCPM (https://huggingface.co/openbmb/MiniCPM-2B-sft-bf16/) using OpenDelta, I ran into a type conversion error when saving the model delta_model.save_finetuned("./delta_model"):

File "/opendelta/utils/model_md5.py", line 26, in gen_parameter_hash
md5.update(x.cpu().numpy().data.tobytes())
TypeError: Got unsupported ScalarType BFloat16

I fixed it locally importing torch and modifying the line to md5.update(x.cpu().to(torch.float32).numpy().data.tobytes()), but there may be other users running into this same issue

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions