Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Misc]: issue with loading weights from safetensors files #211

Open
huijjj opened this issue Aug 28, 2024 · 4 comments
Open

[Misc]: issue with loading weights from safetensors files #211

huijjj opened this issue Aug 28, 2024 · 4 comments
Labels
external Issues or PRs submitted by external users

Comments

@huijjj
Copy link

huijjj commented Aug 28, 2024

Anything you want to discuss about vllm.

While implementing disaggregated prefill, we found an error regarding loading weights from safetensors files. We have filed a JIRA ticket(HS-3164) as we believe this is a synapseAI bug.

However, we found out that the code in vllm-fork is currently doing the same thing: loading safetensors file under torch.device(“hpu”) context, without involving any significant errors.

We’ll be very glad to know what made this possible, please let us know if we are missing something.

FYI, we are using IDC node with synapseAI version 1.17.0.

@huijjj
Copy link
Author

huijjj commented Aug 29, 2024

import torch

import habana_frameworks.torch as htorch

from safetensors import safe_open
from safetensors.torch import save_file

if __name__ == "__main__":
    safetensor_file_path = "tmp.safetensors"

    # create safetensors file
    save_file({"foo": torch.randn(10)}, safetensor_file_path)

    # load safetensors file
    with torch.device("hpu"):
        f = safe_open(safetensor_file_path, framework="pt")
        foo = f.get_tensor("foo")
        # following line yields error in hpu LAZY mode,
        print(foo) # RuntimeError: Reshape doesnt support change in number of elements: [40] Size of output: [10]

This is the minimal reproducer code of the torch.device context + safetensors.safe_open runtime error, just in case if you don't have access to the JIRA ticket.

@kzawora-intel kzawora-intel added the external Issues or PRs submitted by external users label Aug 29, 2024
@michalkuligowski
Copy link

Hi, we are testing potential fix for that, we will update soon

@huijjj
Copy link
Author

huijjj commented Sep 18, 2024

@michalkuligowski
Thanks for the update, glad to know that issue is being tracked and will be fixed in near future.

@michalkuligowski
Copy link

Hi, the fix will be provided in v1.19

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
external Issues or PRs submitted by external users
Projects
None yet
Development

No branches or pull requests

3 participants