I am working on a multilingual nmt model using opennmt. Getting the following error when running on cpu. As you said its index out of range error.
Traceback (most recent call last):

  File "train.py", line 40, in <module>

    main(opt)

  File "train.py", line 27, in main

    single_main(opt)

  File "/home/gamut/OpenNMT-py/onmt/train_single.py", line 262, in main

    opt.valid_steps)

  File "/home/gamut/OpenNMT-py/onmt/trainer.py", line 223, in train

    report_stats)

  File "/home/gamut/OpenNMT-py/onmt/trainer.py", line 384, in _gradient_accumulation

    dec_state)

  File "/home/gamut/anaconda3/envs/zeroshotpy/lib/python3.6/site-packages/torch/nn/modules/module.py", line 491, in __call__

    result = self.forward(*input, **kwargs)

  File "/home/gamut/OpenNMT-py/onmt/models/model.py", line 61, in forward

    enc_final, memory_bank = encoder(src, lengths)

  File "/home/gamut/anaconda3/envs/zeroshotpy/lib/python3.6/site-packages/torch/nn/modules/module.py", line 491, in __call__

    result = self.forward(*input, **kwargs)

  File "/home/gamut/OpenNMT-py/onmt/encoders/rnn_encoder.py", line 57, in forward

    emb = self.embeddings(src)

  File "/home/gamut/anaconda3/envs/zeroshotpy/lib/python3.6/site-packages/torch/nn/modules/module.py", line 491, in __call__

    result = self.forward(*input, **kwargs)

  File "/home/gamut/OpenNMT-py/onmt/modules/embeddings.py", line 205, in forward

    source = self.make_embedding(source)

  File "/home/gamut/anaconda3/envs/zeroshotpy/lib/python3.6/site-packages/torch/nn/modules/module.py", line 491, in __call__

    result = self.forward(*input, **kwargs)

  File "/home/gamut/anaconda3/envs/zeroshotpy/lib/python3.6/site-packages/torch/nn/modules/container.py", line 91, in forward

    input = module(input)

  File "/home/gamut/anaconda3/envs/zeroshotpy/lib/python3.6/site-packages/torch/nn/modules/module.py", line 491, in __call__

    result = self.forward(*input, **kwargs)

  File "/home/gamut/OpenNMT-py/onmt/modules/util_class.py", line 43, in forward

    outputs = [f(x) for f, x in zip(self, inputs_)]

  File "/home/gamut/OpenNMT-py/onmt/modules/util_class.py", line 43, in <listcomp>

    outputs = [f(x) for f, x in zip(self, inputs_)]

  File "/home/gamut/anaconda3/envs/zeroshotpy/lib/python3.6/site-packages/torch/nn/modules/module.py", line 491, in __call__

    result = self.forward(*input, **kwargs)

  File "/home/gamut/anaconda3/envs/zeroshotpy/lib/python3.6/site-packages/torch/nn/modules/sparse.py", line 108, in forward

    self.norm_type, self.scale_grad_by_freq, self.sparse)

  File "/home/gamut/anaconda3/envs/zeroshotpy/lib/python3.6/site-packages/torch/nn/functional.py", line 1076, in embedding

    return torch.embedding(weight, input, padding_idx, scale_grad_by_freq, sparse)

RuntimeError: index out of range at /opt/conda/conda-bld/pytorch_1524586445097/work/aten/src/TH/generic/THTensorMath.c:343