I've been tackling python and torch specifically lately as a hobby, and, while some API works, I keep getting invalid stoi argument
exception with other very basic API torch provides.
Reproduced with the code below:
import torch
torch.cuda.is_available()
torch.cuda.current_device()
First call (is_available()
) works as expected and returns True
, but the second throws an exception:
Exception has occurred: RuntimeError
invalid stoi argument
File "C:\DEV\pthon_test\torch_test.py", line 5, in <module>
torch.cuda.current_device()
Needless to say, more complicated things (for example, running stable_diffusion_webui) fail if used with GPU (said webui works with CPU), and trying to dig deeper into the code brings me to the same exception.
OS is Windows 11, python Python 3.10.8
, torch version checked with torch.__version__
returns 1.12.1+cu113
. And, well, GPU is present
List of packages installed:
❯ pip list
Package Version
----------------------- ---------------
absl-py 1.3.0
addict 2.4.0
antlr4-python3-runtime 4.9.3
basicsr 1.4.2
beautifulsoup4 4.11.1
cachetools 5.2.0
certifi 2022.9.24
charset-normalizer 2.1.1
clip 1.0
colorama 0.4.6
contourpy 1.0.6
cycler 0.11.0
einops 0.4.1
facexlib 0.2.5
ffmpy 0.3.0
filelock 3.8.0
filterpy 1.4.5
font-roboto 0.0.1
fonts 0.0.3
fonttools 4.38.0
ftfy 6.1.1
future 0.18.2
gdown 4.5.3
gfpgan 1.3.5
google-auth 2.14.0
google-auth-oauthlib 0.4.6
grpcio 1.50.0
idna 3.4
imageio 2.22.3
kiwisolver 1.4.4
lark 1.1.2
llvmlite 0.39.1
lmdb 1.3.0
lpips 0.1.4
Markdown 3.4.1
MarkupSafe 2.1.1
matplotlib 3.6.2
networkx 2.8.8
numba 0.56.3
numpy 1.23.3
oauthlib 3.2.2
omegaconf 2.2.3
opencv-python 4.6.0.66
orjson 3.8.1
packaging 21.3
piexif 1.1.3
Pillow 9.2.0
pip 22.2.2
protobuf 3.19.6
pyasn1 0.4.8
pyasn1-modules 0.2.8
pycparser 2.21
pycryptodome 3.15.0
pydantic 1.10.2
pyDeprecate 0.3.2
pydub 0.25.1
pyparsing 3.0.9
pyrsistent 0.19.2
PySocks 1.7.1
python-dateutil 2.8.2
python-multipart 0.0.4
pytz 2022.6
PyWavelets 1.4.1
PyYAML 6.0
regex 2022.10.31
requests 2.28.1
requests-oauthlib 1.3.1
resize-right 0.0.2
rfc3986 1.5.0
rsa 4.9
scikit-image 0.19.3
scipy 1.9.3
setuptools 63.2.0
six 1.16.0
sniffio 1.3.0
soupsieve 2.3.2.post1
tb-nightly 2.11.0a20221103
tensorboard-data-server 0.6.1
tensorboard-plugin-wit 1.8.1
tifffile 2022.10.10
tokenizers 0.12.1
torch 1.12.1+cu113
torchvision 0.13.1+cu113
tqdm 4.64.1
typing_extensions 4.4.0
uc-micro-py 1.0.1
urllib3 1.26.12
wcwidth 0.2.5
websockets 10.4
Werkzeug 2.2.2
wheel 0.37.1
yapf 0.32.0
zipp 3.10.0
This brings me to two questions:
- What's causing the issue? I do have a rough understanding of the c++ meaning of the error, but not sure why I'm getting this on python
- Is there anything I can do to fix the problem?
Thanks