Giter Club home page Giter Club logo

Comments (6)

kayla220 avatar kayla220 commented on July 29, 2024

@fenneccat 디폴트로 gpu를 사용하라고 되어있습니다. SentenceTransformer(model_path, device='cpu')로 cpu를 사용하라고 하시면 됩니다.

from kosentencebert-skt.

fenneccat avatar fenneccat commented on July 29, 2024

@kayla220 device='cpu' 로 넘겨줘도 마찬가지로

RuntimeError: Attempting to deserialize object on a CUDA device but torch.cuda.is_available() is False. If you are running on a CPU-only machine, please use torch.load with map_location=torch.device('cpu') to map your storages to the CPU.

이러한 에러가 납니다. 내부 코드를 변경해야하는가요?

from kosentencebert-skt.

kayla220 avatar kayla220 commented on July 29, 2024

@fenneccat 아마 현재 import되고 있는 SentenceTransformer가 requirement.txt로 설치된 다른 경로의 메소드가 호출되고 있을 것 같습니다. 현 깃헙에서 제공하고있는 sentence_transformers 안의 SentenceTransformer를 호출하기 위해서는 경로를 다시 설정하여 import하면 위의 에러가 나지 않습니다.
#5 (comment)

from kosentencebert-skt.

fenneccat avatar fenneccat commented on July 29, 2024

말씀해주신 #5 코멘트도 확인했습니다.
그런데 SentenceTransformer 경로문제가 아닌것같아서 다시 여쭤봅니다.

스크린샷 2021-08-10 오전 10 09 25

스크린샷 2021-08-10 오전 10 09 39

그림에서와 같이
~/opt/anaconda3/envs/kosentence/lib/python3.6/site-packages/ 이부분에 깃 레포에 있는 sentencetransformers, transformers, tokenizer를 붙여넣기 하여 넣어주었는데

sentencetransformers 의 SentenceTransformers.py 파일을 보니 device를 argument로 받긴하는데 에러가 나는 부분인
module = module_class.load(os.path.join(model_path, module_config['path'])) 에서는 device정보를 넘겨주지 않고
에러메세지를 보면 Transformers.py 쪽에서 torch.load 하면서 gpu설정으로 불러와서 문제가 되는것 처럼 보입니다.

한번 확인해주시면 감사하겠습니다.

from kosentencebert-skt.

BM-K avatar BM-K commented on July 29, 2024

SentenceTransformer(model_path, device='cpu')는 잘 동작하는 것으로 확인 되었습니다.
python3.6 -> python3.7로 python을 upgrade 해보세요.

from kosentencebert-skt.

fenneccat avatar fenneccat commented on July 29, 2024

버전문제인건지 뭔가 계속 문제가 생겨서 3.7로 업데이트해도 안되더라고요.

https://stackoverflow.com/questions/56369030/runtimeerror-attempting-to-deserialize-object-on-a-cuda-device
에 나온대로

./site-package/torch/serialization.py 파일에
def load(f, map_location=None, pickle_module=pickle, **pickle_load_args):
이 함수를 그냥 cpu로 사용하도록 강제해줬습니다.
def load(f, map_location='cpu', pickle_module=pickle, **pickle_load_args):

from kosentencebert-skt.

Related Issues (9)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.