nexaai 1.0.21rc11__cp310-cp310-win_amd64.whl → 1.0.21rc12__cp310-cp310-win_amd64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of nexaai might be problematic. Click here for more details.

Binary file
nexaai/_version.py CHANGED
@@ -1,4 +1,4 @@
1
1
  # This file is generated by CMake from _version.py.in
2
2
  # Do not modify this file manually - it will be overwritten
3
3
 
4
- __version__ = "1.0.21-rc11"
4
+ __version__ = "1.0.21-rc12"
nexaai/asr.py CHANGED
@@ -3,7 +3,7 @@ from abc import abstractmethod
3
3
  from dataclasses import dataclass
4
4
 
5
5
  from nexaai.base import BaseModel
6
- from nexaai.common import PluginID
6
+ from nexaai.common import PluginID, ModelConfig
7
7
 
8
8
 
9
9
  @dataclass
@@ -25,15 +25,17 @@ class ASRResult:
25
25
  class ASR(BaseModel):
26
26
  """Abstract base class for Automatic Speech Recognition models."""
27
27
 
28
- def __init__(self):
28
+ def __init__(self, m_cfg: ModelConfig = ModelConfig()):
29
29
  """Initialize base ASR class."""
30
- pass
30
+ self._m_cfg = m_cfg
31
31
 
32
32
  @classmethod
33
33
  def _load_from(cls,
34
34
  model_path: str,
35
+ model_name: Optional[str] = None,
35
36
  tokenizer_path: Optional[str] = None,
36
37
  language: Optional[str] = None,
38
+ m_cfg: ModelConfig = ModelConfig(),
37
39
  plugin_id: Union[PluginID, str] = PluginID.LLAMA_CPP,
38
40
  device_id: Optional[str] = None,
39
41
  **kwargs
@@ -44,10 +46,11 @@ class ASR(BaseModel):
44
46
 
45
47
  if plugin_value == "mlx":
46
48
  from nexaai.asr_impl.mlx_asr_impl import MLXASRImpl
47
- return MLXASRImpl._load_from(model_path, tokenizer_path, language, plugin_id, device_id)
49
+ return MLXASRImpl._load_from(model_path, model_name, tokenizer_path, language, m_cfg, plugin_id, device_id)
48
50
  else:
49
51
  from nexaai.asr_impl.pybind_asr_impl import PyBindASRImpl
50
- return PyBindASRImpl._load_from(model_path, tokenizer_path, language, plugin_id, device_id)
52
+ return PyBindASRImpl._load_from(model_path, model_name, tokenizer_path, language, m_cfg, plugin_id, device_id)
53
+
51
54
 
52
55
  @abstractmethod
53
56
  def transcribe(
@@ -1,32 +1,78 @@
1
1
  from typing import List, Optional, Union
2
2
 
3
- from nexaai.common import PluginID
3
+ from nexaai.common import PluginID, ModelConfig
4
4
  from nexaai.asr import ASR, ASRConfig, ASRResult
5
+ from nexaai.binds import asr_bind, common_bind
6
+ from nexaai.runtime import _ensure_runtime
5
7
 
6
8
 
7
9
  class PyBindASRImpl(ASR):
8
- def __init__(self):
9
- """Initialize PyBind ASR implementation."""
10
- super().__init__()
11
- # TODO: Add PyBind-specific initialization
10
+ def __init__(self, handle: any, m_cfg: ModelConfig = ModelConfig()):
11
+ """Private constructor, should not be called directly."""
12
+ super().__init__(m_cfg)
13
+ self._handle = handle # This is a py::capsule
14
+ self._model_config = None
12
15
 
13
16
  @classmethod
14
17
  def _load_from(cls,
15
18
  model_path: str,
19
+ model_name: Optional[str] = None,
16
20
  tokenizer_path: Optional[str] = None,
17
21
  language: Optional[str] = None,
22
+ m_cfg: ModelConfig = ModelConfig(),
18
23
  plugin_id: Union[PluginID, str] = PluginID.LLAMA_CPP,
19
24
  device_id: Optional[str] = None
20
25
  ) -> 'PyBindASRImpl':
21
26
  """Load ASR model from local path using PyBind backend."""
22
- # TODO: Implement PyBind ASR loading
23
- instance = cls()
24
- return instance
27
+ _ensure_runtime()
28
+
29
+ # Create model config
30
+ config = common_bind.ModelConfig()
31
+
32
+ config.n_ctx = m_cfg.n_ctx
33
+ if m_cfg.n_threads is not None:
34
+ config.n_threads = m_cfg.n_threads
35
+ if m_cfg.n_threads_batch is not None:
36
+ config.n_threads_batch = m_cfg.n_threads_batch
37
+ if m_cfg.n_batch is not None:
38
+ config.n_batch = m_cfg.n_batch
39
+ if m_cfg.n_ubatch is not None:
40
+ config.n_ubatch = m_cfg.n_ubatch
41
+ if m_cfg.n_seq_max is not None:
42
+ config.n_seq_max = m_cfg.n_seq_max
43
+ config.n_gpu_layers = m_cfg.n_gpu_layers
44
+
45
+ # handle chat template strings
46
+ if m_cfg.chat_template_path:
47
+ config.chat_template_path = m_cfg.chat_template_path
48
+
49
+ if m_cfg.chat_template_content:
50
+ config.chat_template_content = m_cfg.chat_template_content
51
+
52
+ # Convert plugin_id to string
53
+ plugin_id_str = plugin_id.value if isinstance(plugin_id, PluginID) else str(plugin_id)
54
+
55
+ # Create ASR handle using the binding
56
+ handle = asr_bind.ml_asr_create(
57
+ model_path=model_path,
58
+ model_name=model_name,
59
+ tokenizer_path=tokenizer_path,
60
+ model_config=config,
61
+ language=language,
62
+ plugin_id=plugin_id_str,
63
+ device_id=device_id,
64
+ license_id=None, # Optional
65
+ license_key=None # Optional
66
+ )
67
+
68
+ return cls(handle, m_cfg)
25
69
 
26
70
  def eject(self):
27
- """Destroy the model and free resources."""
28
- # TODO: Implement PyBind ASR cleanup
29
- pass
71
+ """Release the model from memory."""
72
+ # py::capsule handles cleanup automatically
73
+ if hasattr(self, '_handle') and self._handle is not None:
74
+ del self._handle
75
+ self._handle = None
30
76
 
31
77
  def transcribe(
32
78
  self,
@@ -35,10 +81,47 @@ class PyBindASRImpl(ASR):
35
81
  config: Optional[ASRConfig] = None,
36
82
  ) -> ASRResult:
37
83
  """Transcribe audio file to text."""
38
- # TODO: Implement PyBind ASR transcription
39
- raise NotImplementedError("PyBind ASR transcription not yet implemented")
84
+ if self._handle is None:
85
+ raise RuntimeError("ASR model not loaded. Call _load_from first.")
86
+
87
+ # Convert ASRConfig to binding format if provided
88
+ asr_config = None
89
+ if config:
90
+ asr_config = asr_bind.ASRConfig()
91
+ asr_config.timestamps = config.timestamps
92
+ asr_config.beam_size = config.beam_size
93
+ asr_config.stream = config.stream
94
+
95
+ # Perform transcription using the binding
96
+ result_dict = asr_bind.ml_asr_transcribe(
97
+ handle=self._handle,
98
+ audio_path=audio_path,
99
+ language=language,
100
+ config=asr_config
101
+ )
102
+
103
+ # Convert result to ASRResult
104
+ transcript = result_dict.get("transcript", "")
105
+ confidence_scores = result_dict.get("confidence_scores")
106
+ timestamps = result_dict.get("timestamps")
107
+
108
+ # Convert timestamps to the expected format
109
+ timestamp_pairs = []
110
+ if timestamps:
111
+ for start, end in timestamps:
112
+ timestamp_pairs.append((float(start), float(end)))
113
+
114
+ return ASRResult(
115
+ transcript=transcript,
116
+ confidence_scores=confidence_scores or [],
117
+ timestamps=timestamp_pairs
118
+ )
40
119
 
41
120
  def list_supported_languages(self) -> List[str]:
42
121
  """List supported languages."""
43
- # TODO: Implement PyBind ASR language listing
44
- raise NotImplementedError("PyBind ASR language listing not yet implemented")
122
+ if self._handle is None:
123
+ raise RuntimeError("ASR model not loaded. Call _load_from first.")
124
+
125
+ # Get supported languages using the binding
126
+ languages = asr_bind.ml_asr_list_supported_languages(handle=self._handle)
127
+ return languages
nexaai/binds/__init__.py CHANGED
@@ -3,3 +3,4 @@ from .llm_bind import *
3
3
  from .embedder_bind import *
4
4
  from .vlm_bind import *
5
5
  from .rerank_bind import *
6
+ from .asr_bind import *
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nexaai
3
- Version: 1.0.21rc11
3
+ Version: 1.0.21rc12
4
4
  Summary: Python bindings for NexaSDK C-lib backend
5
5
  Author-email: "Nexa AI, Inc." <dev@nexa.ai>
6
6
  Project-URL: Homepage, https://github.com/NexaAI/nexasdk-bridge
@@ -1,7 +1,7 @@
1
1
  nexaai/__init__.py,sha256=Yt2YPVcRfwdA6DQoUR4ZI34CHBUYoY2cVsrG7Zp6IrI,2516
2
- nexaai/_stub.cp310-win_amd64.pyd,sha256=zYnHVcZRM3z1y3douQmEhWPskoy22QHQbu91CooUWII,10752
3
- nexaai/_version.py,sha256=BEUUhjlv6AJ5LT0jDEF4DBrSaAabJdkGe41TOx3IiqA,148
4
- nexaai/asr.py,sha256=eeFMFKsaEKiJ2PCGmgedRR4fTfrhaDcnZBuhCChMAio,2148
2
+ nexaai/_stub.cp310-win_amd64.pyd,sha256=UeLgiRBaKGJM0d4yrTux6FbDFrUvfq8y7NiNUGPLo_U,10752
3
+ nexaai/_version.py,sha256=bqNPJMf1z8jxbrr3Um66aksBDh9rjl-aoXigmhCOgog,148
4
+ nexaai/asr.py,sha256=p_bTRqESa-4g6V3HGFzi8vqn8H4Q6yTLiLjL0yqVr3I,2362
5
5
  nexaai/base.py,sha256=qQBCiQVNzgpkQjZX9aiFDEdbAAe56TROKC3WnWra2Zg,1021
6
6
  nexaai/common.py,sha256=XRwjvRNxS2xRVb0CMR5NbPQ4E-PAewJ0m6VGbZOw19A,3565
7
7
  nexaai/cv.py,sha256=PhgqK5hO8FlXLR6QxE_pHtXjdtzLSEPzkCda-qrNpOs,3395
@@ -16,32 +16,33 @@ nexaai/tts.py,sha256=5lEzv50Q5iLTNHLg3kX-4J_mi1T_t-rVdZzOwd6sALY,2271
16
16
  nexaai/vlm.py,sha256=uglZ5g0VFizwIYOYjXg-LNrr5baFanTRlAppEkkF-Yw,4929
17
17
  nexaai/asr_impl/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
18
18
  nexaai/asr_impl/mlx_asr_impl.py,sha256=XwMX3LYMeulp8cDS0TCCYcjvttFHAyDWQ_oMvABwQmI,3349
19
- nexaai/asr_impl/pybind_asr_impl.py,sha256=20o5SOPzhF9x41ra8L_qIM7YxCkYeLb5csSrNde-dds,1560
20
- nexaai/binds/__init__.py,sha256=GA7iQMqrGSH1U4DSGzrjwt0rqw25F_9nSjNNhw0FSto,136
21
- nexaai/binds/common_bind.cp310-win_amd64.pyd,sha256=DysYAE5xLyUHK4CldEbOda5OubohPC67aYjuB5U-ssk,205824
22
- nexaai/binds/embedder_bind.cp310-win_amd64.pyd,sha256=_dI1ZWBxQ2n28FNdQ0ouCKKju8edbyEd2H9rVs9JrFc,183808
19
+ nexaai/asr_impl/pybind_asr_impl.py,sha256=I-J_pp4Tdafa-ipp34q2dN4dbL905nlpBYVBGLQwLVI,4807
20
+ nexaai/binds/__init__.py,sha256=cDlzRJF5pq0YmiwmUvdNO9CrvYrBdkYWR4xXrEbwLyU,161
21
+ nexaai/binds/asr_bind.cp310-win_amd64.pyd,sha256=EI5IlfnS6t8o-EASZh8ibD4vZXQy4EHieAmDh56C8-A,192000
22
+ nexaai/binds/common_bind.cp310-win_amd64.pyd,sha256=iMvrdOCoatEyYGCq68-fESc8rymVG9SXOuWZcSmzqnI,205824
23
+ nexaai/binds/embedder_bind.cp310-win_amd64.pyd,sha256=ktHF49Qip1bW4wZIWTW_tE_FpNNPrl2o6U2pkKpQ3W0,183808
23
24
  nexaai/binds/libcrypto-3-x64.dll,sha256=X7hDuQPMn6eRe58dTGJxTmRPKFWgd5i6Gjoy9QPLmPg,7315968
24
25
  nexaai/binds/libssl-3-x64.dll,sha256=GRw0cOaGUaR2QHRvBFuU_9S9iNgkyVgm0NIpZMnReAw,1313792
25
- nexaai/binds/llm_bind.cp310-win_amd64.pyd,sha256=3Lzi-W-Ym7UNMEr5jccvnFRU4noMoe2KyiZCILyv8rM,163840
26
- nexaai/binds/nexa_bridge.dll,sha256=e6AC6AU-NYKB73dWPfBeAFF9jF3cJfp5vJbE4zCjjJE,187904
27
- nexaai/binds/rerank_bind.cp310-win_amd64.pyd,sha256=1dinTXZQyUJ47ZEecS525T1N1IkAxVjhCHzPGcUYuJs,178176
28
- nexaai/binds/vlm_bind.cp310-win_amd64.pyd,sha256=2Tx87o4wNuIIZgxjm0jAwSniTuYkbRMBsQjeGaoSpbY,171520
29
- nexaai/binds/cpu_gpu/ggml-base.dll,sha256=z6-9_e6RL_E1hjgZwkMl3ludgQwqmL792iR5dvDAow8,532480
30
- nexaai/binds/cpu_gpu/ggml-cpu.dll,sha256=F1A_3KoEGgcZA_-vFiVjYFrB8MetMWqlkGaVEgB0xOc,672768
31
- nexaai/binds/cpu_gpu/ggml-cuda.dll,sha256=H_ajYEmGvW52GfmOCTDdJgaZVaAoixdysHQARqLXMpA,313528832
32
- nexaai/binds/cpu_gpu/ggml-vulkan.dll,sha256=w5URKVi4vv9POUvqmnuszvbYISQQPkISs2JInEDMHkQ,36627968
33
- nexaai/binds/cpu_gpu/ggml.dll,sha256=igSbybRUPftPVXV5qr5kPRT8OhUB5U5FDkuSz-3j9KQ,66560
34
- nexaai/binds/cpu_gpu/mtmd.dll,sha256=c8FxzwoR73mweoGLMpmORjlVPNiCtbb7Iyy0tSyDHnA,561152
35
- nexaai/binds/cpu_gpu/nexa_cpu_gpu.dll,sha256=Okp03moKh3DH_7JKokqyy3YilyafVr3nkGFkCux7at4,1611776
36
- nexaai/binds/cpu_gpu/nexa_plugin.dll,sha256=XiAqUyWLnVxntV1fzSW4uN1CuxqugeWo4A3EBD6GYNA,1424384
37
- nexaai/binds/nexaml/ggml-base.dll,sha256=z6-9_e6RL_E1hjgZwkMl3ludgQwqmL792iR5dvDAow8,532480
38
- nexaai/binds/nexaml/ggml-cpu.dll,sha256=F1A_3KoEGgcZA_-vFiVjYFrB8MetMWqlkGaVEgB0xOc,672768
39
- nexaai/binds/nexaml/ggml-cuda.dll,sha256=H_ajYEmGvW52GfmOCTDdJgaZVaAoixdysHQARqLXMpA,313528832
40
- nexaai/binds/nexaml/ggml-vulkan.dll,sha256=w5URKVi4vv9POUvqmnuszvbYISQQPkISs2JInEDMHkQ,36627968
41
- nexaai/binds/nexaml/ggml.dll,sha256=igSbybRUPftPVXV5qr5kPRT8OhUB5U5FDkuSz-3j9KQ,66560
26
+ nexaai/binds/llm_bind.cp310-win_amd64.pyd,sha256=ig_LI15MUpQiSlEmz0AH8fVD9YxIaqtHxJC_5fEV9Vc,163840
27
+ nexaai/binds/nexa_bridge.dll,sha256=2V-T2fLpn8AHJVPkTR425vGVNungIcHpALcoM5a8ifM,187904
28
+ nexaai/binds/rerank_bind.cp310-win_amd64.pyd,sha256=tKPZpVnBJaTsVhXPJryFj41HceWKANlc-mZbHxbvUYQ,178176
29
+ nexaai/binds/vlm_bind.cp310-win_amd64.pyd,sha256=Ah_XGenpplNq_etP0zykp0BIYheISeMAz9sMBrBbNRw,171520
30
+ nexaai/binds/cpu_gpu/ggml-base.dll,sha256=dtjalnYgxV2ymW2gSvz-N2nL9BU3MwlfhJkGSkmfT1U,532480
31
+ nexaai/binds/cpu_gpu/ggml-cpu.dll,sha256=D48mfGUk64IXSvupY0VM_uvSWtEh6T_B-DjItKo7d_c,672768
32
+ nexaai/binds/cpu_gpu/ggml-cuda.dll,sha256=O-l3euXLbdEf43ArdsGkvnUH7J3r1rNwb_0laNL-q_I,313528832
33
+ nexaai/binds/cpu_gpu/ggml-vulkan.dll,sha256=m1xIMYRWLsgQjCDe2emp7KD23K8k5vgFo2cTyBXJdGo,36627968
34
+ nexaai/binds/cpu_gpu/ggml.dll,sha256=aD0G8mXEpawsIq2YiV1QwuNQD2LRhfWzt074x5DY9Yg,66560
35
+ nexaai/binds/cpu_gpu/mtmd.dll,sha256=WSlY1hG8PWeE5qOwXqEKmvnEzc3Zwi3cZRKjwCTiWLY,561152
36
+ nexaai/binds/cpu_gpu/nexa_cpu_gpu.dll,sha256=vXr2Fqe1hnD60j0Q3i0aNXvXMFEhzMTGXGoQbS0xtis,1611776
37
+ nexaai/binds/cpu_gpu/nexa_plugin.dll,sha256=zooi3Iw1fRv4_QhbrYq1U9LOFDYTTqXQZOuVb9K0GJM,1424384
38
+ nexaai/binds/nexaml/ggml-base.dll,sha256=dtjalnYgxV2ymW2gSvz-N2nL9BU3MwlfhJkGSkmfT1U,532480
39
+ nexaai/binds/nexaml/ggml-cpu.dll,sha256=D48mfGUk64IXSvupY0VM_uvSWtEh6T_B-DjItKo7d_c,672768
40
+ nexaai/binds/nexaml/ggml-cuda.dll,sha256=O-l3euXLbdEf43ArdsGkvnUH7J3r1rNwb_0laNL-q_I,313528832
41
+ nexaai/binds/nexaml/ggml-vulkan.dll,sha256=m1xIMYRWLsgQjCDe2emp7KD23K8k5vgFo2cTyBXJdGo,36627968
42
+ nexaai/binds/nexaml/ggml.dll,sha256=aD0G8mXEpawsIq2YiV1QwuNQD2LRhfWzt074x5DY9Yg,66560
42
43
  nexaai/binds/nexaml/nexa-mm-process.dll,sha256=DDD5qPbelZAIrRWGggOd3Pg9U_fh_ZEYIplwqiyD5LY,4643328
43
44
  nexaai/binds/nexaml/nexa-sampling.dll,sha256=Notkz287laSUG2_ED3oFXWVLJM3t7x_USkvX6wKVOLA,4265984
44
- nexaai/binds/nexaml/nexa_plugin.dll,sha256=X4uuyL2RXsack-5hCMR7LB7SYHkgrVNAPTEmRpDIeEA,604160
45
+ nexaai/binds/nexaml/nexa_plugin.dll,sha256=5j922WSBy150W9OQndDLkVXgChM3EL1vFMqA16iRHKY,604160
45
46
  nexaai/binds/nexaml/nexaproc.dll,sha256=rRcdSfhkxnRwktXW4lp7Np8sNY_uefNXYwAmPp34AHg,2670080
46
47
  nexaai/binds/nexaml/qwen3-vl.dll,sha256=k0wPZNR6VejeR32KuFgCVyj7t7YaEmZOKhj9lwMw0-s,5874176
47
48
  nexaai/binds/nexaml/qwen3vl-vision.dll,sha256=5AX4MtAOWTcXSAkS2qqvl2pFti4HR55dtkCaOO03Evc,1063424
@@ -72,7 +73,7 @@ nexaai/utils/quantization_utils.py,sha256=FxnZ6-uAE_bl_vQ5jsRXlpU0NBn-U4Y8iN9_O6
72
73
  nexaai/vlm_impl/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
73
74
  nexaai/vlm_impl/mlx_vlm_impl.py,sha256=gI09QJcok68QG-36csXr3c2yPCZXTE0dlq1MUBEo_Ms,11091
74
75
  nexaai/vlm_impl/pybind_vlm_impl.py,sha256=w8gAZNW2lk3mCKolg4iKgD58RhHCEk4v9aYI1RwVGqc,10021
75
- nexaai-1.0.21rc11.dist-info/METADATA,sha256=T_LhH1n3qS9DnCW8fwK9jXt5fxVC6WbLjrYByMtwNas,1219
76
- nexaai-1.0.21rc11.dist-info/WHEEL,sha256=KUuBC6lxAbHCKilKua8R9W_TM71_-9Sg5uEP3uDWcoU,101
77
- nexaai-1.0.21rc11.dist-info/top_level.txt,sha256=LRE2YERlrZk2vfuygnSzsEeqSknnZbz3Z1MHyNmBU4w,7
78
- nexaai-1.0.21rc11.dist-info/RECORD,,
76
+ nexaai-1.0.21rc12.dist-info/METADATA,sha256=BdNbXFtWgLQJ9VXQUafcGFUo3u12l1NHiTCNhdIivFU,1219
77
+ nexaai-1.0.21rc12.dist-info/WHEEL,sha256=KUuBC6lxAbHCKilKua8R9W_TM71_-9Sg5uEP3uDWcoU,101
78
+ nexaai-1.0.21rc12.dist-info/top_level.txt,sha256=LRE2YERlrZk2vfuygnSzsEeqSknnZbz3Z1MHyNmBU4w,7
79
+ nexaai-1.0.21rc12.dist-info/RECORD,,