question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Windows 10 - Python3.7 - IndexError: tensors used as indices must be long, byte or bool tensors

See original GitHub issue

After Executing the code from the first tutorial

sockeye-train -s data/train.source -t data/train.target -vs data/dev.source -vt data/dev.target --encoder transformer --decoder transformer --num-layers 1:1 --num-embed 32 --transformer-model-size 32 --transformer-feed-forward-num-hidden 64 --transformer-attention-heads 4 --max-num-checkpoint-not-improved 3 -o seqcopy_model

on my Windows 10 PC which runs a NVIDIA GeForce GTX960 2GB

Traceback (most recent call last):
  File "D:\Anaconda\envs\sockeye\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "D:\Anaconda\envs\sockeye\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "D:\Anaconda\envs\sockeye\Scripts\sockeye-train.exe\__main__.py", line 7, in <module>
    sys.exit(main())
  File "D:\Anaconda\envs\sockeye\lib\site-packages\sockeye\train_pt.py", line 848, in main
    train(args)
  File "D:\Anaconda\envs\sockeye\lib\site-packages\torch\distributed\elastic\multiprocessing\errors\__init__.py", line 345, in wrapper
    return f(*args, **kwargs)
  File "D:\Anaconda\envs\sockeye\lib\site-packages\sockeye\train_pt.py", line 924, in train
    output_folder=output_folder)
  File "D:\Anaconda\envs\sockeye\lib\site-packages\sockeye\train_pt.py", line 400, in create_data_iters_and_vocabs
    batch_sentences_multiple_of=args.batch_sentences_multiple_of)
  File "D:\Anaconda\envs\sockeye\lib\site-packages\sockeye\data_io_pt.py", line 974, in get_training_data_iters
    permute=permute)
  File "D:\Anaconda\envs\sockeye\lib\site-packages\sockeye\data_io_pt.py", line 1812, in __init__
    self.reset()
  File "D:\Anaconda\envs\sockeye\lib\site-packages\sockeye\data_io_pt.py", line 1832, in reset
    self.data_permutations, self.inverse_data_permutations = get_permutations(self.data.get_bucket_counts())
  File "D:\Anaconda\envs\sockeye\lib\site-packages\sockeye\data_io_pt.py", line 1501, in get_permutations
    inverse_data_permutation[data_permutation] = torch.arange(num_samples)
IndexError: tensors used as indices must be long, byte or bool tensors

According to pip3 freeze the following packages are installed:

certifi==2021.10.8
mkl-fft==1.3.1
mkl-random @ file:///C:/ci/mkl_random_1626186163140/work
mkl-service==2.4.0
numpy==1.21.4
olefile==0.46
Pillow==8.4.0
portalocker==2.3.2
pyaml==21.10.1
pywin32==302
PyYAML==6.0
sacrebleu==1.4.14
six @ file:///tmp/build/80754af9/six_1623709665295/work
sockeye==3.0.0
torch==1.10.0
torchaudio==0.10.0
torchvision==0.11.1
typing_extensions==4.0.1
wincertstore==0.2

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
fhiebercommented, Dec 13, 2021

We can’t easily support Windows, but here is a PR that might fix this particular issue for Windows users: https://github.com/awslabs/sockeye/pull/990

0reactions
fhiebercommented, Dec 13, 2021

if you re-install the latest version this should no longer be necessary.

Read more comments on GitHub >

github_iconTop Results From Across the Web

IndexError: tensors used as indices must be long, byte or bool ...
I get this error for the last line in the given code snippet. The code snippet looks like the one below, NumClass =...
Read more >
IndexError: tensors used as indices must be long ... - GitHub
When I run dqn_agent.py to train the DQN for atari pong I get the following error: (learn36) D:\deepleren\Learn36>python main_dqn.py
Read more >
IndexError tensors used as indices must be long, byte or bool ...
When I train my model, I always randomly get the following error: IndexError: tensors used as indices must be long, byte or bool...
Read more >
Segmentation in cellpose for Windows fails with data type error
“NET ERROR: tensors used as indices must be long, byte or bool tensors”. However, the omni models work fine. (I deleted the models...
Read more >
CSDN博客_tensors used as indices must be long, byte or bool
1. 运行detect.py 时,出现RuntimeError. tensors used as indices must be long or byte tensors import torch import numpy as np a=torch.zeros((4,3,3)) b= ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found