You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
aziabari
changed the title
Python code runs tensorflow-gpu, but the executable only runs with CPU!!
Python code runs tensorflow-gpu 2.5, but the executable only runs with CPU!!
Apr 6, 2022
My python code runs on multiple GPUs and runs perfectly with tensorflow-gpu.
Then I tried to package it with pyinstaller, but I got tensorflow issues.
I added a tensorflow hook (as follows) and resolved the issue.
from PyInstaller.utils.hooks import collect_all
def hook(hook_api):
packages = [
'tensorflow']
for package in packages:
datas, binaries, hiddenimports = collect_all(package)
hook_api.add_datas(datas)
hook_api.add_binaries(binaries)
hook_api.add_imports(*hiddenimports)
However, after creating and running the executable, it only runs on CPU.
The text was updated successfully, but these errors were encountered: