avoid malloc all missing keys in fp32 (#8600)

This commit is contained in:
Zhao Changmin 2023-07-25 09:48:51 +08:00 committed by GitHub
parent 3f24202e4c
commit af201052db

View file

@ -115,6 +115,9 @@ class _BaseAutoModelClass:
# Speed up when loading model
kwargs["low_cpu_mem_usage"] = True
# set default torch_dtype='auto'
kwargs["torch_dtype"] = kwargs.get("torch_dtype", 'auto')
qtype = ggml_tensor_qtype[bigdl_transformers_low_bit]
# Note that the int4 linear layers cannot currently
# be recorded in huggingface Pretrained Model or AutoConfig,
@ -125,8 +128,6 @@ class _BaseAutoModelClass:
# Avoid KeyError
kwargs["ignore_mismatched_sizes"] = True
# Avoid reading from local file at the first initialization
kwargs["state_dict"] = {}
# Maybe needed when extract_local_archive_file
subfolder = kwargs.get("subfolder", "")