I loaded this BertTokenizer previously, but now it is showing, I have to make sure I don't have a local directory. In my kaggle kernel, I don't have this local directory. How to solve it?

class Config:
    DEVICE = "cuda" if torch.cuda.is_available() else "cpu"
    LR = 2e-5
    EPOCHS = 10
    N_FOLD = 5
    TOKENIZER = BertTokenizer.from_pretrained('bert-large-uncased', do_lower_case=True)
    CLASSES = 3
    MAX_LEN = 200
    TRAIN_CSV = ".csv"
    TEST_CSV = "test.csv"
    API = "#"
    PROJECT_NAME = "bert-base2"
    MODEL_NAME = "bert-large-uncased"
OSError: Can't load tokenizer for 'bert-large-uncased'. If you were trying to load it from 'https://huggingface.co/models', make sure you don't have a local directory with the same name. Otherwise, make sure 'bert-large-uncased' is the correct path to a directory containing all relevant files for a BertTokenizer tokenizer.

1 Answer 1


It could be due to an internet connection issue, that's why it is always safer to download your model in a local folder first and then load it directly using the absolute path.

In addition to that bert large is about 2Gb.

To download it, you can use this code:

git lfs install
git clone https://huggingface.co/bert-large-uncased

See also: https://huggingface.co/bert-large-uncased


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.