I have a torch model trained with GPU, now i want to use this model in a CPU-only environment.Is it possible, if so, how can i do that? thanks!
--
You received this message because you are subscribed to the Google Groups "torch7" group.
To unsubscribe from this group and stop receiving emails from it, send an email to torch7+un...@googlegroups.com.
To post to this group, send email to tor...@googlegroups.com.
Visit this group at http://groups.google.com/group/torch7.
For more options, visit https://groups.google.com/d/optout.
model = model:float()
That's it, you should be all set.
model = model:float()
That's it, you should be all set.
convert your model to float/double before saving it :model:float()
now you don't have to require 'cunn' when loading it.
On Saturday, June 13, 2015 at 4:40:42 PM UTC+3, Xuwang Yin wrote:
I think there might be some issues here.My experiments showed that to load a GPU-trained nn.Sequential model,Āyou have to first "require 'cunn'", otherwise it won't load ("requre 'nn'" only): "torch/install/share/lua/5.1/torch/File.lua:249: unknown Torch class <torch.CudaTensor>".ĀIn the training code i found that when you trained a nn.Sequential model on GPU, you have to first "convert" the model to GPU:Ā-- CUDA?if opt.type == 'cuda' thenĀ Ā model:cuda()Ā Ā criterion:cuda()endI think that after the model being "converted", you have to require cunn to load the model.ĀSo, even you want to use the model on CPU, you have to get a NVIDIA card and have CUDA installed, which,Āwill makes running the model on CPU pointless.Any suggestions?
åØ 2015幓6ę10ę„ęęäø UTC+8äøå11:57:08ļ¼smth chntlaåéļ¼
model = model:float()
That's it, you should be all set.
On Wed, Jun 10, 2015 at 11:55 AM, Xuwang Yin via torch7 <torch7+APn2wQcrd_8OQt5Q0FoODsOgr...@googlegroups.com> wrote:I have a torch model trained with GPU, now i want to use this model in a CPU-only environment.--Is it possible, if so, how can i do that? thanks!
You received this message because you are subscribed to the Google Groups "torch7" group.
To unsubscribe from this group and stop receiving emails from it, send an email to torch7+un...@googlegroups.com.
To post to this group, send email to tor...@googlegroups.com.
Visit this group at http://groups.google.com/group/torch7.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to a topic in the Google Groups "torch7" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/torch7/ugBCwaoXw_s/unsubscribe.
To unsubscribe from this group and all its topics, send an email to torch7+un...@googlegroups.com.
Yes, it works, and if you didn't save the model as float during the training process, you can use 'cunn' to load the model, convert it to float and then save it. Nice work
attempt to call method 'double' (a nil value)
orattempt to call method 'float' (a nil value)
model = torch.load(modelName)
model = model.float() Ā Ā # model = model.double()
model = model:float()
That's it, you should be all set.