Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

RuntimeError on Windows #9

Open
Vulwsztyn opened this issue Jul 10, 2021 · 2 comments
Open

RuntimeError on Windows #9

Vulwsztyn opened this issue Jul 10, 2021 · 2 comments

Comments

@Vulwsztyn
Copy link

Stack trace:

python open_lth.py lottery --default_hparams=cifar_resnet_20 --levels=3
==================================================================================
Lottery Ticket Experiment (Replicate 1)
----------------------------------------------------------------------------------
Dataset Hyperparameters
    * dataset_name => cifar10
    * batch_size => 128
Model Hyperparameters
    * model_name => cifar_resnet_20
    * model_init => kaiming_normal
    * batchnorm_init => uniform
Training Hyperparameters
    * optimizer_name => sgd
    * lr => 0.1
    * training_steps => 160ep
    * momentum => 0.9
    * milestone_steps => 80ep,120ep
    * gamma => 0.1
    * weight_decay => 0.0001
Pruning Hyperparameters
    * pruning_strategy => sparse_global
    * pruning_fraction => 0.2
Output Location: C:\Users\Artur\open_lth_data\lottery_93bc65d66dfa64ffaf2a0ab105433a2c\replicate_1\level_0\main
==================================================================================

----------------------------------------------------------------------------------
Pruning Level 0
----------------------------------------------------------------------------------
Traceback (most recent call last):
  File "open_lth.py", line 62, in <module>
    main()
  File "open_lth.py", line 58, in main
    platform.run_job(runner_registry.get(runner_name).create_from_args(args).run)
  File "C:\Users\Artur\Projects\open_lth\platforms\base.py", line 118, in run_job
    f()
  File "C:\Users\Artur\Projects\open_lth\lottery\runner.py", line 75, in run
    self._train_level(level)
  File "C:\Users\Artur\Projects\open_lth\lottery\runner.py", line 118, in _train_level
    train.standard_train(pruned_model, location, self.desc.dataset_hparams, self.desc.training_hparams,
  File "C:\Users\Artur\Projects\open_lth\training\train.py", line 156, in standard_train
    train(training_hparams, model, train_loader, output_location, callbacks, start_step=start_step)
  File "C:\Users\Artur\Projects\open_lth\training\train.py", line 107, in train
    for callback in callbacks: callback(output_location, step, model, optimizer, logger)
  File "C:\Users\Artur\Projects\open_lth\training\standard_callbacks.py", line 97, in modified_callback
    callback(output_location, step, model, optimizer, logger)
  File "C:\Users\Artur\Projects\open_lth\training\standard_callbacks.py", line 62, in eval_callback
    total_loss += model.loss_criterion(output, labels) * labels_size
  File "C:\Users\Artur\AppData\Local\Programs\Python\Python38\lib\site-packages\torch\nn\modules\module.py", line 727, in _call_impl
    result = self.forward(*input, **kwargs)
  File "C:\Users\Artur\AppData\Local\Programs\Python\Python38\lib\site-packages\torch\nn\modules\loss.py", line 961, in forward
    return F.cross_entropy(input, target, weight=self.weight,
  File "C:\Users\Artur\AppData\Local\Programs\Python\Python38\lib\site-packages\torch\nn\functional.py", line 2468, in cross_entropy
    return nll_loss(log_softmax(input, 1), target, weight, None, ignore_index, None, reduction)
  File "C:\Users\Artur\AppData\Local\Programs\Python\Python38\lib\site-packages\torch\nn\functional.py", line 2264, in nll_loss
    ret = torch._C._nn.nll_loss(input, target, weight, _Reduction.get_enum(reduction), ignore_index)
RuntimeError: Expected object of scalar type Long but got scalar type Int for argument #2 'target' in call to _thnn_nll_loss_forward

My python version is 3.8.7

My libraries (pip3 freeze):

absl-py==0.11.0
apex @ file:///C:/<local_path> 
argon2-cffi==20.1.0
astunparse==1.6.3
async-generator==1.10
atomicwrites==1.4.0
attrs==20.3.0
backcall==0.2.0
bleach==3.2.1
blis==0.7.4
cachetools==4.2.0
catalogue==2.0.4
certifi==2020.12.5
cffi==1.14.4
chardet==4.0.0
click==7.1.2
cloudpickle==1.6.0
clr==1.0.3
colorama==0.4.4
cupy-cuda102==8.6.0
cycler==0.10.0
cymem==2.0.5
Cython==0.29.14
decorator==4.4.2
deepdiff==5.0.2
defusedxml==0.6.0
emoji==1.2.0
en-core-web-sm @ https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-3.0.0/en_core_web_sm-3.0.0-py3-none-any.whl
entrypoints==0.3
enum34==1.1.10
fastrlock==0.6
flatbuffers==1.12
funcy==1.15
future==0.18.2
gast==0.3.3
gensim==3.8.3
google-api-core==1.24.1
google-api-python-client==1.12.8
google-auth==1.24.0
google-auth-httplib2==0.0.4
google-auth-oauthlib==0.4.2
google-pasta==0.2.0
googleapis-common-protos==1.52.0
grpcio==1.32.0
h5py==2.10.0
httplib2==0.18.1
idna==2.10
imageio==2.9.0
iniconfig==1.1.1
ipykernel==5.4.3
ipython==7.19.0
ipython-genutils==0.2.0
ipywidgets==7.6.3
jedi==0.18.0
Jinja2==2.11.2
joblib==1.0.0
jsonschema==3.2.0
jupyter==1.0.0
jupyter-client==6.1.11
jupyter-console==6.2.0
jupyter-core==4.7.0
jupyterlab-pygments==0.1.2
jupyterlab-widgets==1.0.0
Keras-Preprocessing==1.1.2
kiwisolver==1.3.1
lime==0.2.0.1
livereload==2.6.3
llvmlite==0.36.0
lunr==0.5.8
lxml==4.6.3
Markdown==3.3.3
MarkupSafe==1.1.1
matplotlib==3.3.3
mistune==0.8.4
mkdocs==1.1.2
mock==4.0.3
mpyq==0.2.5
multitasking==0.0.9
murmurhash==1.0.5
nbclient==0.5.1
nbconvert==6.0.7
nbformat==5.0.8
nest-asyncio==1.4.3
networkx==2.5.1
nltk==3.5
notebook==6.2.0
numba==0.53.1
numexpr==2.7.2
numpy==1.19.0
oauthlib==3.1.0
opencv-python==4.5.1.48
opt-einsum==3.3.0
ordered-set==4.0.2
packaging==20.8
pandas==1.2.0
pandocfilters==1.4.3
parso==0.8.1
pathy==0.5.2
pickleshare==0.7.5
Pillow==8.1.0
pluggy==0.13.1
portpicker==1.3.1
praw==7.2.0
prawcore==2.0.0
preshed==3.0.5
prometheus-client==0.9.0
prompt-toolkit==3.0.10
protobuf==3.14.0
prunhild @ git+https://github.com/gfrogat/prunhild@55769c6f2eca2748288c24826dd3bb14deaf5707
psaw==0.1.0
py==1.10.0
pyasn1==0.4.8
pyasn1-modules==0.2.8
pycparser==2.20
pydantic==1.7.3
pygame==2.0.0
Pygments==2.7.4
pyLDAvis @ git+https://github.com/bmabey/pyLDAvis.git@15cac9d39400d13f0070910151b0f22b2603e539
pyparsing==2.4.7
pyrsistent==0.17.3
PySC2==3.0.0
pytesseract==0.3.7
pytest==6.2.1
python-dateutil==2.8.1
python-dotenv==0.15.0
pytz==2020.5
PyWavelets==1.1.1
pywin32==300
pywinpty==0.5.7
PyYAML==5.4.1
pyzmq==20.0.0
qtconsole==5.0.1
QtPy==1.9.0
regex==2020.11.13
requests==2.25.1
requests-oauthlib==1.3.0
rsa==4.6
s2clientprotocol==5.0.5.82893.0
s2protocol==5.0.5.82893.0
scikit-image==0.18.1
scikit-learn==0.24.0
scipy==1.5.4
seaborn==0.11.1
Send2Trash==1.5.0
shap==0.39.0
six==1.15.0
sk-video==1.1.10
sklearn==0.0
slicer==0.0.7
smart-open==3.0.0
spacy==3.0.6
spacy-legacy==3.0.5
srsly==2.4.1
tensorboard==2.4.0
tensorboard-plugin-wit==1.7.0
tensorboardX==2.1
tensorflow==2.4.0
tensorflow-estimator==2.4.0
tensorflow-gpu==2.4.0
termcolor==1.1.0
terminado==0.9.2
testpath==0.4.4
thinc==8.0.3
threadpoolctl==2.1.0
tifffile==2021.4.8
toml==0.10.2
torch==1.7.1+cu110
torchaudio==0.7.2
torchvision==0.8.2+cu110
tornado==6.1
tqdm==4.56.0
traitlets==5.0.5
typer==0.3.2
typing-extensions==3.7.4.3
update-checker==0.18.0
uritemplate==3.0.1
urllib3==1.26.2
wasabi==0.8.2
wcwidth==0.2.5
webencodings==0.5.1
websocket-client==0.57.0
Werkzeug==1.0.1
whichcraft==0.6.1
widgetsnbextension==3.5.1
wrapt==1.12.1
yfinance==0.1.59

I'm not sure if there is any more info I should add.

I think adding either requirements.txt, conda environment file, or ideally a Dockerfile would make this repo much more easily runnable.

@whtitefall
Copy link

I guess you can change the type of "label" in loss functions from int to torch.long

this works for me

@Vulwsztyn
Copy link
Author

Thanks, I worked it out:
#10

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants