fix: build optimization, convert model onnx

This commit is contained in:
Googlefan
2024-09-22 06:00:57 +00:00
parent 290fb37c16
commit 962fa9a49d
3 changed files with 17 additions and 8 deletions

View File

@@ -7,3 +7,8 @@ anyhow = "1.0.86"
dotenvy = "0.15.7"
env_logger = "0.11.5"
ndarray = "0.16.1"
[profile.release]
lto = true
debug = false
strip = true

View File

@@ -126,11 +126,13 @@ torch.onnx.export(
f"../models/model_{out_name}.onnx",
verbose=True,
dynamic_axes={
"x_tst": {1: "batch_size"},
"x_tst": {0: "batch_size", 1: "x_tst_max_length"},
"x_tst_lengths": {0: "batch_size"},
"tones": {1: "batch_size"},
"language": {1: "batch_size"},
"bert": {2: "batch_size"},
"sid": {0: "batch_size"},
"tones": {0: "batch_size", 1: "x_tst_max_length"},
"language": {0: "batch_size", 1: "x_tst_max_length"},
"bert": {0: "batch_size", 2: "x_tst_max_length"},
"style_vec": {0: "batch_size"},
},
input_names=[
"x_tst",

View File

@@ -11,7 +11,9 @@ def main():
style_vector = model.get_style_vector("amitaro", 0, 1.0)
with open("output.wav", "wb") as f:
f.write(model.synthesize("おはようございます。", "amitaro", style_vector, 0.0, 0.5))
f.write(
model.synthesize("おはようございます。", "amitaro", style_vector, 0.0, 0.5)
)
if __name__ == "__main__":