Skip to content

Commit

Permalink
ビルド時のmodelディレクトリの指定をオプショナルにする (#725)
Browse files Browse the repository at this point in the history
  • Loading branch information
Hiroshiba authored Aug 16, 2023
1 parent 9b04dc9 commit 92f00d7
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 8 deletions.
5 changes: 1 addition & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -436,10 +436,6 @@ jobs:
rm -rf download/${{ env.VOICEVOX_CORE_ASSET_NAME }}
rm download/${{ env.VOICEVOX_CORE_ASSET_NAME }}.zip
- name: Copy VOICEVOX Core Models
run: |
cp -r download/core/model ./
- name: Generate licenses.json
run: |
OUTPUT_LICENSE_JSON_PATH=engine_manifest_assets/dependency_licenses.json \
Expand Down Expand Up @@ -467,6 +463,7 @@ jobs:
LIBONNXRUNTIME_PATH=download/onnxruntime/lib/libonnxruntime.so
fi
CORE_MODEL_DIR_PATH="download/core/model" \
LIBCORE_PATH="$LIBCORE_PATH" \
LIBONNXRUNTIME_PATH="$LIBONNXRUNTIME_PATH" \
pyinstaller --noconfirm run.spec
Expand Down
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -492,10 +492,14 @@ python -m pip install -r requirements-dev.txt
OUTPUT_LICENSE_JSON_PATH=licenses.json \
bash build_util/create_venv_and_generate_licenses.bash

# ビルド自体はLIBCORE_PATH及びLIBONNXRUNTIME_PATHの指定がなくても可能です
# モックでビルドする場合
pyinstaller --noconfirm run.spec

# 製品版でビルドする場合
CORE_MODEL_DIR_PATH="/path/to/core_model" \
LIBCORE_PATH="/path/to/libcore" \
LIBONNXRUNTIME_PATH="/path/to/libonnxruntime" \
pyinstaller --noconfirm run.spec
LIBONNXRUNTIME_PATH="/path/to/libonnxruntime" \
pyinstaller --noconfirm run.spec
```
## 依存関係
Expand Down
8 changes: 7 additions & 1 deletion run.spec
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,16 @@ datas = [
('presets.yaml', '.'),
('default_setting.yml', '.'),
('ui_template', 'ui_template'),
('model', 'model'),
]
datas += collect_data_files('pyopenjtalk')

core_model_dir_path = os.environ.get('CORE_MODEL_DIR_PATH')
if core_model_dir_path:
print('CORE_MODEL_DIR_PATH is found:', core_model_dir_path)
if not os.path.isdir(core_model_dir_path):
raise Exception("CORE_MODEL_DIR_PATH was found, but it is not directory!")
datas += [(core_model_dir_path, "model")]

# コアとONNX Runtimeはバイナリであるが、`binaries`に加えると
# 依存関係のパスがPyInstallerに書き換えらるので、`datas`に加える
# 参考: https://github.com/VOICEVOX/voicevox_engine/pull/446#issuecomment-1210052318
Expand Down

0 comments on commit 92f00d7

Please sign in to comment.