Skip to content
This repository was archived by the owner on May 4, 2026. It is now read-only.
This repository was archived by the owner on May 4, 2026. It is now read-only.

ipex-llm 不支持加载 safetensors,请教解决方案 #84

Description

@kevinelstri

`WEIGHTS_NAME = "pytorch_model.bin"
WEIGHTS_INDEX_NAME = "pytorch_model.bin.index.json"

def extract_local_archive_file(pretrained_model_name_or_path, subfolder, variant=None):
pretrained_model_name_or_path = str(pretrained_model_name_or_path)
if os.path.isfile(
os.path.join(pretrained_model_name_or_path, subfolder, _add_variant(WEIGHTS_NAME, variant))
):
# Load from a PyTorch checkpoint
archive_file = os.path.join(
pretrained_model_name_or_path, subfolder, _add_variant(WEIGHTS_NAME, variant)
)
return archive_file, False`

utils.py 中 WEIGHTS_NAME 固定写死了只能加载pytorch_model.bin
在模型加载实践中,无法加载 model.safetensors,提示 no file named pytorch_model.bin

请问有什么方法可以支持 safetensors 权重的加载,
目前使用将 safetensors转换成 pytorch_model.bin 仍然加载失败,源码中出现各种参数不存在

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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