Skip to content
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

add --fine-tune arg to train.py and test.py #90

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion parse_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,9 @@ def from_args(cls, args, options=''):
cfg_fname = Path(args.config)

config = read_json(cfg_fname)
if args.config and resume:
if args.config and resume and args.fine_tune:
# update new config for fine-tuning
# if not fine tune, the saved config will remain as it is
config.update(read_json(args.config))

# parse custom cli options into dictionary
Expand Down
2 changes: 2 additions & 0 deletions test.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ def main(config):
args = argparse.ArgumentParser(description='PyTorch Template')
args.add_argument('-c', '--config', default=None, type=str,
help='config file path (default: None)')
args.add_argument('-ft', '--fine-tune', default=False, type=bool,
help='fine tune pretrained model or not. If True, the saved config will be overridden by outer config')
args.add_argument('-r', '--resume', default=None, type=str,
help='path to latest checkpoint (default: None)')
args.add_argument('-d', '--device', default=None, type=str,
Expand Down
2 changes: 2 additions & 0 deletions train.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ def main(config):
args = argparse.ArgumentParser(description='PyTorch Template')
args.add_argument('-c', '--config', default=None, type=str,
help='config file path (default: None)')
args.add_argument('-ft', '--fine-tune', default=False, type=bool,
help='fine tune pretrained model or not. If True, the saved config will be overridden by outer config')
args.add_argument('-r', '--resume', default=None, type=str,
help='path to latest checkpoint (default: None)')
args.add_argument('-d', '--device', default=None, type=str,
Expand Down