Add imports to __init__.py

This commit is contained in:
2025-12-03 16:49:15 +03:00
parent 4f7f22e95f
commit b1240d150d
3 changed files with 25 additions and 6 deletions

View File

@@ -1,9 +1,14 @@
# GigaAM ASR for ONNX # GigaAM ASR for ONNX
## Project purpose: ## Project purpose:
Usage of a latest (v3) versions of a GigaAMASR without additional dependencies and localy stored models
Usage of a latest (v3) versions of a GigaAMASR without additional dependencies and with localy stored models running in
an ONNX runtime
## Project setup: ## Project setup:
1. Set up original GigaAM project 1. Set up original GigaAM project
```bash ```bash
# Clone original GigaAM repo: # Clone original GigaAM repo:
git clone https://github.com/salute-developers/GigaAM git clone https://github.com/salute-developers/GigaAM
@@ -16,25 +21,34 @@ source ./tmp_venv/bin/activate
# Install project: # Install project:
pip install -e . pip install -e .
``` ```
2. Acquire chosen models: 2. Acquire chosen models:
```python ```python
import gigaam import gigaam
onnx_dir = '/target/onnx/model/paths' onnx_dir = '/target/onnx/model/paths'
model_version = 'v3_ctc' # Options: v3_* models model_version = 'v3_ctc' # Options: v3_* models
model = gigaam.load_model(model_version) model = gigaam.load_model(model_version)
model.to_onnx(dir_path=onnx_dir) model.to_onnx(dir_path=onnx_dir)
``` ```
3. Fetch tokenizer SentencePieceProcessor model from cache
- From `~/.cache/gigaam/{model_name}_tokenizer.model` 3. Fetch SentencePieceProcessor tokenizer model
- From `https://cdn.chatwm.opensmodel.sberdevices.ru/GigaAM/{model_name}_tokenizer.model`
- From a cache `~/.cache/gigaam/{model_name}_tokenizer.model`
- From a sberdevices server `https://cdn.chatwm.opensmodel.sberdevices.ru/GigaAM/{model_name}_tokenizer.model`
4. Then you may remove original project: 4. Then you may remove original project:
```bash ```bash
cd .. cd ..
rm -r ./GigaAM rm -r ./GigaAM
``` ```
5. Install this (gigaam-onnx) project 5. Install this (gigaam-onnx) project
6. Set up onnx runtime and load chosen model: 6. Set up onnx runtime and load chosen model:
```python ```python
import onnxruntime as ort import onnxruntime as ort
from gigaam_onnx import GigaAMV3E2ERNNT, GigaAMV3RNNT, GigaAMV3E2ECTC, GigaAMV3CTC from gigaam_onnx import GigaAMV3E2ERNNT, GigaAMV3RNNT, GigaAMV3E2ECTC, GigaAMV3CTC
@@ -95,4 +109,4 @@ text, timings = e2e_rnnt_model.transcribe_batch(
[audio_array] # audio chunks [audio_array] # audio chunks
[1] # length of chunks to combine [1] # length of chunks to combine
)[0] )[0]
``` ```

View File

@@ -4,8 +4,9 @@ authors = [
{ name = "nikto_b", email = "niktob560@yandex.ru" } { name = "nikto_b", email = "niktob560@yandex.ru" }
] ]
license = "MIT" license = "MIT"
version = "0.1.0" version = "0.1.1"
description = "ONNX wrapper for a GigaAMASR models" description = "ONNX wrapper for a GigaAMASR models"
readme = "README.md"
requires-python = ">=3.13" requires-python = ">=3.13"
dependencies = [ dependencies = [
"hatchling>=1.28.0", "hatchling>=1.28.0",

View File

@@ -0,0 +1,4 @@
from gigaam_onnx.v3_ctc import GigaAMV3CTC
from gigaam_onnx.v3_e2e_ctc import GigaAMV3E2ECTC
from gigaam_onnx.v3_e2e_rnnt import GigaAMV3E2ERNNT
from gigaam_onnx.v3_rnnt import GigaAMV3RNNT