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

複数エンジン対応:Engine manifestによるUI無効化 #919

Merged
merged 23 commits into from
Sep 13, 2022

Conversation

sevenc-nanashi
Copy link
Member

内容

Engine manifestのsupported_featuresによって一部UI(音高やイントネーションなど)を無効化するようにします。

関連 Issue

スクリーンショット・動画など

(なし)

その他

(なし)

@sevenc-nanashi
Copy link
Member Author

openapi.jsonが古くて動けない状況です、更新PRは更新PRで作った方がよさそう。
(更新方法は判ってない)

@Hiroshiba
Copy link
Member

あ! ちょうど今そのPRを作っているところです・・・!

@Hiroshiba
Copy link
Member

Hiroshiba commented Sep 3, 2022

@sevenc-nanashi openapi更新しました! 🙏

@sevenc-nanashi
Copy link
Member Author

image

現在の進捗です

@sevenc-nanashi
Copy link
Member Author

sevenc-nanashi commented Sep 3, 2022

image

イントネーション、長さの無効化も実装できました。
項目内のコンポーネントのdisableをいじってもよかったんですけど、それだとどこかで漏れが発生しそうだったので項目ごと無効化しています。
項目の選択中にその機能をサポートしていない別のエンジンに切り替わった場合(例:イントネーション選択中にadjust_mora_pitchをサポートしていないエンジンに切り替わる)は自動的にアクセントに移動するようになっているはずですが、supported_featuresを実装したエンジンがまだVoicevox Engine以外に存在していないためまだデバッグできていないです。

@sevenc-nanashi
Copy link
Member Author

interrogative_upspeakはまだUI側に何もなさそうだったので飛ばします。

@sevenc-nanashi sevenc-nanashi marked this pull request as ready for review September 3, 2022 21:09
@Hiroshiba
Copy link
Member

upported_featuresを実装したエンジンがまだVoicevox Engine以外に存在していないためまだデバッグできていないです。

あ、ちょっと面倒かもなのですが、エンジンをディレクトリごとコピーしちゃって、片方のエンジンのengine_manifest.jsonを書き換えちゃうという手があるかもです!

@sevenc-nanashi
Copy link
Member Author

それやろうとしたんですけど、キャラがかぶるんですよね…
uuid、フォルダ名を変えて試したんですけど、多分埋め込まれてるmetas.jsonのデータが残って500返されました

@Hiroshiba
Copy link
Member

あーーーそうか・・・・。ちょっとCOEIROINKさんにお願いしてみます!

@Hiroshiba
Copy link
Member

Hiroshiba commented Sep 4, 2022

いや、COEIROINK側にもある機能だとデバッグできないから解決にならないか・・・。

@sevenc-nanashi
Copy link
Member Author

coeiroink側を全有効、開発版ボイボエンジン側を無効にすればよさそう。

@Hiroshiba
Copy link
Member

すみません、もしかしてこちらのPRはすでに完成されてたりしますか・・・?

@sevenc-nanashi
Copy link
Member Author

あーっと、Coeiroinkで試そうとしたら/engine_manifestがなくて困ってる感じです。
今朝、間にflaskか何かで中継鯖立ててengine_manifestだけ拾うというのを思いついたのでやってます

@Hiroshiba
Copy link
Member

おお、なるほどです!であれば仕方ないですね…!

src/components/AudioDetail.vue Outdated Show resolved Hide resolved
src/components/AudioInfo.vue Outdated Show resolved Hide resolved
src/store/ui.ts Outdated Show resolved Hide resolved
Copy link
Member

@Hiroshiba Hiroshiba left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

いくつかコメントを書きましたが、概ねLGTMの気持ちです!

Copy link
Member

@Hiroshiba Hiroshiba left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!!

@raa0121
Copy link
Contributor

raa0121 commented Sep 9, 2022

このブランチに main を再度マージして、試してみましたが、エラーが出ました。
COELINK 側には、 #922 に貼られてた engine_manifest.json を設置済みです。

[23:52:17.942] [error] Failed to read icon file: C:\Users\raa0121\AppData\Roaming\voicevox-dev\engines\COEIROINK-CPU-c0.2.0+v0.10.preview.0\icon.png
[23:52:18.497] [error] Failed to read icon file: C:\Users\raa0121\AppData\Roaming\voicevox-dev\engines\COEIROINK-CPU-c0.2.0+v0.10.preview.0\icon.png
[23:52:18.498] [info]  Starting 2 engine/s...
[23:52:18.499] [info]  ENGINE 074fc39e-678b-4c13-8916-ffca8d505d1d: Start launching
[23:52:18.499] [error] Failed to read icon file: C:\Users\raa0121\AppData\Roaming\voicevox-dev\engines\COEIROINK-CPU-c0.2.0+v0.10.preview.0\icon.png
[23:52:18.500] [info]  ENGINE 074fc39e-678b-4c13-8916-ffca8d505d1d: Starting process
[23:52:18.500] [info]  ENGINE 074fc39e-678b-4c13-8916-ffca8d505d1d mode: GPU
[23:52:18.501] [info]  ENGINE 074fc39e-678b-4c13-8916-ffca8d505d1d path: D:\Program\VOICEVOX\run.exe
[23:52:18.501] [info]  ENGINE 074fc39e-678b-4c13-8916-ffca8d505d1d args: ["--use_gpu"]
[23:52:18.558] [info]  ENGINE d9212658-962f-4918-80b2-310b7de70c41: Start launching
[23:52:18.559] [error] Failed to read icon file: C:\Users\raa0121\AppData\Roaming\voicevox-dev\engines\COEIROINK-CPU-c0.2.0+v0.10.preview.0\icon.png
[23:52:18.559] [info]  ENGINE d9212658-962f-4918-80b2-310b7de70c41: Starting process
[23:52:18.560] [info]  ENGINE d9212658-962f-4918-80b2-310b7de70c41 mode: GPU
[23:52:18.560] [info]  ENGINE d9212658-962f-4918-80b2-310b7de70c41 path: C:\Users\raa0121\AppData\Roaming\voicevox-dev\engines\COEIROINK-CPU-c0.2.0+v0.10.preview.0\run
[23:52:18.560] [info]  ENGINE d9212658-962f-4918-80b2-310b7de70c41 args: ["--use_gpu"]
[31188:0909/235219.056:ERROR:CONSOLE(160)] "Electron sandbox_bundle.js script failed to run", source: node:electron/js2c/sandbox_bundle (160)
[31188:0909/235219.057:ERROR:CONSOLE(160)] "TypeError: object null is not iterable (cannot read property Symbol(Symbol.iterator))", source: node:electron/js2c/sandbox_bundle (160)
[23:52:20.614] [error] TypeError: Failed to fetch
    at DefaultApi._callee$ (http://localhost:8080/js/webpack:/src/openapi/runtime.ts:89:30)
    at tryCatch (http://localhost:8080/js/webpack:/node_modules/regenerator-runtime/runtime.js:63:15)
    at Generator.invoke [as _invoke] (http://localhost:8080/js/webpack:/node_modules/regenerator-runtime/runtime.js:293:1)
    at Generator.next (http://localhost:8080/js/webpack:/node_modules/regenerator-runtime/runtime.js:118:1)
    at http://localhost:8080/js/webpack:/node_modules/tslib/tslib.es6.js:74:1
    at new Promise (<anonymous>)
    at __awaiter (http://localhost:8080/js/webpack:/node_modules/tslib/tslib.es6.js:70:1)
    at DefaultApi.BaseAPI.fetchApi (http://localhost:8080/js/webpack:/src/openapi/runtime.ts:79:65)
    at DefaultApi._callee2$ (http://localhost:8080/js/webpack:/src/openapi/runtime.ts:49:37)
    at tryCatch (http://localhost:8080/js/webpack:/node_modules/regenerator-runtime/runtime.js:63:15)
[23:52:22.144] [error] ENGINE d9212658-962f-4918-80b2-310b7de70c41 STDERR: Warning: Failed to read the user dictionary.
Traceback (most recent call last):
  File "voicevox_engine\synthesis_engine\make_synthesis_engine.py", line 39, in make_synthesis_engine
ModuleNotFoundError: No module named 'core'
Notice: mock-library will be used. Try re-run with valid --voicevox_dir

[23:52:22.153] [error] ENGINE d9212658-962f-4918-80b2-310b7de70c41 STDERR: INFO:     Started server process [18632]
INFO:uvicorn.error:Started server process [18632]
INFO:     Waiting for application startup.
INFO:uvicorn.error:Waiting for application startup.

[23:52:22.154] [error] ENGINE d9212658-962f-4918-80b2-310b7de70c41 STDERR: INFO:     Application startup complete.
INFO:uvicorn.error:Application startup complete.
INFO:     Uvicorn running on http://127.0.0.1:50031 (Press CTRL+C to quit)
INFO:uvicorn.error:Uvicorn running on http://127.0.0.1:50031 (Press CTRL+C to quit)

[23:52:26.358] [error] ENGINE 074fc39e-678b-4c13-8916-ffca8d505d1d STDERR: Warning: cpu_num_threads is set to 0. ( The library leaves the decision to the synthesis runtime )

[23:52:26.365] [error] ENGINE 074fc39e-678b-4c13-8916-ffca8d505d1d STDERR: INFO:     Started server process [18760]
INFO:     Waiting for application startup.

[23:52:26.415] [info]  ENGINE 074fc39e-678b-4c13-8916-ffca8d505d1d STDOUT: reading D:\Program\VOICEVOX\default.csv ... 42
emitting double-array:  35% |###############                            | 
emitting double-array: 100% |###########################################|  emitting double-array:  38% |################                           | 

[23:52:26.460] [error] ENGINE 074fc39e-678b-4c13-8916-ffca8d505d1d STDERR: INFO:     Application startup complete.

[23:52:26.461] [error] ENGINE 074fc39e-678b-4c13-8916-ffca8d505d1d STDERR: INFO:     Uvicorn running on http://127.0.0.1:50021 (Press CTRL+C to quit)

[17600:0909/235417.307:ERROR:gpu_init.cc(481)] Passthrough is not supported, GL is disabled, ANGLE is 

@sevenc-nanashi
Copy link
Member Author

sevenc-nanashi commented Sep 9, 2022

import flask
import requests
import json
from flask_cors import CORS

app = flask.Flask(__name__)
CORS(app)
session = requests.Session()


@app.route("/engine_manifest")
def engine_manifest():
    with open("../coeiroink/engine_manifest.json") as f:
        d = json.load(f)
    for k in ("update_infos", "dependency_licenses"):
        with open("../coeiroink/" + d[k]) as f:
            d[k] = json.load(f)
    with open("../coeiroink/" + d["terms_of_service"]) as f:
        d["terms_of_service"] = f.read()
    d["supported_features"] = {k: v["value"] for k, v in d["supported_features"].items()}
    r = flask.jsonify(d)
    r.access_control_allow_origin = "*"
    return r


@app.route("/", defaults={"path": ""})
@app.route("/<path:path>", methods=["GET", "POST", "PUT", "DELETE", "OPTIONS"])
def proxy(path):
    resp = session.request(
        method=flask.request.method,
        url=flask.request.url.replace(flask.request.host_url, "http://localhost:50031/"),
        headers={
            key: value
            for (key, value) in flask.request.headers
            if key != "Host" and key != "Access-Control-Allow-Origin"
        },
        data=flask.request.get_data(),
        cookies=flask.request.cookies,
    )
    return flask.Response(
        response=resp.content,
        status=resp.status_code,
        headers={key: value for (key, value) in resp.raw.headers.items()},
    )


app.run(port=50030, debug=True)

自分が使ってたプロキシ(?)です、こっちを登録すれば動くかも?

@Hiroshiba
Copy link
Member

@raa0121 プロキシ挟むか、もしくはとりあえずUI無効化を試すなら、ボイボのengine_manifest.jsonのfeaturesを全部falseにして起動すればOKだと思います!

@raa0121
Copy link
Contributor

raa0121 commented Sep 12, 2022

すいません、手元でちゃんと動かせてないんですが、コード的には問題ないと思います。

Copy link
Member

@Hiroshiba Hiroshiba left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

実際に触ってみるとちょっと変な挙動があったのでRequest changesにしました!

src/components/AudioDetail.vue Outdated Show resolved Hide resolved
src/components/AudioDetail.vue Outdated Show resolved Hide resolved
Copy link
Member

@Hiroshiba Hiroshiba left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

改めてLGTM!!

@raa0121 さんもレビューありがとうございます!
マージします!!

@Hiroshiba Hiroshiba merged commit b14c460 into VOICEVOX:main Sep 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants