Importing transformers causes segmentation fault when setting cuda device
See original GitHub issue🐛 Bug
Information
The problem arises when using: my own modified scripts: (give details below)
To reproduce
import torch
import transformers
def main(local_rank):
torch.cuda.set_device(local_rank)
device = torch.device('cuda', local_rank)
if __name__ == "__main__":
print (torch.__version__)
print (transformers.__version__)
print (torch.cuda.is_available())
main(0)
Expected behavior
1.4.0
2.11.0
True
Segmentation fault (core dumped)
if commenting out import transformers
, everything will be fine.
Environment info
transformers
version: 2.11.0- Platform: linux
- Python version: 3.6.8
- PyTorch version (GPU?): 1.4.0 GPU
- Tensorflow version (GPU?): None
- Using GPU in script?: Yes
- Using distributed or parallel set-up in script?: No
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:10 (1 by maintainers)
Top Results From Across the Web
Segmentation fault error in importing sentence_transformers ...
I fixed the issue by changing the pytorch version from 1.4.0 to 1.6.0. So the requirements.txt looks like this:
Read more >Troubleshoot - Hugging Face
Troubleshoot. Sometimes errors occur, but we are here to help! This guide covers some of the most common issues we've seen and how...
Read more >Core dumped when training, no error messages
Thread 32 "python" received signal SIGSEGV, Segmentation fault. ... Reproduction of an issue causing a core dump on Pytorch (1.8.1+cu111) ...
Read more >trax-ml/community - Gitter
import trax Segmentation fault (core dumped) root@f414b9a83bb9:/# python3 ... is retained if set previously) ARG ARCH ARG CUDA ARG CUDNN=7.6.5.32-1 ARG ...
Read more >NVIDIA Deep Learning TensorRT Documentation
NVIDIA ® TensorRT™ is an SDK that facilitates high-performance machine learning ... TensorRT ships with an ONNX parser library to assist in importing...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I have met the exactly same problem with you, and did you find the root cause? is this issue same to report ‘fix segmentation fault’ #2207? The following were my test results with different versions:
BTW, is there a torch release of ‘1.5.1+cuda10.0’? Thanks.
EDIT: This problem is caused by the sentencepiece dependency. It goes away if I comment out all references to this dependency. This will break
xlnet
,xlm_roberta
,marian
,t5
,albert
,reformer
, andcamembert
, but if you are using any of the non-sentencepiece models, this should solve your problem.