CjangCjengh / MoeGoe

Executable file for VITS inference
MIT License
2.35k stars 249 forks source link

About the problem that the pyinstaller package contains torch #17

Closed rdp-studio closed 2 years ago

rdp-studio commented 2 years ago

I try to package a application containing torch through pyinstaller, but it prompts me "TorchScript requires source access in order to carry out compilation, make sure original. py files are available." How do I solve this problem? Detailed stack information:

Traceback (most recent call last):
  File "torch\_sources.py", line 21, in get_source_lines_and_file
  File "inspect.py", line 1129, in getsourcelines
  File "inspect.py", line 958, in findsource
OSError: could not get source code

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "vits-paimon-ui.py", line 10, in <module>
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "PyInstaller\loader\pyimod02_importers.py", line 499, in exec_module
  File "commons.py", line 101, in <module>
  File "torch\jit\_script.py", line 1340, in script
  File "torch\jit\frontend.py", line 234, in get_jit_def
  File "torch\_sources.py", line 96, in parse_def
  File "torch\_sources.py", line 28, in get_source_lines_and_file
OSError: Can't get source for <function fused_add_tanh_sigmoid_multiply at 0x000001F3F8A00040>. TorchScript requires source access in order to carry out compilation, make sure original .py files are available.
[15028] Failed to execute script 'vits-paimon-ui' due to unhandled exception!
rdp-studio commented 2 years ago

Solved.