Segmentation fault (core dumped)
Hi, 

   I downloaded pretrained model and vocabulary file， and wanted to test BertModel to get hidden states.
   when this
  ```encoded_layers, _ = model(tokens_tensor, segments_tensors)```  lines run,  I got this error:  Segmentation fault (core dumped).

   I wonder what caused this error
Hi, you need to give me more information (a screen copy of a full log of the error).<|||||>Actually, this is all I got:

>>  python bert.py
12/15/2018 19:43:06 - INFO - pytorch_pretrained_bert.tokenization -   loading vocabulary file /home/snow/bert_models_path/vocab.txt
12/15/2018 19:43:06 - INFO - pytorch_pretrained_bert.modeling -   loading archive file /home/snow/bert_models_path
12/15/2018 19:43:06 - INFO - pytorch_pretrained_bert.modeling -   Model config {
  "attention_probs_dropout_prob": 0.1,
  "hidden_act": "gelu",
  "hidden_dropout_prob": 0.1,
  "hidden_size": 768,
  "initializer_range": 0.02,
  "intermediate_size": 3072,
  "max_position_embeddings": 512,
  "num_attention_heads": 12,
  "num_hidden_layers": 12,
  "type_vocab_size": 2,
  "vocab_size": 30522
}

bert_models_path load!!!
Segmentation fault (core dumped)<|||||>There is no special c function in our package, it's all python code.
Maybe you just don't have enough memory to load BERT?
Or some dependency is not well installed like pytorch (or apex if you are using it).<|||||>Thanks for your advice.
Maybe because of my pytorch version(0.4.0) I not not sure.
I download the source code instead of pip install and using 0.4.1 version and run successfully.

Thanks for your code and advice again~<|||||>![图片](https://user-images.githubusercontent.com/26063832/57267682-8d160c00-70b3-11e9-9d59-5866c1321272.png)
I also have this problem, and my torch version is 1.0.1 . I have tried to download the source code instead of pip install but also failed.<|||||>I have the same question  @wyx518 <|||||>Did you solve this ? @zhaohongjie <|||||>@zhaohongjie did you solve this? I have the same question too.<|||||>Has someone solved this issue by any chance?
<|||||>> Has someone solved this issue by any chance?

Do you have the same problem? You could try to debug it by import transformers and torch only, then call torch.nn.CrossEntropyLoss() to see if it results in Segmentation fault. I accidentally fixed this error by install more packages<|||||>Hello,

Had this error with CamembertForSequenceClassification.from_pretrained(), needed to update torch==1.5.1 and torchvision==0.6.1  <|||||>I had the same issue while loading pretrained models.
Updated to the last version of Pytorch (1.5.1) and worked fine.<|||||>Yup, that worked guys! Thank you @Daugit and @gabrer <|||||>Update by pip install torch==1.5.1 and the problem solved