Pytorch-cyclegan-and-pix2pix: Is it possible only work with cpu

Created on 29 Jun 2017  路  4Comments  路  Source: junyanz/pytorch-CycleGAN-and-pix2pix

My iMac doesn't have a NVIDIA GPU, I wondering is there a way train with cpu only, can anyone help me, thanks

Most helpful comment

According to the traininng/test details, you can set --gpu_ids -1 to use CPU mode.

All 4 comments

It seems that no optional arguments for work with cpu only

optional arguments:
  -h, --help            show this help message and exit
  --dataroot DATAROOT   path to images (should have subfolders trainA, trainB,
                        valA, valB, etc)
  --batchSize BATCHSIZE
                        input batch size
  --loadSize LOADSIZE   scale images to this size
  --fineSize FINESIZE   then crop to this size
  --input_nc INPUT_NC   # of input image channels
  --output_nc OUTPUT_NC
                        # of output image channels
  --ngf NGF             # of gen filters in first conv layer
  --ndf NDF             # of discrim filters in first conv layer
  --which_model_netD WHICH_MODEL_NETD
                        selects model to use for netD
  --which_model_netG WHICH_MODEL_NETG
                        selects model to use for netG
  --n_layers_D N_LAYERS_D
                        only used if which_model_netD==n_layers
  --gpu_ids GPU_IDS     gpu ids: e.g. 0 0,1,2, 0,2
  --name NAME           name of the experiment. It decides where to store
                        samples and models
  --dataset_mode DATASET_MODE
                        chooses how datasets are loaded. [unaligned | aligned
                        | single]
  --model MODEL         chooses which model to use. cycle_gan, pix2pix, test
  --which_direction WHICH_DIRECTION
                        AtoB or BtoA
  --nThreads NTHREADS   # threads for loading data
  --checkpoints_dir CHECKPOINTS_DIR
                        models are saved here
  --norm NORM           instance normalization or batch normalization
  --serial_batches      if true, takes images in order to make batches,
                        otherwise takes them randomly
  --display_winsize DISPLAY_WINSIZE
                        display window size
  --display_id DISPLAY_ID
                        window id of the web display
  --display_port DISPLAY_PORT
                        visdom port of the web display
  --display_single_pane_ncols DISPLAY_SINGLE_PANE_NCOLS
                        if positive, display all images in a single visdom web
                        panel with certain number of images per row.
  --identity IDENTITY   use identity mapping. Setting identity other than 1
                        has an effect of scaling the weight of the identity
                        mapping loss. For example, if the weight of the
                        identity loss should be 10 times smaller than the
                        weight of the reconstruction loss, please set
                        optidentity = 0.1
  --use_dropout         use dropout for the generator
  --max_dataset_size MAX_DATASET_SIZE
                        Maximum number of samples allowed per dataset. If the
                        dataset directory contains more than max_dataset_size,
                        only a subset is loaded.
  --resize_or_crop RESIZE_OR_CROP
                        scaling and cropping of images at load time
                        [resize_and_crop|crop|scale_width]
  --no_flip             if specified, do not flip the images for data
                        argumentation
  --display_freq DISPLAY_FREQ
                        frequency of showing training results on screen
  --print_freq PRINT_FREQ
                        frequency of showing training results on console
  --save_latest_freq SAVE_LATEST_FREQ
                        frequency of saving the latest results
  --save_epoch_freq SAVE_EPOCH_FREQ
                        frequency of saving checkpoints at the end of epochs
  --continue_train      continue training: load the latest model
  --phase PHASE         train, val, test, etc
  --which_epoch WHICH_EPOCH
                        which epoch to load? set to latest to use latest
                        cached model
  --niter NITER         # of iter at starting learning rate
  --niter_decay NITER_DECAY
                        # of iter to linearly decay learning rate to zero
  --beta1 BETA1         momentum term of adam
  --lr LR               initial learning rate for adam
  --no_lsgan            do *not* use least square GAN, if false, use vanilla
                        GAN
  --lambda_A LAMBDA_A   weight for cycle loss (A -> B -> A)
  --lambda_B LAMBDA_B   weight for cycle loss (B -> A -> B)
  --pool_size POOL_SIZE
                        the size of image buffer that stores previously
                        generated images
  --no_html             do not save intermediate training results to
                        [opt.checkpoints_dir]/[opt.name]/web/  

Also wondering this. Readme states prerequesits as "CPU or NVIDIA GPU + CUDA CuDNN.", so I assumed that meant CPU only supported.

According to the traininng/test details, you can set --gpu_ids -1 to use CPU mode.

It works. Thanks a lot

Was this page helpful?
0 / 5 - 0 ratings