Skip to content

Commit

Permalink
added finetune mode
Browse files Browse the repository at this point in the history
  • Loading branch information
awkrail committed Oct 2, 2024
1 parent c0f81be commit 8391af3
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion configs/dataset/tvsum.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ max_v_l: 1000
seed: 2018
lr: 0.001
lr_drop: 2000
n_epoch: 2000
n_epoch: 1000
bsz: 4
domains:
- BK
Expand Down
9 changes: 7 additions & 2 deletions training/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,11 @@
from easydict import EasyDict

class BaseOptions(object):
def __init__(self, model, dataset, feature):
def __init__(self, model, dataset, feature, resume):
self.model = model
self.dataset = dataset
self.feature = feature
self.resume = resume
self.opt = {}

@property
Expand All @@ -55,7 +56,11 @@ def parse(self):
self.opt = EasyDict(self.opt)

# result directory
self.opt.results_dir = os.path.join(self.opt.results_dir, self.model, self.dataset, self.feature)
if self.resume:
self.opt.results_dir = os.path.join(self.opt.results_dir, self.model, f"{self.dataset}_finetune", self.feature)
else:
self.opt.results_dir = os.path.join(self.opt.results_dir, self.model, self.dataset, self.feature)

self.opt.ckpt_filepath = os.path.join(self.opt.results_dir, self.opt.ckpt_filename)
self.opt.train_log_filepath = os.path.join(self.opt.results_dir, self.opt.train_log_filename)
self.opt.eval_log_filepath = os.path.join(self.opt.results_dir, self.opt.eval_log_filename)
Expand Down
2 changes: 1 addition & 1 deletion training/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ def check_valid_combination(dataset, feature):
is_valid = check_valid_combination(args.dataset, args.feature)

if is_valid:
option_manager = BaseOptions(args.model, args.dataset, args.feature)
option_manager = BaseOptions(args.model, args.dataset, args.feature, args.resume)
option_manager.parse()
option_manager.clean_and_makedirs()

Expand Down

0 comments on commit 8391af3

Please sign in to comment.