A
A
abrahamsirailov2021-09-12 18:33:00
Python
abrahamsirailov, 2021-09-12 18:33:00

OSError: [WinError 193] %1 is not a Win32 application - how to solve?

Hey! I started to study ruGPT2 from Sberbank, installed at first I got the error "No typing_extensions module" although I had one. Without hesitation, I decided to reinstall it and after reinstalling, the following error began to pop up:

Traceback (most recent call last):
  File "D:\Web-Developer\python\index.py", line 1, in <module>
    from transformers import GPT2LMHeadModel, GPT2Tokenizer
  File "C:\Users\User\AppData\Local\Programs\Python\Python36-32\lib\site-packages\transformers\__init__.py", line 43, in <module>
    from . import dependency_versions_check
  File "C:\Users\User\AppData\Local\Programs\Python\Python36-32\lib\site-packages\transformers\dependency_versions_check.py", line 36, in <module>
    from .file_utils import is_tokenizers_available
  File "C:\Users\User\AppData\Local\Programs\Python\Python36-32\lib\site-packages\transformers\file_utils.py", line 45, in <module>
    import numpy as np
  File "C:\Users\User\AppData\Local\Programs\Python\Python36-32\lib\site-packages\numpy\__init__.py", line 138, in <module>
    from . import _distributor_init
  File "C:\Users\User\AppData\Local\Programs\Python\Python36-32\lib\site-packages\numpy\_distributor_init.py", line 26, in <module>
    WinDLL(os.path.abspath(filename))
  File "C:\Users\User\AppData\Local\Programs\Python\Python36-32\lib\ctypes\__init__.py", line 344, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: [WinError 193] %1 не является приложением Win32

Process finished with exit code 1


I use Python 3.6.0
Windows 64 bit

is my code:
from transformers import GPT2LMHeadModel, GPT2Tokenizer

model_name_or_path = "sberbank-ai/rugpt3large_based_on_gpt2"
tokenizer = GPT2Tokenizer.from_pretrained(model_name_or_path)
model = GPT2LMHeadModel.from_pretrained(model_name_or_path).cuda()
text = "Александр Сергеевич Пушкин родился в "
input_ids = tokenizer.encode(text, return_tensors="pt").cuda()
out = model.generate(input_ids.cuda())
generated_text = list(map(tokenizer.decode, out))[0]
print(generated_text)

Who knows how to solve?

Abraham, 12 years old

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Pankov, 2021-09-12
@trapwalker

You need to look at what you have in "C:\Users\User\AppData\Local\Programs\Python\Python36-32\lib\site-packages\numpy\_distributor_init.py"
Where does the filename value come from. Perhaps it is not the path to the dll that gets there, but the placeholder %1 from some script when the library is installed incorrectly.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question