0.1.4.post3
This commit is contained in:
@@ -58,7 +58,7 @@ import numpy as np
|
|||||||
if 'CUDAExecutionProvider' in ort.get_available_providers():
|
if 'CUDAExecutionProvider' in ort.get_available_providers():
|
||||||
provider = 'CUDAExecutionProvider'
|
provider = 'CUDAExecutionProvider'
|
||||||
else:
|
else:
|
||||||
provider = 'CPUExecutionProvider"
|
provider = 'CPUExecutionProvider'
|
||||||
opts = ort.SessionOptions()
|
opts = ort.SessionOptions()
|
||||||
opts.intra_op_num_threads = 16
|
opts.intra_op_num_threads = 16
|
||||||
opts.execution_mode = ort.ExecutionMode.ORT_SEQUENTIAL
|
opts.execution_mode = ort.ExecutionMode.ORT_SEQUENTIAL
|
||||||
|
|||||||
+12
-8
@@ -4,22 +4,22 @@ authors = [
|
|||||||
{ name = "nikto_b", email = "niktob560@yandex.ru" }
|
{ name = "nikto_b", email = "niktob560@yandex.ru" }
|
||||||
]
|
]
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
version = "0.1.3"
|
version = "0.1.4.post3"
|
||||||
description = "ONNX wrapper for a GigaAMASR models"
|
description = "ONNX wrapper for a GigaAMASR models"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
requires-python = ">=3.10"
|
requires-python = ">=3.8"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"hatchling>=1.28.0",
|
"numpy>=1.24.0",
|
||||||
"numpy==2.*",
|
"onnxruntime>=1.17.0",
|
||||||
"onnxruntime==1.23.*",
|
"sentencepiece>=0.2.0",
|
||||||
"sentencepiece>=0.2.1",
|
"torch>=2.4,<2.9",
|
||||||
"torch>=2.5,<2.9",
|
"torchaudio>=2.4,<2.9",
|
||||||
"torchaudio>=2.5,<2.9",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[dependency-groups]
|
[dependency-groups]
|
||||||
dev = [
|
dev = [
|
||||||
"scipy>=1.0.0",
|
"scipy>=1.0.0",
|
||||||
|
"hatchling",
|
||||||
]
|
]
|
||||||
|
|
||||||
[build-system]
|
[build-system]
|
||||||
@@ -28,3 +28,7 @@ build-backend = "hatchling.build"
|
|||||||
|
|
||||||
[tool.hatch.build.targets.wheel]
|
[tool.hatch.build.targets.wheel]
|
||||||
packages = ["src/gigaam_onnx"]
|
packages = ["src/gigaam_onnx"]
|
||||||
|
core-metadata-version = "2.4"
|
||||||
|
|
||||||
|
[tool.hatch.build.targets.sdist]
|
||||||
|
core-metadata-version = "2.4"
|
||||||
|
|||||||
@@ -76,9 +76,10 @@ class ASRABCModel(abc.ABC):
|
|||||||
features = None
|
features = None
|
||||||
input_lengths_array = None
|
input_lengths_array = None
|
||||||
full_batch_size = len(all_wavs)
|
full_batch_size = len(all_wavs)
|
||||||
|
BATCH_MAX_SIZE = 1
|
||||||
while len(all_wavs) > 0:
|
while len(all_wavs) > 0:
|
||||||
wavs = all_wavs[:128]
|
wavs = all_wavs[:BATCH_MAX_SIZE]
|
||||||
all_wavs = all_wavs[128:]
|
all_wavs = all_wavs[BATCH_MAX_SIZE:]
|
||||||
|
|
||||||
input_lengths = []
|
input_lengths = []
|
||||||
processed_wavs = []
|
processed_wavs = []
|
||||||
|
|||||||
@@ -30,6 +30,9 @@ class RNNTASR(ASRABCModel):
|
|||||||
timings = []
|
timings = []
|
||||||
prev_token = self.blank_idx
|
prev_token = self.blank_idx
|
||||||
|
|
||||||
|
if len(features.shape) == 2:
|
||||||
|
features = np.expand_dims(features, axis=0)
|
||||||
|
|
||||||
pred_states = [
|
pred_states = [
|
||||||
np.zeros(shape=(1, 1, self.head.decoder.pred_hidden), dtype=DTYPE),
|
np.zeros(shape=(1, 1, self.head.decoder.pred_hidden), dtype=DTYPE),
|
||||||
np.zeros(shape=(1, 1, self.head.decoder.pred_hidden), dtype=DTYPE),
|
np.zeros(shape=(1, 1, self.head.decoder.pred_hidden), dtype=DTYPE),
|
||||||
@@ -57,7 +60,8 @@ class RNNTASR(ASRABCModel):
|
|||||||
log_probs = self.jointer.run(
|
log_probs = self.jointer.run(
|
||||||
[node.name for node in self.jointer.get_outputs()], joint_inputs
|
[node.name for node in self.jointer.get_outputs()], joint_inputs
|
||||||
)
|
)
|
||||||
token = log_probs[0].argmax(-1)[0][0]
|
#token = log_probs[0].argmax(-1)[0][0]
|
||||||
|
token = int(log_probs[0].argmax(-1).reshape(-1)[0])
|
||||||
|
|
||||||
if token != self.blank_idx:
|
if token != self.blank_idx:
|
||||||
prev_token = int(token)
|
prev_token = int(token)
|
||||||
|
|||||||
Reference in New Issue
Block a user