From bd7f4dbf3d8241a2a81e04344d377b95b491c48d Mon Sep 17 00:00:00 2001 From: Hiroshiba Date: Sat, 14 Oct 2023 00:53:08 +0900 Subject: [PATCH] =?UTF-8?q?C=20API=E7=94=A8=E3=81=AEzip=E3=83=95=E3=82=A1?= =?UTF-8?q?=E3=82=A4=E3=83=AB=E3=81=8B=E3=82=89model=E3=83=87=E3=82=A3?= =?UTF-8?q?=E3=83=AC=E3=82=AF=E3=83=88=E3=83=AA=E3=82=92=E3=81=AA=E3=81=8F?= =?UTF-8?q?=E3=81=97=E3=80=81=E5=88=A5=E3=81=A7model=E3=83=80=E3=82=A6?= =?UTF-8?q?=E3=83=B3=E3=83=AD=E3=83=BC=E3=83=89=E5=8F=AF=E8=83=BD=E3=81=AB?= =?UTF-8?q?=E3=81=99=E3=82=8B=20(#603)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Ryo Yamashita --- .github/workflows/build_and_deploy.yml | 48 ++++++++++++++++++++------ .github/workflows/download_test.yml | 8 ++--- README.md | 15 ++++++-- crates/download/src/main.rs | 20 ++++++++--- 4 files changed, 71 insertions(+), 20 deletions(-) diff --git a/.github/workflows/build_and_deploy.yml b/.github/workflows/build_and_deploy.yml index 0c3bb327a..20f7f1866 100644 --- a/.github/workflows/build_and_deploy.yml +++ b/.github/workflows/build_and_deploy.yml @@ -29,7 +29,7 @@ on: env: VOICEVOX_RESOURCE_VERSION: "0.15.0-preview.3" - VOICEVOX_FAT_RESOURCE_VERSION: "0.15.0-preview.3" + VOICEVOX_FAT_RESOURCE_VERSION: "0.15.0-preview.4" # releaseタグ名か、workflow_dispatchでのバージョン名か、'0.0.0'が入る VERSION: ${{ github.event.release.tag_name || inputs.version || '0.0.0' }} PRODUCTION_REPOSITORY_TAG: "0.15.0-preview.2" # 製品版のタグ名 @@ -239,19 +239,11 @@ jobs: repository: VOICEVOX/voicevox_resource ref: ${{ env.VOICEVOX_RESOURCE_VERSION }} path: download/resource - - name: Checkout VOICEVOX FAT RESOURCE - if: inputs.is_production - uses: actions/checkout@v3 - with: - repository: VOICEVOX/voicevox_fat_resource - ref: ${{ env.VOICEVOX_FAT_RESOURCE_VERSION }} - path: download/fat_resource - name: Raplace resource if: inputs.is_production shell: bash run: | mv -f download/resource/core/README.md ./README.md - rm -r ./model; mv download/fat_resource/core/model ./model - name: Install cargo-binstall uses: taiki-e/install-action@cargo-binstall - name: Install cargo-edit @@ -315,7 +307,6 @@ jobs: # libonnxruntimeについてはバージョン付のshared libraryを使用するためバージョンがついてないものを削除する rm -f artifact/${{ env.ASSET_NAME }}/libonnxruntime.{so,dylib} cp -v README.md "artifact/${{ env.ASSET_NAME }}/README.txt" - cp -vr model "artifact/${{ env.ASSET_NAME }}/" echo "${{ env.VERSION }}" > "artifact/${{ env.ASSET_NAME }}/VERSION" mkdir java_artifact @@ -417,6 +408,43 @@ jobs: ${{ env.ASSET_NAME }}.zip target_commitish: ${{ github.sha }} + deploy_model: + runs-on: ubuntu-latest + needs: config + env: + ASSET_NAME: model-${{ needs.config.outputs.version }} + steps: + - uses: actions/checkout@v3 + - name: Checkout VOICEVOX FAT RESOURCE + if: inputs.is_production + uses: actions/checkout@v3 + with: + repository: VOICEVOX/voicevox_fat_resource + ref: ${{ env.VOICEVOX_FAT_RESOURCE_VERSION }} + path: download/fat_resource + - name: Raplace resource + if: inputs.is_production + shell: bash + run: | + rm -r ./model; mv download/fat_resource/core/model ./model + - name: Create artifact + run: | + mkdir "artifact" + mv model "artifact/${{ env.ASSET_NAME }}/" + - name: Archive artifact + run: | + cd artifact + 7z a "../${{ env.ASSET_NAME }}.zip" "${{ env.ASSET_NAME }}" + - name: Upload to Release + if: fromJson(needs.config.outputs.deploy) + uses: softprops/action-gh-release@v1 + with: + prerelease: true + tag_name: ${{ env.VERSION }} + files: |- + ${{ env.ASSET_NAME }}.zip + target_commitish: ${{ github.sha }} + build_java_package: runs-on: ubuntu-latest if: ${{ !(github.event_name != 'release' && github.event_name != 'workflow_dispatch') }} # !env.IS_SIMPLE_TEST と同じ diff --git a/.github/workflows/download_test.yml b/.github/workflows/download_test.yml index 6e8ff1b6f..b9e295607 100644 --- a/.github/workflows/download_test.yml +++ b/.github/workflows/download_test.yml @@ -87,7 +87,6 @@ jobs: download_dir: voicevox_core check_items: | voicevox_core.dll - model/README.* README.txt check_not_exists_items: | *directml* @@ -97,6 +96,7 @@ jobs: *nvidia* *cufft* *curand* + model/README.* open_jtalk_dic_utf_8-1.11 - name: DirectML option確認 os: windows-latest @@ -123,7 +123,6 @@ jobs: download_dir: voicevox_core check_items: | voicevox_core.dll - model/README.* README.txt check_not_exists_items: | *cuda* @@ -134,6 +133,7 @@ jobs: *curand* Directml.dll DirectML_LICENSE.txt + model/README.* open_jtalk_dic_utf_8-1.11 - name: cuda option確認 os: windows-latest @@ -163,7 +163,6 @@ jobs: download_dir: voicevox_core check_items: | voicevox_core.dll - model/README.* README.txt check_not_exists_items: | *directml* @@ -178,6 +177,7 @@ jobs: cudnn_ops_infer64_*.dll cufft64_*.dll curand64_*.dll + model/README.* open_jtalk_dic_utf_8-1.11 runs-on: ${{ matrix.os }} name: ${{ matrix.name }}-${{ matrix.os }} @@ -196,7 +196,7 @@ jobs: ) echo "VERSION=$VERSION" >> "$GITHUB_ENV" - name: Execute download command - run: ${{ matrix.download_command }} --version ${{ env.VERSION }} + run: ${{ matrix.download_command }} --version ${{ env.VERSION }} --core-repo ${{ github.repository }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Check downloaded version diff --git a/README.md b/README.md index 41cf622f4..bbfb23f0f 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # VOICEVOX CORE -## **現在のmainブランチは工事中なので正しく動かないことがあります。[バージョン0.14.4](https://github.com/VOICEVOX/voicevox_core/tree/0.14.4)をご利用ください。** +## **現在の main ブランチは工事中なので正しく動かないことがあります。[バージョン 0.14.4](https://github.com/VOICEVOX/voicevox_core/tree/0.14.4)をご利用ください。** [![releases](https://img.shields.io/github/v/release/VOICEVOX/voicevox_core?label=release)](https://github.com/VOICEVOX/voicevox_core/releases) [![test](https://github.com/VOICEVOX/voicevox_core/actions/workflows/test.yml/badge.svg)](https://github.com/VOICEVOX/voicevox_core/actions/workflows/test.yml) @@ -15,6 +15,7 @@ 全体構成は [こちら](https://github.com/VOICEVOX/voicevox/blob/main/docs/%E5%85%A8%E4%BD%93%E6%A7%8B%E6%88%90.md) に詳細があります。) ## 貢献者の方へ + Issue を解決するプルリクエストを作成される際は、別の方と同じ Issue に取り組むことを避けるため、 Issue 側で取り組み始めたことを伝えるか、最初に Draft プルリクエストを作成してください。 @@ -152,6 +153,15 @@ DLL用のヘッダファイルは [crates/voicevox\_core\_c\_api/include/voicevo cargo test ``` +## ダウンローダーの実行 + +```bash +cargo run -p download + +# ヘルプを表示 +cargo run -p download -- -h +``` + ## ヘッダファイルの更新 ```bash @@ -177,7 +187,8 @@ typos **[voicevoxcore4s](https://github.com/windymelt/voicevoxcore4s) [@windymelt](https://github.com/windymelt)** ・・・ VOICEVOX CORE の Scala(JVM) 向け FFI ラッパー **[voicevox_flutter](https://github.com/char5742/voicevox_flutter) [@char5742](https://github.com/char5742)** ・・・ VOICEVOX CORE の Flutter 向け FFI ラッパー **[voicevoxcore.go](https://github.com/sh1ma/voicevoxcore.go) [@sh1ma](https://github.com/sh1ma)** ・・・ VOICEVOX CORE の Go 言語 向け FFI ラッパー -**[VoicevoxCoreSharp](https://github.com/yamachu/VoicevoxCoreSharp) [@yamachu](https://github.com/yamachu)** ・・・ VOICEVOX CORE の C# 向け FFI ラッパー +**[VoicevoxCoreSharp](https://github.com/yamachu/VoicevoxCoreSharp) [@yamachu](https://github.com/yamachu)** ・・・ VOICEVOX CORE の C# 向け FFI ラッパー + ## ライセンス ソースコードのライセンスは [MIT LICENSE](./LICENSE) です。 diff --git a/crates/download/src/main.rs b/crates/download/src/main.rs index 5e77f9ee4..31452719d 100644 --- a/crates/download/src/main.rs +++ b/crates/download/src/main.rs @@ -158,7 +158,7 @@ async fn main() -> anyhow::Result<()> { let octocrab = &octocrab()?; - let core = find_gh_asset(octocrab, core_repo, &version, |tag| { + let core = find_gh_asset(octocrab, &core_repo, &version, |tag| { let device = match (os, device) { (Os::Linux, Device::Cuda) => "gpu", (_, device) => device.into(), @@ -167,10 +167,15 @@ async fn main() -> anyhow::Result<()> { }) .await?; + let model = find_gh_asset(octocrab, &core_repo, &version, |tag| { + format!("model-{tag}.zip") + }) + .await?; + let additional_libraries = OptionFuture::from((device != Device::Cpu).then(|| { find_gh_asset( octocrab, - additional_libraries_repo, + &additional_libraries_repo, &additional_libraries_version, |_| { let device = match device { @@ -205,6 +210,13 @@ async fn main() -> anyhow::Result<()> { )?); if !min { + tasks.spawn(download_and_extract_from_gh( + model, + Stripping::FirstDir, + &output.join("model"), + &progresses, + )?); + if let Some(additional_libraries) = additional_libraries { tasks.spawn(download_and_extract_from_gh( additional_libraries, @@ -255,7 +267,7 @@ fn octocrab() -> octocrab::Result> { async fn find_gh_asset( octocrab: &Arc, - repo: RepoName, + repo: &RepoName, git_tag_or_latest: &str, asset_name: impl FnOnce(&str) -> String, ) -> anyhow::Result { @@ -281,7 +293,7 @@ async fn find_gh_asset( Ok(GhAsset { octocrab: octocrab.clone(), - repo, + repo: repo.clone(), tag: tag_name, id, name,