in scripts/launcher_distributed.py [0:0]
def download_model(model_id: str, model_dir: str, ignore_patterns: str = "") -> None:
"""
Download a model if necessary.
Args:
model_output_folder (str): The folder to store the downloaded model.
args (argparse.Namespace): Command-line arguments.
"""
if ignore_patterns == "":
full_command = f"tune download {model_id} --output-dir {model_dir} --hf-token {args.hf_token} --ignore-patterns None"
else:
full_command = f'tune download {model_id} --output-dir {model_dir} --hf-token {args.hf_token} --ignore-patterns "{ignore_patterns}"'
if not args.use_downloaded_model:
print("Downloading model...")
# delete_model_artifacts=f'rm -rf {model_dir}/*'
# run_command(delete_model_artifacts)
list_models = f"ls -ltr {model_dir}"
run_command(list_models)
run_command(full_command)
else:
print("Using existing downloaded model.")