pix2pix icon indicating copy to clipboard operation
pix2pix copied to clipboard

Question about testing on CPU

Open AnnaRebecca opened this issue 7 years ago • 4 comments

Hello,

I'm sorry if this is a very obvious question, but I was wondering if it is possible to test on a CPU? I have successfully managed to train on CPU, but when I try to run the following command:

DATA_ROOT=/home/ubuntu/torch/pix2pix/fallofhouse name=fall which_direction=AtoB gpu=0 cudnn=0 phase=val th test.lua

I get the following errors:

{ input_nc : 3 results_dir : "./results/" name : "fall" batchSize : 1 phase : "val" fineSize : 256 aspect_ratio : 1 how_many : "all" gpu : 0 DATA_ROOT : "/home/ubuntu/torch/pix2pix/fallofhouse" serial_batch_iter : 1 preprocess : "regular" nThreads : 1 which_epoch : "latest" which_direction : "AtoB" cudnn : 0 serial_batches : 1 display : 1 output_nc : 3 loadSize : 256 checkpoints_dir : "./checkpoints" display_id : 200 flip : 0 } Random Seed: 1308 #threads...1 Starting donkey with id: 1 seed: 1309 table: 0x40830668 /home/ubuntu/torch/pix2pix/fallofhouse trainCache /home/ubuntu/torch/pix2pix/cache/_home_ubuntu_torch_pix2pix_fallofhouse_val_trainCache.t7 Creating train metadata serial batch:, 1 table: 0x40ec8a08 running "find" on each class directory, and concatenate all those filenames into a single file containing all image paths for a given class now combine all the files to a single large file load the large concatenated list of sample paths to self.imagePath cmd..wc -L '/tmp/lua_8SHehg' |cut -f1 -d' ' 13 samples found.......................... 0/13 ........................................] ETA: 0ms | Step: 0ms
Updating classList and imageClass appropriately [======================================== 1/1 ========================================>] Tot: 0ms | Step: 0ms
Cleaning up temporary files Dataset Size: 13 checkpoints_dir ./checkpoints checkpoints_dir ./checkpoints /home/ubuntu/torch/install/bin/luajit: cannot open </home/ubuntu/torch/pix2pix/checkpoints/fall/latest_net_G.t7> in mode r at /tmp/luarocks_torch-scm-1-4138/torch7/lib/TH/THDiskFile.c:670 stack traceback: [C]: at 0x7fbe92ddf090 [C]: in function 'DiskFile' /home/ubuntu/torch/install/share/lua/5.1/torch/File.lua:405: in function 'load' /home/ubuntu/torch/pix2pix/util/util.lua:194: in function 'load' test.lua:76: in main chunk [C]: in function 'dofile' ...untu/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:150: in main chunk [C]: at 0x00405d50

Is this something that I cannot do or have I made an error?

Thank you very much!

AnnaRebecca avatar Apr 30 '17 16:04 AnnaRebecca

I'm also wondering this @AnnaRebecca, I get errors when I try and run a model created on GPU with CPU, does anyone have a script for fixing this?

samhains avatar May 11 '17 05:05 samhains

same here, I'd wish to be able to train on gpu and run on cpu

ThatAIGeek avatar Jul 26 '17 09:07 ThatAIGeek

It says "... bin/luajit: cannot open </home/ubuntu/torch/pix2pix/checkpoints/fall/latest_net_G.t7> in mode r at /tmp/luarocks_torch-scm-1-4138/torch7/lib/TH/THDiskFile.c:670 stack traceback:". When I change the model name to latest_net_G.t7, it tries to read the model, but gives out this error:

" ... Dataset Size: 7 checkpoints_dir ./models /home/torch/install/bin/luajit: /home/torch/install/share/lua/5.1/torch/File.lua:343: unknown Torch class <torch.CudaTensor> stack traceback: [C]: in function 'error' /home/torch/install/share/lua/5.1/torch/File.lua:343: in function 'readObject' /home/torch/install/share/lua/5.1/torch/File.lua:369: in function 'readObject' /home/torch/install/share/lua/5.1/nngraph/gmodule.lua:495: in function 'read' /home/torch/install/share/lua/5.1/torch/File.lua:351: in function 'readObject' /home/torch/install/share/lua/5.1/torch/File.lua:409: in function 'load' /home/codes/pix2pix/util/util.lua:194: in function 'load' test.lua:76: in main chunk [C]: in function 'dofile' ...torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:150: in main chunk [C]: at 0x00406670 "

ozgurovic avatar Aug 08 '17 09:08 ozgurovic

I have similar error

/home/gormatevosyan14/torch/install/bin/luajit: cannot open </home/gormatevosyan14/lenz/pix2pix/checkpoints/day2night/latest_net_G.t7> in mode r at /home/gormatevosyan14/torch/pkg/torch/lib/TH/THDiskFile.c:673

With params

{ input_nc : 3 results_dir : "./results/" name : "day2night" batchSize : 1 phase : "val" fineSize : 256 aspect_ratio : 1 how_many : "all" gpu : 0 DATA_ROOT : "../assets/imgs/pix" serial_batch_iter : 1 preprocess : "regular" nThreads : 1 which_epoch : "latest" which_direction : "AtoB" cudnn : 0 serial_batches : 1 display : 0 output_nc : 3 loadSize : 256 checkpoints_dir : "./checkpoints" display_id : 200 flip : 0 }

gormat avatar Aug 13 '17 19:08 gormat