Can't compile project to .exe, that uses transformers (Windows 10)
I’m using simple script, which use transformer library. Like loading model definition and tokenizer from files, text-to-text generation task, and some UI, and it’s working while launched from python-file. But same script can’t bee compiled in .exe, something always will went wrong. I tried to use different versions of packages, python, compilers (mostly PyInstaller), nothing seems to work.Main issue is this exception:"AttributeError: ‘NoneType’ object has no attribute ‘flush’ "Which means some trouble in logger (full down below). Tried use this in script (not helped):logger = logging.getLogger(‘transformers’)logger.disabled = Falselogger.setLevel(logging.NOTSET)Tried to use console only, and get this instead:exeption1081×435 14.3 KBAnd no matter have I installed tqdm or not. Put simple progress bar in beginning from last version tqdm, same output.I have no idea what else can I do in this situation. If You find a solution to this, please, describe each step in as much detail as possible.Full output:Traceback (most recent call last):File “main.py”, line 16, inFile “”, line 1007, in _find_and_loadFile “”, line 986, in _find_and_load_unlockedFile “”, line 680, in _load_unlockedFile “PyInstaller\loader\pyimod02_importers.py”, line 499, in exec_moduleFile “lang_model.py”, line 8, inFile “”, line 1007, in _find_and_loadFile “”, line 986, in _find_and_load_unlockedFile “”, line 680, inload_unlockedFile “PyInstaller\loader\pyimod02_importers.py”, line 499, in exec_moduleFile "transformers_init.py", line 30, inFile “”, line 1007, in _find_and_loadFile “”, line 986, in _find_and_load_unlockedFile “”, line 680, in _load_unlockedFile “PyInstaller\loader\pyimod02_importers.py”, line 499, in exec_moduleFile “transformers\dependency_versions_check.py”, line 36, inFile “”, line 1007, in _find_and_loadFile “”, line 986, in _find_and_load_unlockedFile “”, line 680, in _load_unlockedFile “PyInstaller\loader\pyimod02_importers.py”, line 499, in exec_moduleFile “transformers\file_utils.py”, line 60, inFile “transformers\utils\logging.py”, line 123, in get_loggerFile “transformers\utils\logging.py”, line 86, in _configure_library_root_loggerAttributeError: ‘NoneType’ object has no attribute ‘flush’
2023-09-19T15:13:49Z
Hey, i’m having the exact same issue and i’m stuck on it. Have you fixe this issue ?
2023-09-20T13:50:08Z
No. Haven’t touched this project since this post
2023-09-22T15:19:32Z
You have to add the metadata of tqdm, transformer have about 10 library to add like this :Pyinstaller --noconfirm main.py --collect-data torch --copy-metadata torch -copy-metadata tqdm -copy-metadata regex …
2024-06-29T04:10:36Z
Did you find a solution for it ?