-
Notifications
You must be signed in to change notification settings - Fork 122
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat!: [Java] fix up #802:
SupportedDevices
を移動
- Loading branch information
Showing
5 changed files
with
66 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
.../voicevox_core_java_api/lib/src/main/java/jp/hiroshiba/voicevoxcore/SupportedDevices.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
package jp.hiroshiba.voicevoxcore; | ||
|
||
import com.google.gson.annotations.Expose; | ||
import com.google.gson.annotations.SerializedName; | ||
import jakarta.annotation.Nonnull; | ||
|
||
/** | ||
* ONNX Runtime利用可能なデバイスの情報。 | ||
* | ||
* <p>あくまでONNX Runtimeが対応しているデバイスの情報であることに注意。GPUが使える環境ではなかったとしても {@link #cuda} や {@link #dml} は | ||
* {@code true} を示しうる。 | ||
* | ||
* <p>現在この型はGSONに対応しているが、将来的には <a href="https://github.com/VOICEVOX/voicevox_core/issues/984" | ||
* target="_blank">Jacksonに切り替わる予定</a> 。 | ||
* | ||
* <p>{@code Gson#fromJson} でJSONから変換することはできない。その試みは {@link UnsupportedOperationException} となる。 | ||
*/ | ||
public class SupportedDevices { | ||
/** | ||
* CPUが利用可能。 | ||
* | ||
* <p>常に <code>true</code> 。 | ||
*/ | ||
@SerializedName("cpu") | ||
@Expose | ||
@Nonnull | ||
public final boolean cpu; | ||
|
||
/** | ||
* CUDAが利用可能。 | ||
* | ||
* <p>ONNX Runtimeの <a href= | ||
* "https://onnxruntime.ai/docs/execution-providers/CUDA-ExecutionProvider.html" | ||
* target="_blank">CUDAExecutionProvider</a>に対応する。 必要な環境についてはそちらを参照。 | ||
*/ | ||
@SerializedName("cuda") | ||
@Expose | ||
@Nonnull | ||
public final boolean cuda; | ||
|
||
/** | ||
* DirectMLが利用可能。 | ||
* | ||
* <p>ONNX Runtimeの <a href= | ||
* "https://onnxruntime.ai/docs/execution-providers/DirectML-ExecutionProvider.html" | ||
* target="_blank">DmlExecutionProvider</a>に対応する。 必要な環境についてはそちらを参照。 | ||
*/ | ||
@SerializedName("dml") | ||
@Expose | ||
@Nonnull | ||
public final boolean dml; | ||
|
||
private SupportedDevices() { | ||
throw new UnsupportedOperationException("You cannot deserialize `SupportedDevices`"); | ||
} | ||
|
||
/** accessed only via JNI */ | ||
private SupportedDevices(boolean cpu, boolean cuda, boolean dml) { | ||
this.cpu = cpu; | ||
this.cuda = cuda; | ||
this.dml = dml; | ||
} | ||
} |
3 changes: 1 addition & 2 deletions
3
...cevox_core_java_api/lib/src/main/java/jp/hiroshiba/voicevoxcore/blocking/Onnxruntime.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters