Comments (6)
@fenneccat 디폴트로 gpu를 사용하라고 되어있습니다. SentenceTransformer(model_path, device='cpu')
로 cpu를 사용하라고 하시면 됩니다.
from kosentencebert-skt.
@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.
@fenneccat 아마 현재 import되고 있는 SentenceTransformer가 requirement.txt로 설치된 다른 경로의 메소드가 호출되고 있을 것 같습니다. 현 깃헙에서 제공하고있는 sentence_transformers 안의 SentenceTransformer를 호출하기 위해서는 경로를 다시 설정하여 import하면 위의 에러가 나지 않습니다.
#5 (comment)
from kosentencebert-skt.
말씀해주신 #5 코멘트도 확인했습니다.
그런데 SentenceTransformer 경로문제가 아닌것같아서 다시 여쭤봅니다.
그림에서와 같이
~/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.
SentenceTransformer(model_path, device='cpu')
는 잘 동작하는 것으로 확인 되었습니다.
python3.6 -> python3.7로 python을 upgrade 해보세요.
from kosentencebert-skt.
버전문제인건지 뭔가 계속 문제가 생겨서 3.7로 업데이트해도 안되더라고요.
./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)
- tokenizers init HOT 1
- 모델 load시 "TypeError: __init__() got an unexpected keyword argument 'return_dict'" 오류 발생 HOT 1
- training_sts.zip 불러오기 오류 HOT 3
- sentence_xlnet_config.json 오류
- sentence_xlncet_config.json 오류 HOT 4
- SemanticSearch.py tokenizers.tokenizers error+해결과정공유 HOT 15
- IndexError: index 16 is out of bounds for dimension 0 with size 16 HOT 5
- FileNotFoundError: [Errno 2] No such file or directory HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from kosentencebert-skt.