Skip to content

Doesn't work with CPU only instance #2

Description

@mhoangvslev

I ran the train script without --cuda flag and got the following error. I make a colab notebook that runs well on GPU instance but I am trying to accelerate with a CPU instance on GCE.

Loading checkpoint model models/id.pth
Shuffling batches for the following epochs
Selected optimization level O0:  Pure FP32 training.

Defaults for this optimization level are:
enabled                : True
opt_level              : O0
cast_model_type        : torch.float32
patch_torch_functions  : False
keep_batchnorm_fp32    : None
master_weights         : False
loss_scale             : 1.0
Processing user overrides (additional kwargs that are not None)...
After processing overrides, optimization options are:
enabled                : True
opt_level              : O0
cast_model_type        : torch.float32
patch_torch_functions  : False
keep_batchnorm_fp32    : None
master_weights         : False
loss_scale             : 1.0
Traceback (most recent call last):
  File "train.py", line 159, in <module>
    model, optimizer = amp.initialize(model, optimizer, opt_level='O0')
  File "/home/minhhoangdang/miniconda3/envs/a2s/lib/python3.6/site-packages/apex/amp/frontend.py", line 358, in initialize
    return _initialize(models, optimizers, _amp_state.opt_properties, num_losses, cast_model_outputs)
  File "/home/minhhoangdang/miniconda3/envs/a2s/lib/python3.6/site-packages/apex/amp/_initialize.py", line 171, in _initialize
    check_params_fp32(models)
  File "/home/minhhoangdang/miniconda3/envs/a2s/lib/python3.6/site-packages/apex/amp/_initialize.py", line 93, in check_params_fp32
    name, param.type()))
  File "/home/minhhoangdang/miniconda3/envs/a2s/lib/python3.6/site-packages/apex/amp/_amp_state.py", line 32, in warn_or_err
    raise RuntimeError(msg)
RuntimeError: Found param conv.seq_module.0.weight with type torch.FloatTensor, expected torch.cuda.FloatTensor.
When using amp.initialize, you need to provide a model with parameters
located on a CUDA device before passing it no matter what optimization level
you chose. Use model.to('cuda') to use the default device.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions