FileNotFoundError: [Errno 2] No such file or directory: 'cached_train_BertTokenizer_180.lock'
Author: Stimmot
Pull request: no

I want to train the model bert-base-german-cased on some documents, but when I try to run run_ner.py with the config.json it tells me, that it can't find the file mentioned above.
I don't quite know what's the issue here, because it worked the last time I tried. Do I have to tell the model it shouldn't use any cached files? I tried that with the overwrite_cache flag.
Does anyone have a clue what could be the problem?

Comments:
Hi! Could you provide the information related to your environment, as well as the command that you used to launch the script, as it's requested in the issue template? Thank you.

Yes sure!

- `transformers` version: 3.5.1
- Platform: Linux-5.9.1-kd-cluster-x86_64-with-glibc2.10
- Python version: 3.8.0
- PyTorch version (GPU?): 1.7.0 (True)
- Tensorflow version (GPU?): not installed (NA)
- Using GPU in script?: Yes
- Using distributed or parallel set-up in script?: No

Model I am using: BERT, specifically "bert-base-german-cased"

The problem arises when using:
* [x] the official example scripts: (give details below)
* [ ] my own modified scripts: (give details below)

The tasks I am working on is:
* [ ] an official GLUE/SQUaD task: (give the name)
* [x]  my own task or dataset: (give details below)

Traceback:
`Traceback (most recent call last):
  File "run_ner.py", line 324, in <module>
    main()
  File "run_ner.py", line 187, in main
    TokenClassificationDataset(
  File "/home/IAIS/tschmude/bert_remote/examples/token-classification/utils_ner.py", line 240, in __init__
    with FileLock(lock_path):
  File "/home/IAIS/tschmude/anaconda3/envs/bert_env_remote/lib/python3.8/site-packages/filelock.py", line 323, in __enter__
    self.acquire()
  File "/home/IAIS/tschmude/anaconda3/envs/bert_env_remote/lib/python3.8/site-packages/filelock.py", line 271, in acquire
    self._acquire()
  File "/home/IAIS/tschmude/anaconda3/envs/bert_env_remote/lib/python3.8/site-packages/filelock.py", line 384, in _acquire
    fd = os.open(self._lock_file, open_mode)
FileNotFoundError: [Errno 2] No such file or directory: '/home/tschmude/PycharmProjects/smart-sentencing/examples/token-classification/Data processing scripts/Data_Preprocessed/cached_train_BertTokenizer_180.lock'

## Expected behavior

I'm running `python run_ner.py Data/config.json` to train the model for custom NER recognition. I have a couple self defined labels. It has worked before, but I can't quite tell what has changed since then. I already deleted cached .lock files that I could find. 


Would you mind providing the `config.json` as well, given that it contains your launch command? Thank you!

Sure, this is my config.json:

`
{
    "data_dir": "/home/tschmude/PycharmProjects/smart-sentencing/examples/token-classification/Data processing scripts/Data_Preprocessed",
    "labels": "./Data/labels.txt",
    "model_name_or_path": "bert-base-german-cased",
    "output_dir": "./Data/Models",
    "task_type": "NER",
    "max_seq_length": 180,
    "num_train_epochs": 6,
    "per_device_train_batch_size": 48,
    "learning_rate": 0.001,
    "seed": 1,
    "overwrite_cache": true,
    "fp16": true,
    "do_train": true,
    "do_predict": true,
    "do_eval": true
}
`

Issue solved... it had to do with a dumb typo in the path, sorry for the confusion!

No problem, glad you solved your issue!