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

Related to 392 #513

Open
pythonometrist opened this issue Sep 28, 2019 · 2 comments
Open

Related to 392 #513

pythonometrist opened this issue Sep 28, 2019 · 2 comments

Comments

@pythonometrist
Copy link

pythonometrist commented Sep 28, 2019

I am running into the same issue as #392.

Using APEX over cross validation leads to OOM.

I just wanted to check the work around solution.

Instantiate model, optimizer.

apex initialize

for k in cross_vals:
         train(model, optimizer)
         reset( model) 

Is that correct?

Problem is that I am using a transformer, so resetting the model indicates losing the transfer learning.

I wasnt clear on how to use the previous version of APEX either. Any suggestions would be appreciated.

@ptrblck
Copy link
Contributor

ptrblck commented Sep 30, 2019

Hi @pythonometrist,

could you explain a bit, what you mean by "losing the transfer learning"?
If you are finetuning the model, you could reset the model after each fold to this pretrained status again (instead of randomly initializing).

@mcarilli
Copy link
Contributor

mcarilli commented Apr 6, 2020

The recently merged native Amp API should fix this issue and straightforwardly accommodate cross-validation:
https://pytorch.org/docs/master/amp.html
https://pytorch.org/docs/master/notes/amp_examples.html

See #439 (comment) for details.

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

3 participants