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

The Ascend 310 P chip is very slow in embedding for the first time, and fast in the second and later. #1242

Open
zhaowenbin opened this issue Nov 18, 2024 · 1 comment

Comments

@zhaowenbin
Copy link

zhaowenbin commented Nov 18, 2024

This problem does not occur on the 910B, but occurs on the 310P.
Some codes are as follows:

from FlagEmbedding import FlagModel, FlagReranker
......
model = FlagModel(base_model_path, use_fp16=True)
......
// That's the step. It's slow for the first time, 50 or 60 seconds for the first time, and then 0.0 seconds for the next.
query_embedding = model.encode(text_data) 

Is it because there's no adaptation?

@zhaowenbin zhaowenbin changed the title 昇腾310P芯片首次跑embedding很慢,第二次及之后再跑就很快 ascend Nov 18, 2024
@zhaowenbin zhaowenbin changed the title ascend 昇腾310P芯片首次跑embedding很慢,第二次及之后再跑就很快 Nov 18, 2024
@zhaowenbin zhaowenbin reopened this Nov 18, 2024
@zhaowenbin zhaowenbin changed the title 昇腾310P芯片首次跑embedding很慢,第二次及之后再跑就很快 The Ascend 310 P chip is very slow in embedding for the first time, and fast in the second and later. Nov 20, 2024
@hanhainebula
Copy link
Collaborator

hanhainebula commented Nov 22, 2024

Hello, @zhaowenbin. This is normal since initializing multiple devices (refer to here) need some time. If the size of your text_data is small, you can add parameter devices="..." to use only one GPU to save the time for initializing multiple devices. The modified code:

from FlagEmbedding import FlagModel, FlagReranker
......
model = FlagModel(base_model_path, use_fp16=True, devices="...")  # `...` need to be replaced
......
// That's the step. It's slow for the first time, 50 or 60 seconds for the first time, and then 0.0 seconds for the next.
query_embedding = model.encode(text_data) 

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

No branches or pull requests

2 participants