fix: Attempt to remove potential TOCTOU
This commit is contained in:
parent
f7dda38b10
commit
670e1c373b
1 changed files with 3 additions and 3 deletions
|
@ -109,12 +109,12 @@ for model in models:
|
||||||
model_config_path = f"{model_name_or_path}/config.json"
|
model_config_path = f"{model_name_or_path}/config.json"
|
||||||
|
|
||||||
# check dir path
|
# check dir path
|
||||||
if not os.path.exists(model_name_or_path): # TOCTOU
|
if os.path.exists(model_name_or_path): # Still TOCTOU?
|
||||||
os.makedirs(model_name_or_path)
|
|
||||||
else:
|
|
||||||
logger.info(f"Directory {model_name_or_path} already exists - skipping")
|
logger.info(f"Directory {model_name_or_path} already exists - skipping")
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
os.makedirs(model_name_or_path, exist_ok=True)
|
||||||
|
|
||||||
logger.info(f"Downloading {name} to {model_name_or_path}")
|
logger.info(f"Downloading {name} to {model_name_or_path}")
|
||||||
|
|
||||||
# model and repo urls are not the same
|
# model and repo urls are not the same
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue