OpenDelta icon indicating copy to clipboard operation
OpenDelta copied to clipboard

Got unsupported ScalarType BFloat16 when saving delta tuned model

Open Lauriane-git opened this issue 1 month ago • 0 comments

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

Lauriane-git avatar May 09 '24 01:05 Lauriane-git