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
RuntimeError: CUDA error: device-side assert triggered - is_global_attn = is_index_global_attn.flatten().any().item() #99
Comments
This line is unlikely to be the reason for the error. Try |
For some reason it's failing when it's trying to compute token type embeddings. I'm not passing token type and, according to the BERT code, it should create a zero tensor as token type. Any idea what can cause this?
|
probably you need to set |
I tried type_vocab_size zero and 1 last night, but that did not help. Let me check the shape of the tensor.
|
Not just the shapes. Also, make sure values in |
The input parameters of token_type_embeddings are: config.type_vocab_size: 0 and token_type_embeddings config.hidden_size: 768 This is the shape of token_type_ids that is passed to token_type_embeddings, when it fails: I have explicitly set token_type_ids to zero by removing the if condition: https://github.com/huggingface/transformers/blob/master/src/transformers/modeling_bert.py#L205-L206
The config at the point BertEmbeddings is being initialized: https://github.com/huggingface/transformers/blob/master/src/transformers/modeling_bert.py#L180
|
I tried with type_vocab_size set to 1 and 2, and I get the same error when it's trying to embed the types! I'm thinking about removing type embedding all together, as I do not think that applies to RoBERTa ...
|
I removed token_type_embeddings logic, and now it fails with the same error when it's trying to add inputs_embeds and position_embeddings!! The sizes seem to match:
|
Do you still have Do you have a small code snippet to reproduce the error? |
Yea, let me start with a clean workspace and come up with minimal code to reproduce this. It might help me to pin-point the issue as well. |
Using the following notebook cells and any line-by-line text data stored in
|
In RoBERTa model, for some reasons (potentially for backwards compatibility reasons), the pad ids is added to the position id. For this case, I was using a PAD ID that was not zero, and this was causing the ids to go beyond the embedding index limit and that was causing this issue. Thanks ibeltagy@ for your help on this. https://github.com/huggingface/transformers/blob/master/src/transformers/modeling_roberta.py#L804 |
Glad you figured it out. |
I'm trying to train a new model from scratch where it's length is 1024 (using huggingface implementation of longformer), but I get the following exception at a line that is recently added:
I tried Reformer and it worked as expected. The Longfomer config is as follows?
Any idea what the issue is?
The text was updated successfully, but these errors were encountered: