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

Bus error (core dumped) #1182

Open
yoh240404 opened this issue Nov 1, 2024 · 9 comments
Open

Bus error (core dumped) #1182

yoh240404 opened this issue Nov 1, 2024 · 9 comments

Comments

@yoh240404
Copy link

yoh240404 commented Nov 1, 2024

用的示例代码

from FlagEmbedding import FlagAutoModel
import argparse
import json
import random
import numpy as np
import faiss
from tqdm import tqdm
from FlagEmbedding import FlagModel


if __name__` == '__main__':
    model_path = "./base-model/BAAI/bge-base-en-v1.5"

    # model = FlagAutoModel.from_finetuned(model_path,
    #                                       query_instruction_for_retrieval="Represent this sentence for searching relevant passages:",
    #                                       use_fp16=True)
    
    model = FlagModel(model_path, query_instruction_for_retrieval="Represent this sentence for searching relevant passages:")

    sentences_1 = ["I love NLP", "I love machine learning"]
    sentences_2 = ["I love BGE", "I love text retrieval"]
    print(3)
    embeddings_1 = model.encode(sentences_1, batch_size=256)
    print(4)
    embeddings_2 = model.encode(sentences_2, batch_size=256)
    print(5)
    similarity = embeddings_1 @ embeddings_2.T
    print(similarity)

报错如下:

>>> 3
Bus error (core dumped)

旧的版本没有问题,今天clone的新版本出现这个问题。

@545999961
Copy link
Collaborator

测试了下代码,运行起来是没问题的,看起来像是访问地址有问题

@yoh240404
Copy link
Author

yoh240404 commented Nov 4, 2024 via email

@545999961
Copy link
Collaborator

Bus error (core dumped)

看起来像是内存访问的问题,调用huggingface模块或者sentence transformers的代码可以正常运行吗

@yoh240404
Copy link
Author

yoh240404 commented Nov 4, 2024 via email

@ShenweiXie
Copy link

I've encounter the same issues, have you fixed this?

@545999961
Copy link
Collaborator

I've encounter the same issues, have you fixed this?

May I ask what the model of the machine is?

@yoh240404
Copy link
Author

I've encounter the same issues, have you fixed this?

脚本运行前指定卡号即可

@hanhainebula
Copy link
Contributor

I've encounter the same issues, have you fixed this?

脚本运行前指定卡号即可

你好,方便问一下是使用的多GPU还是单GPU吗,我们这边现在想知道这个报错的具体原因看是否需要做特定的修复,谢谢!

@yoh240404
Copy link
Author

yoh240404 commented Nov 12, 2024

I've encounter the same issues, have you fixed this?

脚本运行前指定卡号即可

你好,方便问一下是使用的多GPU还是单GPU吗,我们这边现在想知道这个报错的具体原因看是否需要做特定的修复,谢谢!

单卡多卡都会出现,脚本运行前设一下系统变量就可以:

export CUDA_VISIBLE_DEVICES=1 python ./test.py [[0.6543 0.7573] [0.6562 0.7227]]

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

4 participants