FileExistsError: [Errno 17] File exists: 'output_model/feature_extractor'
Hi, I am training with my base model and I get this error, what is it due to?
File "app.py", line 302, in train
shutil.copytree(f"{safety_checker}/feature_extractor", "output_model/feature_extractor")
File "/home/user/.pyenv/versions/3.8.9/lib/python3.8/shutil.py", line 557, in copytree
return _copytree(entries=entries, src=src, dst=dst, symlinks=symlinks,
File "/home/user/.pyenv/versions/3.8.9/lib/python3.8/shutil.py", line 458, in _copytree
os.makedirs(dst, exist_ok=dirs_exist_ok)
File "/home/user/.pyenv/versions/3.8.9/lib/python3.8/os.py", line 223, in makedirs
mkdir(name, mode)
FileExistsError: [Errno 17] File exists: 'output_model/feature_extractor'
It is fixed now. This happened because the original model used for training does not have a safety checker - then it was added at the end. However a custom model may already have it. I fixed it by adding a dirs_exist_ok
parameter to the shutil.copytree
function which should ignore if the folder already exists.