YapengTian / TDAN-VSR-CVPR-2020

TDAN: Temporally-Deformable Alignment Network for Video Super-Resolution, CVPR 2020
MIT License
400 stars 62 forks source link

Training with pre-trained model #15

Closed YoungJoongUNC closed 4 years ago

YoungJoongUNC commented 4 years ago

Hello! I wanted to load the model you provided for the evaluation (model.pt) and continue training. When I loaded it using the code in the eval.py, it shows following error. May I ask for an advice how could I solve this?

The code I am using in train.py is as follows:

model_factory = ModelFactory()
model = model_factory.create_model(args.model)
model_parameters = filter(lambda p: p.requires_grad, model.parameters())
params = sum([np.prod(p.size()) for p in model_parameters])
print(1.0 * params / (1000 * 1000))

# -- added code - load pretrained model
model_path = os.path.join('model', 'model.pt')
if not os.path.exists(model_path):
   raise Exception('Cannot find %s.' %model_path)
model = torch.load(model_path)
 # --- end of added code

The error I am getting is as follows: AttributeError: 'DataParallel' object has no attribute 'name'

Thank you!

YapengTian commented 4 years ago

There is no need to fine-tune the provided model. If you learn it from scratch, you could use fine-tuning to improve. In addition, there is already code for fine-tuning and you just add "--f" when training(please check arguments in train.py).

YoungJoongUNC commented 4 years ago

Thank you! It worked :)