-
Notifications
You must be signed in to change notification settings - Fork 171
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add pyinstaller spec and imports script.
- Loading branch information
Showing
2 changed files
with
122 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# -*- mode: python ; coding: utf-8 -*- | ||
from apps.shark_studio.studio_imports import pathex, datas, hiddenimports | ||
|
||
binaries = [] | ||
|
||
block_cipher = None | ||
|
||
a = Analysis( | ||
['web/index.py'], | ||
pathex=pathex, | ||
binaries=binaries, | ||
datas=datas, | ||
hiddenimports=hiddenimports, | ||
hookspath=[], | ||
hooksconfig={}, | ||
runtime_hooks=[], | ||
excludes=[], | ||
win_no_prefer_redirects=False, | ||
win_private_assemblies=False, | ||
cipher=block_cipher, | ||
noarchive=False, | ||
module_collection_mode={ | ||
'gradio': 'py', # Collect gradio package as source .py files | ||
}, | ||
) | ||
pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher) | ||
|
||
exe = EXE( | ||
pyz, | ||
a.scripts, | ||
a.binaries, | ||
a.zipfiles, | ||
a.datas, | ||
[], | ||
name='nodai_shark_studio', | ||
debug=False, | ||
bootloader_ignore_signals=False, | ||
strip=False, | ||
upx=False, | ||
upx_exclude=[], | ||
runtime_tmpdir=None, | ||
console=True, | ||
disable_windowed_traceback=False, | ||
argv_emulation=False, | ||
target_arch=None, | ||
codesign_identity=None, | ||
entitlements_file=None, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
from PyInstaller.utils.hooks import collect_data_files | ||
from PyInstaller.utils.hooks import copy_metadata | ||
from PyInstaller.utils.hooks import collect_submodules | ||
|
||
import sys | ||
|
||
sys.setrecursionlimit(sys.getrecursionlimit() * 5) | ||
|
||
# python path for pyinstaller | ||
pathex = [ | ||
".", | ||
] | ||
|
||
# datafiles for pyinstaller | ||
datas = [] | ||
datas += copy_metadata("torch") | ||
datas += copy_metadata("tokenizers") | ||
datas += copy_metadata("tqdm") | ||
datas += copy_metadata("regex") | ||
datas += copy_metadata("requests") | ||
datas += copy_metadata("packaging") | ||
datas += copy_metadata("filelock") | ||
datas += copy_metadata("numpy") | ||
datas += copy_metadata("importlib_metadata") | ||
datas += copy_metadata("omegaconf") | ||
datas += copy_metadata("safetensors") | ||
datas += copy_metadata("Pillow") | ||
datas += copy_metadata("sentencepiece") | ||
datas += copy_metadata("pyyaml") | ||
datas += copy_metadata("huggingface-hub") | ||
datas += copy_metadata("gradio") | ||
datas += collect_data_files("torch") | ||
datas += collect_data_files("tokenizers") | ||
datas += collect_data_files("tiktoken") | ||
datas += collect_data_files("accelerate") | ||
datas += collect_data_files("diffusers") | ||
datas += collect_data_files("transformers") | ||
datas += collect_data_files("pytorch_lightning") | ||
datas += collect_data_files("skimage") | ||
datas += collect_data_files("gradio") | ||
datas += collect_data_files("gradio_client") | ||
datas += collect_data_files("iree") | ||
datas += collect_data_files("shark", include_py_files=True) | ||
datas += collect_data_files("timm", include_py_files=True) | ||
datas += collect_data_files("tqdm") | ||
datas += collect_data_files("tkinter") | ||
datas += collect_data_files("webview") | ||
datas += collect_data_files("sentencepiece") | ||
datas += collect_data_files("jsonschema") | ||
datas += collect_data_files("jsonschema_specifications") | ||
datas += collect_data_files("cpuinfo") | ||
datas += collect_data_files("cv2") | ||
datas += [ | ||
("web/ui/css/*", "ui/css"), | ||
("web/ui/js/*", "ui/js"), | ||
("web/ui/logos/*", "logos"), | ||
] | ||
|
||
|
||
# hidden imports for pyinstaller | ||
hiddenimports = ["shark", "apps"] | ||
#hiddenimports += [x for x in collect_submodules("skimage") if "tests" not in x] | ||
hiddenimports += [x for x in collect_submodules("gradio") if "tests" not in x] | ||
hiddenimports += [ | ||
x for x in collect_submodules("diffusers") if "tests" not in x | ||
] | ||
blacklist = ["tests", "convert"] | ||
hiddenimports += [ | ||
x | ||
for x in collect_submodules("transformers") | ||
if not any(kw in x for kw in blacklist) | ||
] | ||
hiddenimports += [x for x in collect_submodules("iree") if "tests" not in x] | ||
hiddenimports += ["iree._runtime"] |