-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PyInstaller OsError: Can't get source code <function> TorchScript #5673
Comments
For those of you who are getting the same error I had to do a few tricks to get this too work. I will try to provide a guide for that. Solution guide
In order to do that I had to
REQUESTThis has been really tricky. Do you think anything could give less overhead?? |
Feel free to reopen it if you want to discuss a better approach or if the mantainers want to keep it as an open bug to look at. |
Hmm, doubt it'll get much priority either way. It looks like the kind of issue that will be continuously shifting the goal posts. |
I got the same problem, this solution guide works for me, I just needed add changes on .spec file, transformers/models/deberta/modeling_deberta.py and transformers/models/deberta_v2/modeling_deberta_v2.py using the same solution on the two files for transformers 4.17.0.dev0 |
I also got a similar issue on my own models. (Not the transformers)
In my case, I just changed |
Description of the issue
am trying to create an executable for a flask application that uses haystack to serve a QA System. Haystack uses transformers.
If I run my API normally with python with
python app.py
it works fine.When I run
pyinstaller --onedir app.spec --clean --distpath distAPP
the executable gets created fine. However, when I run it with./distAPP/app/app
I get the following error:Context information (for bug reports)
pyinstaller --version
:4.2.2
A minimal example program which shows the error
You can find ta minimal repository that will generate the same error here.
You can clone it (it only includes few light .py files) and follow the instructions in the README.md file
Stacktrace / full error message
What I tried
I followed the instructions provided in issue #4764 but it didn't work.
I changed my app.spec file to save int TOC the sourcefile of different modules that could be responsible for this error:
And modified
FrozenImporter
(pyimod03_importers.py
) to be:And I am still getting the exact same error. Please let me know if I am still missing something.
Similar issues
TorchScript requires source access in order to carry out compilation, make sure original .py files are available.
part of the error. However, the solution couldn't be applied as I cannot simply exclude torch or transformers moduleThe text was updated successfully, but these errors were encountered: