Discussion:
[theano-users] How to delete theano model from GPU before initiating another model
Feras Almasri
2017-07-04 21:21:04 UTC
Permalink
I'm re-initiating another model in a loop because I'm testing different
batch sizes so I have to re initiate the model again. it seems in my code
that every time I'm re initiating the model the old model still in the GPU
and not deleted. is there any way to delete the model before initiating the
second ?
--
---
You received this message because you are subscribed to the Google Groups "theano-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to theano-users+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Frédéric Bastien
2017-07-05 02:50:36 UTC
Permalink
You don't need to re create a new model of you just change the batch size.
What make you think this is needed? Some great framework on top of Theano
will request that you set the batchsize to None to tell that it will change.

Fred
Post by Feras Almasri
I'm re-initiating another model in a loop because I'm testing different
batch sizes so I have to re initiate the model again. it seems in my code
that every time I'm re initiating the model the old model still in the GPU
and not deleted. is there any way to delete the model before initiating the
second ?
--
---
You received this message because you are subscribed to the Google Groups
"theano-users" group.
To unsubscribe from this group and stop receiving emails from it, send an
For more options, visit https://groups.google.com/d/optout.
--
---
You received this message because you are subscribed to the Google Groups "theano-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to theano-users+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Feras Almasri
2017-07-05 09:14:18 UTC
Permalink
Thanks for answering, I don't want to use another level of framework. I
tried to alter the batch size using theano but it seems that it is not
updating after creating the model. Is there any way that I can do it using
theano itself ?
Post by Frédéric Bastien
You don't need to re create a new model of you just change the batch size.
What make you think this is needed? Some great framework on top of Theano
will request that you set the batchsize to None to tell that it will change.
Fred
Post by Feras Almasri
I'm re-initiating another model in a loop because I'm testing different
batch sizes so I have to re initiate the model again. it seems in my code
that every time I'm re initiating the model the old model still in the GPU
and not deleted. is there any way to delete the model before initiating the
second ?
--
---
You received this message because you are subscribed to the Google Groups
"theano-users" group.
To unsubscribe from this group and stop receiving emails from it, send an
For more options, visit https://groups.google.com/d/optout.
--
---
You received this message because you are subscribed to the Google Groups "theano-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to theano-users+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Feras Almasri
2017-07-05 12:01:08 UTC
Permalink
I found that it is possible to change the batch size during the run time by
defining the batch size to None. But the pooling layer in case of averaging
or same size doesn't have this option and should be defined in different
way.
Post by Feras Almasri
I'm re-initiating another model in a loop because I'm testing different
batch sizes so I have to re initiate the model again. it seems in my code
that every time I'm re initiating the model the old model still in the GPU
and not deleted. is there any way to delete the model before initiating the
second ?
--
---
You received this message because you are subscribed to the Google Groups "theano-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to theano-users+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Frédéric Bastien
2017-07-05 22:02:35 UTC
Permalink
Pure Theano Do not expect shapes. By default shapes can changes. You just
need to be consistent in the computation you do on the shapes.

If you set the batchsize shape to None, you are not using pure Theano.

Do you use lasagne? Keras?

Can you show the code where you set the shape to None?

Fred
Post by Feras Almasri
I found that it is possible to change the batch size during the run time
by defining the batch size to None. But the pooling layer in case of
averaging or same size doesn't have this option and should be defined in
different way.
Post by Feras Almasri
I'm re-initiating another model in a loop because I'm testing different
batch sizes so I have to re initiate the model again. it seems in my code
that every time I'm re initiating the model the old model still in the GPU
and not deleted. is there any way to delete the model before initiating the
second ?
--
---
You received this message because you are subscribed to the Google Groups
"theano-users" group.
To unsubscribe from this group and stop receiving emails from it, send an
For more options, visit https://groups.google.com/d/optout.
--
---
You received this message because you are subscribed to the Google Groups "theano-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to theano-users+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Feras Almasri
2017-07-07 09:31:56 UTC
Permalink
I checked theano documentation and it says this

You can give None for any element of the list to specify that this element
is not known at compile time.
http://deeplearning.net/software/theano/library/tensor/nnet/conv.html

As I said I don't want to use any upper level on top of theano I'm just
using pure theano. I think in my case it is working well because I'm using
a convent that broadcast the same image size all over the network since
there is no down sampling there is no need to re compute the image batch
size in each different batch image size. But I don't realy now why theano
need to compute the image size before ceating the model while by using
keras or lasagne it could work.

Anyway my problem is solved here and it is not necessary to recompile the
model, but I guess in different cases this could be important specially of
the network is used in live run. another very important proposal is to add
separated convolution network to theano framework.
Post by Frédéric Bastien
Pure Theano Do not expect shapes. By default shapes can changes. You just
need to be consistent in the computation you do on the shapes.
If you set the batchsize shape to None, you are not using pure Theano.
Do you use lasagne? Keras?
Can you show the code where you set the shape to None?
Fred
Post by Feras Almasri
I found that it is possible to change the batch size during the run time
by defining the batch size to None. But the pooling layer in case of
averaging or same size doesn't have this option and should be defined in
different way.
Post by Feras Almasri
I'm re-initiating another model in a loop because I'm testing different
batch sizes so I have to re initiate the model again. it seems in my code
that every time I'm re initiating the model the old model still in the GPU
and not deleted. is there any way to delete the model before initiating the
second ?
--
---
You received this message because you are subscribed to the Google Groups
"theano-users" group.
To unsubscribe from this group and stop receiving emails from it, send an
For more options, visit https://groups.google.com/d/optout.
--
---
You received this message because you are subscribed to the Google Groups "theano-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to theano-users+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Frédéric Bastien
2017-07-07 18:44:40 UTC
Permalink
You don't need to pass the shape. This is optional information.

In fact, currently we don't use it anymore. We used it in the past. Maybe
we will use it again later. But in all cases, it was optional.
Post by Feras Almasri
I checked theano documentation and it says this
You can give None for any element of the list to specify that this
element is not known at compile time.
http://deeplearning.net/software/theano/library/tensor/nnet/conv.html
As I said I don't want to use any upper level on top of theano I'm just
using pure theano. I think in my case it is working well because I'm using
a convent that broadcast the same image size all over the network since
there is no down sampling there is no need to re compute the image batch
size in each different batch image size. But I don't realy now why theano
need to compute the image size before ceating the model while by using
keras or lasagne it could work.
Anyway my problem is solved here and it is not necessary to recompile the
model, but I guess in different cases this could be important specially of
the network is used in live run. another very important proposal is to add
separated convolution network to theano framework.
Post by Frédéric Bastien
Pure Theano Do not expect shapes. By default shapes can changes. You just
need to be consistent in the computation you do on the shapes.
If you set the batchsize shape to None, you are not using pure Theano.
Do you use lasagne? Keras?
Can you show the code where you set the shape to None?
Fred
I found that it is possible to change the batch size during the run time
Post by Frédéric Bastien
Post by Feras Almasri
by defining the batch size to None. But the pooling layer in case of
averaging or same size doesn't have this option and should be defined in
different way.
Post by Feras Almasri
I'm re-initiating another model in a loop because I'm testing different
batch sizes so I have to re initiate the model again. it seems in my code
that every time I'm re initiating the model the old model still in the GPU
and not deleted. is there any way to delete the model before initiating the
second ?
--
---
You received this message because you are subscribed to the Google
Groups "theano-users" group.
To unsubscribe from this group and stop receiving emails from it, send an
Post by Feras Almasri
For more options, visit https://groups.google.com/d/optout.
--
---
You received this message because you are subscribed to the Google Groups
"theano-users" group.
To unsubscribe from this group and stop receiving emails from it, send an
For more options, visit https://groups.google.com/d/optout.
--
---
You received this message because you are subscribed to the Google Groups "theano-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to theano-users+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...