Skip to content

Commit

Permalink
docs: 軽く解決可能なTODOとFIXMEを解消 (#992)
Browse files Browse the repository at this point in the history
readmeやAPIドキュメントのうち、軽く解決できそうなものだけやる。面倒そう
なのは放置。
  • Loading branch information
qryxip authored Feb 10, 2025
1 parent 4b07b68 commit 7e9a3de
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 37 deletions.
16 changes: 6 additions & 10 deletions crates/voicevox_core/src/synthesizer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1223,8 +1223,7 @@ pub(crate) mod blocking {
#[cfg_attr(feature = "load-onnxruntime", doc = "```")]
#[cfg_attr(not(feature = "load-onnxruntime"), doc = "```compile_fail")]
/// # fn main() -> anyhow::Result<()> {
/// # // FIXME: この`ONNXRUNTIME_DYLIB_PATH`はunused import
/// # use test_util::{ONNXRUNTIME_DYLIB_PATH, OPEN_JTALK_DIC_DIR};
/// # use test_util::OPEN_JTALK_DIC_DIR;
/// #
/// # const ACCELERATION_MODE: AccelerationMode = AccelerationMode::Cpu;
/// #
Expand All @@ -1239,9 +1238,8 @@ pub(crate) mod blocking {
/// # .filename(test_util::ONNXRUNTIME_DYLIB_PATH)
/// # .perform()?;
/// #
/// // FIXME: `Synthesizer`には`&mut self`なメソッドはもう無いはず
/// let mut syntesizer = Synthesizer::builder(Onnxruntime::load_once().perform()?)
/// .text_analyzer(Arc::new(OpenJtalk::new(OPEN_JTALK_DIC_DIR).unwrap())) // FIXME: `Arc`は要らないはず
/// let syntesizer = Synthesizer::builder(Onnxruntime::load_once().perform()?)
/// .text_analyzer(OpenJtalk::new(OPEN_JTALK_DIC_DIR).unwrap())
/// .acceleration_mode(ACCELERATION_MODE)
/// .build()?;
/// #
Expand Down Expand Up @@ -1837,8 +1835,7 @@ pub(crate) mod nonblocking {
#[cfg_attr(not(feature = "load-onnxruntime"), doc = "```compile_fail")]
/// # #[pollster::main]
/// # async fn main() -> anyhow::Result<()> {
/// # // FIXME: この`ONNXRUNTIME_DYLIB_PATH`はunused import
/// # use test_util::{ONNXRUNTIME_DYLIB_PATH, OPEN_JTALK_DIC_DIR};
/// # use test_util::OPEN_JTALK_DIC_DIR;
/// #
/// # const ACCELERATION_MODE: AccelerationMode = AccelerationMode::Cpu;
/// #
Expand All @@ -1853,9 +1850,8 @@ pub(crate) mod nonblocking {
/// # .filename(test_util::ONNXRUNTIME_DYLIB_PATH)
/// # .perform()?;
/// #
/// // FIXME: `Synthesizer`には`&mut self`なメソッドはもう無いはず
/// let mut syntesizer = Synthesizer::builder(Onnxruntime::load_once().perform().await?)
/// .text_analyzer(Arc::new(OpenJtalk::new(OPEN_JTALK_DIC_DIR).await.unwrap())) // FIXME: `Arc`は要らないはず
/// let syntesizer = Synthesizer::builder(Onnxruntime::load_once().perform().await?)
/// .text_analyzer(OpenJtalk::new(OPEN_JTALK_DIC_DIR).await.unwrap())
/// .acceleration_mode(ACCELERATION_MODE)
/// .build()?;
/// #
Expand Down
4 changes: 0 additions & 4 deletions crates/voicevox_core/src/version.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
/// 本クレートの`package.version`。
///
/// TODO: ↓ 「Rust APIを外部提供」はもう嘘
///
/// C APIやPython API側からこの値が使われるべきではない。現在はまだRust APIを外部提供していないため、この定数はどこからも参照されていないはずである。
#[doc(alias = "voicevox_get_version")]
pub const VERSION: &str = env!("CARGO_PKG_VERSION");

Expand Down
4 changes: 2 additions & 2 deletions crates/voicevox_core_c_api/include/voicevox_core.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions crates/voicevox_core_c_api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,15 +165,14 @@ pub extern "C" fn voicevox_make_default_load_onnxruntime_options() -> VoicevoxLo
}

// https://github.com/mozilla/cbindgen/issues/967
// FIXME: このコードブロックのコードが動くかどうか未確認
/// ONNX Runtime。
///
/// シングルトンであり、インスタンスは高々一つ。
///
/// ```c
/// const VoicevoxOnnxruntime *ort1;
/// voicevox_onnxruntime_load_once(voicevox_make_default_load_onnxruntime_options,
/// &ort1);
/// voicevox_onnxruntime_load_once(
/// voicevox_make_default_load_onnxruntime_options(), &ort1);
/// const VoicevoxOnnxruntime *ort2 = voicevox_onnxruntime_get();
/// assert(ort1 == ort2);
/// ```
Expand Down
28 changes: 19 additions & 9 deletions crates/voicevox_core_python_api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,32 +8,42 @@ VOICEVOX CORE の Python バインディングです。

- Rustup
- Python ≧ 3.10
- Poetry ≧ 1.6 <!-- FIXME: 今はv2! -->
- Poetry ≧ 2

```console
poetry install --with dev
```

## ファイル構成

<!-- FIXME: 今はasyncio.pyとblocking.pyに分かれており、_rust.pyiも分割されている -->

```console
.
├── Cargo.toml : Rustプロジェクトとしてのマニフェストファイルです。
├── poetry.lock
├── pyproject.toml
├── python : このディレクトリの内容がwhlに入ります。
│ └── voicevox_core
├── python
│ ├── test : pytestのテストです。
│ │ └── …
│ └── voicevox_core : このディレクトリの内容がwhlに入ります。
│ ├── asyncio.py
│ ├── blocking.py
│ ├── __init__.py
│ ├── _models.py
│ ├── __pycache__ : maturin developで生成されます。
│ │ ├── __init__.py
│ │ ├── _please_do_not_use.py
│ │ └─ __pycache__ : maturin developで生成されます。gitignoreされているはずです。
│ │ └── …
│ ├── __pycache__ : 〃
│ │ └── …
│ ├── py.typed
│ ├── _rust.abi3.{dll,dylib,so} : maturin developで生成されるpydファイルです。
│ └── _rust.pyi : _rust.abi3.{dll,dylib,so}用のpyiファイルです。
│ ├── _rust : _rust.abi3.{dll,dylib,so}用のpyiファイル達です。
│ │ ├── asyncio.pyi
│ │ ├── blocking.pyi
│ │ └── __init__.pyi
│ └── _rust.abi3.{dll,dylib,so} : maturin developで生成されるpydファイルです。こちらもgitignoreされているはずです。
├── README.md
└── src : Rustのソースコードです。_rust.abi3.{dll,dylib,so}にコンパイルされます。
└── lib.rs
└──
```

## ビルド
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
# TODO: Rust API同様に、`$BLOCKING_MAX_THREADS`について言及
"""
非同期API。
Performance
-----------
未調査ではあるが、 ``cpu_num_threads`` 物理コアの数+1を指定するのが適切な可能性がある
内部では `Rustのblockingというライブラリ <https://docs.rs/crate/blocking>`_
を用いている。そのため ``$BLOCKING_MAX_THREADS``
から内部のスレッドプールのサイズを調整可能である。
また未調査ではあるが、 ``cpu_num_threads``
は物理コアの数+1を指定するのが適切な可能性がある
(`VOICEVOX/voicevox_core#902 <https://github.com/VOICEVOX/voicevox_core/issues/902>`_)。
"""

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# TODO: Rust API同様のmodule levelのdocstringを書く
"""ブロッキング版API。"""

# TODO: `AudioFeature`を復活させる
# https://github.com/VOICEVOX/voicevox_core/issues/970
Expand Down
9 changes: 3 additions & 6 deletions example/kotlin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,14 @@ https://github.com/VOICEVOX/voicevox_core/releases/latest#%E3%83%80%E3%82%A6%E3%
binary=download-linux-x64
curl -sSfL https://github.com/VOICEVOX/voicevox_core/releases/latest/download/${binary} -o download
chmod +x download
./download -o ./example/kotlin
# いくつかのファイルは不要なので消すことができます
#rm -r ./example/kotlin/{model,VERSION,*voicevox_core*}
./download -o ./example/kotlin --exclude c-api
```

windows の場合

```console
Invoke-WebRequest https://github.com/VOICEVOX/voicevox_core/releases/latest/download/download-windows-x64.exe -OutFile ./download.exe
./download -o ./example/kotlin
# いくつかのファイルは不要なので消すことができます
#Remove-Item -Recurse ./example/kotlin/model,./example/kotlin/VERSION,./example/kotlin/*voicevox_core*
./download -o ./example/kotlin --exclude c-api
```

## 実行
Expand Down Expand Up @@ -61,6 +57,7 @@ Options:
<!-- FIXME: libvoicevox_onnxruntimeになったら`--onnxruntime`を指定するのではなく、`$LD_LIBRARY_PATH`とかに入れて実行するように案内する -->

```console
# TODO: ダウンロード物の構成が変わったため色々壊れているはず
# Linuxの場合
./gradlew run --args="--vvm ../../crates/test_util/data/model/sample.vvm --onnxruntime ../../crates/test_util/data/lib/libonnxruntime.so.1.17.3"
Inititalizing: AUTO, ../../crates/test_util/data/lib/libonnxruntime.so.1.17.3, ./open_jtalk_dic_utf_8-1.11
Expand Down

0 comments on commit 7e9a3de

Please sign in to comment.