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

Update flag_models.py to fix is_torch_npu_available as a function call #473

Merged
merged 1 commit into from
Feb 21, 2024
Merged

Conversation

MeTaNoV
Copy link
Contributor

@MeTaNoV MeTaNoV commented Feb 21, 2024

On a Colab Notebook, I stumbled upon:

/usr/local/lib/python3.10/dist-packages/FlagEmbedding/flag_models.py in init(self, model_name_or_path, use_fp16)
139 self.device = torch.device("mps")
140 elif is_torch_npu_available:
--> 141 self.device = torch.device("npu")
142 else:
143 self.device = torch.device("cpu")

RuntimeError: Expected one of cpu, cuda, ipu, xpu, mkldnn, opengl, opencl, ideep, hip, ve, fpga, ort, xla, lazy, vulkan, mps, meta, hpu, mtia, privateuseone device type at start of device string: npu

On a Colab Notebook, I stumbled upon:

/usr/local/lib/python3.10/dist-packages/FlagEmbedding/flag_models.py in __init__(self, model_name_or_path, use_fp16)
    139             self.device = torch.device("mps")
    140         elif is_torch_npu_available:
--> 141             self.device = torch.device("npu")
    142         else:
    143             self.device = torch.device("cpu")

RuntimeError: Expected one of cpu, cuda, ipu, xpu, mkldnn, opengl, opencl, ideep, hip, ve, fpga, ort, xla, lazy, vulkan, mps, meta, hpu, mtia, privateuseone device type at start of device string: npu
@staoxiao
Copy link
Collaborator

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants