mirror of https://github.com/explosion/spaCy.git
Check if the resume path points to a directory (#7919)
This came up in #7878, but if --resume-path is a directory then loading the weights will fail. On Linux this will give a straightforward error message, but on Windows it gives "Permission Denied", which is confusing.
This commit is contained in:
parent
de6b5ed14d
commit
8007d5c814
|
@ -95,6 +95,13 @@ def verify_cli_args(config_path, output_dir, resume_path, epoch_resume):
|
|||
"then the new directory will be created for you.",
|
||||
)
|
||||
if resume_path is not None:
|
||||
if resume_path.is_dir():
|
||||
# This is necessary because Windows gives a Permission Denied when we
|
||||
# try to open the directory later, which is confusing. See #7878
|
||||
msg.fail(
|
||||
"--resume-path should be a weights file, but {resume_path} is a directory.",
|
||||
exits=True,
|
||||
)
|
||||
model_name = re.search(r"model\d+\.bin", str(resume_path))
|
||||
if not model_name and not epoch_resume:
|
||||
msg.fail(
|
||||
|
|
Loading…
Reference in New Issue