FlagEmbedding example returns [[nan nan] [nan nan]]

#2
by hcnhcn012 - opened

I follow the example, but either embeddings_1 nor embeddings_2 returns all nans in the array, thanks for helping

Hello, @hcnhcn012 ! Could you provide more details? For example, the machine (CPU/GPU) or the float precision (fp32/fp16/bf16) you used. Then I will check the possible cause of the problem.

@hcnhcn012
I had this issue when using SentenceTransformers. I found that setting model_kwargs={"torch_dtype": torch.float16} as shown in the examples seems to prevent this issue.

@hcnhcn012
I had this issue when using SentenceTransformers. I found that setting model_kwargs={"torch_dtype": torch.float16} as shown in the examples seems to prevent this issue.

@hliusonmsft Yes it works, thanks

Hello, @hcnhcn012 ! Could you provide more details? For example, the machine (CPU/GPU) or the float precision (fp32/fp16/bf16) you used. Then I will check the possible cause of the problem.

@hanhainebula my gpu is Nvidia-L20, and using default float precision when calling FlagEmbedding, but it worked well when i turned to SentenceTransformers API

Sign up or log in to comment