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

about transfer learning #420

Open
rookiecoder-chen opened this issue May 20, 2020 · 4 comments
Open

about transfer learning #420

rookiecoder-chen opened this issue May 20, 2020 · 4 comments

Comments

@rookiecoder-chen
Copy link

Is it right for me to do this? The code works, but I don't know if this is the right process...
# Set up the regressor.
device = chainer.get_device(args.device)
model_path = os.path.join(args.in_dir, args.model_filename)
metrics_fun = {'mae': F.mean_absolute_error, 'rmse': rmse}
regressor = Regressor.load_pickle('result/pretrain_qm9.pkl', device=device)
mlp = MLP(out_dim=class_num, hidden_dim=args.unit_num)
predictor = regressor.predictor
new_predictor = GraphConvPredictor(predictor, mlp=mlp)
new_regressor = Regressor(new_predictor,lossfun=F.mean_squared_error,
metrics_fun=metrics_fun, device=device)

print('Training...')
run_train(new_regressor, dataset, valid=None, batch_size=args.batchsize, epoch=args.epoch, out=args.out,
          device=device, converter=megnet_converter, resume_path=None,
          extensions_list=[extensions.PlotReport(['main/loss', 'validation/main/loss'], 'epoch',
                                                 filename='-trans-megnet-full-loss.svg', marker='None'),
                           extensions.PlotReport(['main/rmse', 'validation/main/rmse'], 'epoch',
                                                 filename='trans-megnet-full-rmse.svg', marker='None'),
                           extensions.PlotReport(['main/mae', 'validation/main/mae'], 'epoch',
                                                 filename='trans-megnet-full-mae.svg', marker='None')])
@corochann
Copy link
Member

I think it's okay if you want to start from the pre-trained weight of predictor while want to train mlp part from scratch!

@rookiecoder-chen
Copy link
Author

I want to use megnet to pre train a qm9 model, and then use the weight of this model to continue to train my own data, because my data set is very small, but I don't seem to know if transfer learning is used in this way?

@corochann
Copy link
Member

I think this is okay to start trying transfer learning in this way.

@rookiecoder-chen
Copy link
Author

But the experimental results are very poor. I just want to use the weight of megnet part and how to set my new_predictor and new_megnet model?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants