Comments (16)
I remember that the required gpu memory for batch_size=128
is less than 5GB (it may be much smaller).
What's your Python and PyTorch version? I guess you are using Python 2.7. Am i right?
This memory issue occurred when requires_grad=False does not work.
There are two options for solving this problem.
- Upgrade PyTorch version
- Use Python 3.5 instead of 2.7
from pytorch-tutorial.
This might be related to #26
This is a known issue which will be resolved in the next release.
Till then as a workaround, just change L56 to
images = Variable(images, volatile=True)
and L66 to
features = encoder(images)
features = Variable(features.data)
from pytorch-tutorial.
@yunjey I am on python 2.7 and pytorch 0.12. I will try your changes.
@karandwivedi42 I will also test your fix.
I will let you both know.
from pytorch-tutorial.
@jtoy I recommend you to install PyTorch using source. This will give you the latest version of PyTorch.
from pytorch-tutorial.
I tried with pytorch python 2.7 source and using pytorch for python 3.5, both died with the same issue.
from pytorch-tutorial.
@karandwivedi42 your changes work! @yunjey will the code need to be updated? It seems like source doesnt seem to fix the issue. I can do more testing if needed.
from pytorch-tutorial.
@jtoy Ok. Thanks.
from pytorch-tutorial.
@karandwivedi42 That does not work.
images = Variable(images, volatile=True)
The code above makes requires_grad=False
in resnet.fc. See here for the details of volatile.
from pytorch-tutorial.
@yunjey You are right. I don't know how important it is though because this linear layer is followed by another linear layer in the decoder with no non-linearity in between.
from pytorch-tutorial.
so what is the right code to use? I was able to train a model with @karandwivedi42 's change and the model completed training for me in 155 minutes. does that time seem right? I trained the original show and tell model and I remember it taking at least a day.
from pytorch-tutorial.
from pytorch-tutorial.
@karandwivedi42 I dont fully understand, Im just starting to play with pytorch, any way to see it as a diff ?
from pytorch-tutorial.
@jtoy This fork is a very hacky way to do exactly what the original code does.
https://github.com/karandwivedi42/pytorch-tutorial/tree/master/tutorials/09%20-%20Image%20Captioning
@yunjey Can you please check this one? (Thanks for the amazing tutorials btw :) )
from pytorch-tutorial.
@jtoy @karandwivedi42 I will fix the code by this weekend.
from pytorch-tutorial.
from pytorch-tutorial.
@jtoy @karandwivedi42 I modified the code. Try it. Thanks :)
from pytorch-tutorial.
Related Issues (20)
- Initialize DecoderCNN in Image captioning
- Some problems occurred when I used model evaluation
- RuntimeError in Logistic Regression python file
- Using LSTM method in Python
- size mismatch for pretrained models HOT 2
- pytorch
- No Jupyter Notebooks. HOT 1
- About the learning method of neural_style_transfer
- Does anyone know the source code of channel calculation in pytorch?
- make ur repo cloneable and not editable by anyone.
- TypeError: conv2d(): argument 'input' (position 1) must be Tensor, not tuple HOT 1
- AttributeError: module 'torch.nn' has no attribute 'linear' HOT 2
- ValueError: num_samples should be a positive integer value, but got num_samples=0 HOT 1
- main.py failed HOT 2
- some question about the position of 'optimizer.zero_grad()' HOT 4
- Pytorch tutorial HOT 1
- 自动驾驶更新笔记 Autopilot Updating Notes
- How can I get a PDF version of the tutorial HOT 2
- Cuda is true why don`t use it?
- GNN model
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pytorch-tutorial.