add special tokens
Hello
I tried to add special tokens to bert tokenizer via add_special_tokens: 
```
tokenizer.add_special_tokens({'additional_special_tokens':['SS']})
```
But I got CUDA error
```
CUDA error: device-side assert triggered
```
The code runs without adding additional_special_tokens!
Any idea? 
Do you load everything (model, data) on GPU?

> Hello
> I tried to add special tokens to bert tokenizer via add_special_tokens:
> 
> ```
> tokenizer.add_special_tokens({'additional_special_tokens':['SS']})
> ```
> 
> But I got CUDA error
> 
> ```
> CUDA error: device-side assert triggered
> ```
> 
> The code runs without adding additional_special_tokens!
> Any idea?<|||||>Yes, I did. The code runs without this line : 
```
tokenizer.add_special_tokens({'additional_special_tokens':['SS']})
```
Do you think it is a resourcse issue? 
Thanks <|||||>I got this lately: 
```
/usr/local/lib/python3.6/dist-packages/torch/nn/functional.py in linear(input, weight, bias)
   1370         ret = torch.addmm(bias, input, weight.t())
   1371     else:
-> 1372         output = input.matmul(weight.t())
   1373         if bias is not None:
   1374             output += bias

RuntimeError: cublas runtime error : resource allocation failed at /pytorch/aten/src/THC/THCGeneral.cpp:216
```<|||||>Are you changing the #vocab count in the config as well?
<|||||>No, I did not. <|||||>you can check them with``` tokenizer.convert_ids_to_tokens(id)``` (I don’t remember exactly, but I think, from 100 to 1000 are free, maybe, from 5 to 1000 even free, crosscheck please, also it depends on the "case" of the model)
Generally there's a pack in the beginning and then somewhere in the between we have these free unused tokens..!<|||||>Try this,

```
### Let's load a model and tokenizer
model = BertForSequenceClassification.from_pretrained('bert-base-uncased')
tokenizer = BertTokenizer.from_pretrained('bert-base-uncased')

### Do some stuff to our model and tokenizer
# Ex: add new tokens to the vocabulary and embeddings of our model
tokenizer.add_tokens(['[SPECIAL_TOKEN_1]', '[SPECIAL_TOKEN_2]'])
model.resize_token_embeddings(len(tokenizer))
# Train our model
train(model)

### Now let's save our model and tokenizer to a directory
model.save_pretrained('./my_saved_model_directory/')
tokenizer.save_pretrained('./my_saved_model_directory/')

### Reload the model and the tokenizer
model = BertForSequenceClassification.from_pretrained('./my_saved_model_directory/')
tokenizer = BertTokenizer.from_pretrained('./my_saved_model_directory/')
```<|||||>Thank you, 
I missed this line. Silly mistake 
```
model.resize_token_embeddings(len(tokenizer))
```
it worked!<|||||>You can close the issue :)