CUDA error for long sentences?
See original GitHub issueHello,
I am using Sentence Transformers, specifically distiluse-base-multilingual-cased
, to compute semantic similarity for a list of sentences. I have been getting CUDA errors (last of which was CUDA error: CUBLAS_STATUS_ALLOC_FAILED when calling `cublasCreate(handle)`
) on a specific dataset, and after some investigation I realized this was due to a specific sentence of 2115 characters, which gets tokenized to 580 tokens. I am aware this is longer than the model max_seq_length
(which I set to 512), but I was expecting the sentence to be automatically truncated to the maximum length with no error arising.
Am I doing something wrong?
I am running version 0.3.2 (transformers version 3.0.2).
Issue Analytics
- State:
- Created 3 years ago
- Comments:11 (7 by maintainers)
Top Results From Across the Web
CUDA shared memory writes incur unexplainable long latency
The compiler is smart enough to determine that code which has no effect on a global or shared memory output is unneeded and...
Read more >6.33. Data types used by CUDA Runtime
This error indicates that a grid launch did not occur because the kernel uses file-scoped textures which are unsupported by the device runtime....
Read more >NVIDIA CUDA Library: cudaError
Common causes include dereferencing an invalid device pointer and accessing out of bounds shared memory. The device cannot be used until cudaThreadExit() is ......
Read more >Frequently Asked Questions - 5KK73 GPU Assignment 2012
1.1.1 Check Whether GPU Is Busy Using CUDA Error Code; 1.1.2 Autostart CUDA Kernel When ... 1.4 What If the GPU Is Occupied...
Read more >Cuda out of memory error - Intermediate - Hugging Face Forums
As @kkumari06 says, reduce batch size. I recommend restarting the kernel any time you get this error, to make sure you have a...
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 Free
Top 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
Try
Transformer models add up to 3 special tokens like [CLS] and/or [SEP] to your input sentence. So if your sentence is 512 tokens, and 3 special tokens are added, this would result in too many tokens passed to the transformers model.
I fix it by modify the Transformer class