Skip to content
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

ビルド時のmodelディレクトリの指定をオプショナルにする #725

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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