-
Notifications
You must be signed in to change notification settings - Fork 585
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use --resume, error:FileNotFoundError: [Errno 2] No such file or directory: '.cfg' #378
Comments
I see the code, why opt.cfg = ''? |
I ran into the same issue. It appears, that the config file is needed regardless of whether a checkpoint is loaded:
To me it seems like, the plan originally was to save (and serialize) the config together with the model here:
This is similar to what has been done here However, the config is not save in the ckpt at the moment, which is why the *.cfg file is needed. I feel like this is a good idea, though. TLDR:
|
Continue training with the following code? I will try it. |
At least that worked for me. Be aware though that once you've tried to continue training without that change to the code, the script will override your hyperparameters.yaml file. Therefore, the cfg entry (in the .yaml) will be empty (cfg=''). You might have to fix that too... |
ok, thx. |
with open(save_dir / 'opt.yaml', 'w') as f:
yaml.dump(vars(opt), f, sort_keys=False) It doesn't look like the dump yaml is being written here. |
where is the code? |
Lines 57 to 60 in eb5f166
|
I check the run/train/name/ the opt.yaml has saved during training, but not loaded when use --resume |
|
it not work for me |
|
This problem is caused by # Resume
if opt.resume: # resume an interrupted run
ckpt = opt.resume if isinstance(opt.resume, str) else get_latest_run() # specified or most recent path
assert os.path.isfile(ckpt), 'ERROR: --resume checkpoint does not exist'
cfg = opt.cfg if opt.cfg is not None else '' ###################ADD#######################
with open(Path(ckpt).parent.parent / 'opt.yaml') as f:
opt = argparse.Namespace(**yaml.load(f, Loader=yaml.FullLoader)) # replace
opt.cfg, opt.weights, opt.resume = cfg, ckpt, True ###################CHANGE#######################
logger.info('Resuming training from %s' % ckpt) It works for me, anyway. |
I use the command: python train.py --device 0 --batch-size 4 --img 640 640 --cfg cfg/yolov4-pacsp-x-mish.cfg --data data/mydata.yaml --weight weights/yolov4-csp-x-mish.weights --name yolov4-pacsp-x-mish --resume, but had the error:Use --resume, error:FileNotFoundError: [Errno 2] No such file or directory: '.cfg'
So what is happen? My command is inaccurate?
The text was updated successfully, but these errors were encountered: