FileExistsError: [Errno 17] File exists: 'output_model/feature_extractor'

#37
by GAS17 - opened

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'

GAS17 changed discussion status to closed

@GAS17 , I'm seeing the same error in the logs after using a custom base model — were you able to figure out a solution??

GAS17 changed discussion status to open

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.

Sign up or log in to comment