nexaai 1.0.21rc5__cp313-cp313-win_arm64.whl → 1.0.21rc14__cp313-cp313-win_arm64.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.
- nexaai/__init__.py +95 -95
- nexaai/_stub.cp313-win_arm64.pyd +0 -0
- nexaai/_version.py +4 -1
- nexaai/asr.py +68 -65
- nexaai/asr_impl/mlx_asr_impl.py +92 -92
- nexaai/asr_impl/pybind_asr_impl.py +127 -44
- nexaai/base.py +39 -39
- nexaai/binds/__init__.py +6 -5
- nexaai/binds/asr_bind.cp313-win_arm64.pyd +0 -0
- nexaai/binds/common_bind.cp313-win_arm64.pyd +0 -0
- nexaai/binds/cpu_gpu/ggml-base.dll +0 -0
- nexaai/binds/cpu_gpu/ggml-cpu.dll +0 -0
- nexaai/binds/cpu_gpu/ggml-opencl.dll +0 -0
- nexaai/binds/cpu_gpu/ggml.dll +0 -0
- nexaai/binds/cpu_gpu/mtmd.dll +0 -0
- nexaai/binds/cpu_gpu/nexa_cpu_gpu.dll +0 -0
- nexaai/binds/cpu_gpu/nexa_plugin.dll +0 -0
- nexaai/binds/embedder_bind.cp313-win_arm64.pyd +0 -0
- nexaai/binds/libcrypto-3-arm64.dll +0 -0
- nexaai/binds/libssl-3-arm64.dll +0 -0
- nexaai/binds/llm_bind.cp313-win_arm64.pyd +0 -0
- nexaai/binds/nexa_bridge.dll +0 -0
- nexaai/binds/npu/convnext-sdk.dll +0 -0
- nexaai/binds/npu/embed-gemma-sdk.dll +0 -0
- nexaai/binds/npu/ggml-base.dll +0 -0
- nexaai/binds/npu/ggml-cpu.dll +0 -0
- nexaai/binds/npu/ggml-opencl.dll +0 -0
- nexaai/binds/npu/ggml.dll +0 -0
- nexaai/binds/npu/granite-nano-sdk.dll +0 -0
- nexaai/binds/npu/granite4-sdk.dll +0 -0
- nexaai/binds/npu/jina-rerank-sdk.dll +0 -0
- nexaai/binds/npu/liquid-sdk.dll +0 -0
- nexaai/binds/npu/llama3-3b-sdk.dll +0 -0
- nexaai/binds/npu/nexa-mm-process.dll +0 -0
- nexaai/binds/npu/nexa-sampling.dll +0 -0
- nexaai/binds/npu/nexa_plugin.dll +0 -0
- nexaai/binds/npu/omni-neural-sdk.dll +0 -0
- nexaai/binds/npu/openblas.dll +0 -0
- nexaai/binds/npu/paddleocr-sdk.dll +0 -0
- nexaai/binds/npu/parakeet-sdk.dll +0 -0
- nexaai/binds/npu/phi3-5-sdk.dll +0 -0
- nexaai/binds/npu/phi4-sdk.dll +0 -0
- nexaai/binds/npu/pyannote-sdk.dll +0 -0
- nexaai/binds/npu/qwen3-4b-sdk.dll +0 -0
- nexaai/binds/npu/qwen3vl-sdk.dll +0 -0
- nexaai/binds/npu/qwen3vl-vision.dll +0 -0
- nexaai/binds/npu/yolov12-sdk.dll +0 -0
- nexaai/binds/npu/zlib1.dll +0 -0
- nexaai/binds/rerank_bind.cp313-win_arm64.pyd +0 -0
- nexaai/binds/vlm_bind.cp313-win_arm64.pyd +0 -0
- nexaai/common.py +105 -105
- nexaai/cv.py +93 -93
- nexaai/cv_impl/mlx_cv_impl.py +89 -89
- nexaai/cv_impl/pybind_cv_impl.py +32 -32
- nexaai/embedder.py +73 -73
- nexaai/embedder_impl/mlx_embedder_impl.py +118 -118
- nexaai/embedder_impl/pybind_embedder_impl.py +96 -96
- nexaai/image_gen.py +141 -141
- nexaai/image_gen_impl/mlx_image_gen_impl.py +292 -292
- nexaai/image_gen_impl/pybind_image_gen_impl.py +85 -85
- nexaai/llm.py +98 -98
- nexaai/llm_impl/mlx_llm_impl.py +271 -271
- nexaai/llm_impl/pybind_llm_impl.py +220 -220
- nexaai/log.py +92 -92
- nexaai/rerank.py +57 -57
- nexaai/rerank_impl/mlx_rerank_impl.py +94 -94
- nexaai/rerank_impl/pybind_rerank_impl.py +136 -136
- nexaai/runtime.py +68 -68
- nexaai/runtime_error.py +24 -24
- nexaai/tts.py +75 -75
- nexaai/tts_impl/mlx_tts_impl.py +94 -94
- nexaai/tts_impl/pybind_tts_impl.py +43 -43
- nexaai/utils/decode.py +17 -17
- nexaai/utils/manifest_utils.py +531 -531
- nexaai/utils/model_manager.py +1562 -1562
- nexaai/utils/model_types.py +49 -49
- nexaai/utils/progress_tracker.py +384 -384
- nexaai/utils/quantization_utils.py +245 -245
- nexaai/vlm.py +129 -129
- nexaai/vlm_impl/mlx_vlm_impl.py +258 -258
- nexaai/vlm_impl/pybind_vlm_impl.py +256 -256
- {nexaai-1.0.21rc5.dist-info → nexaai-1.0.21rc14.dist-info}/METADATA +1 -1
- nexaai-1.0.21rc14.dist-info/RECORD +154 -0
- nexaai/binds/nexaml/FLAC.dll +0 -0
- nexaai/binds/nexaml/fftw3.dll +0 -0
- nexaai/binds/nexaml/fftw3f.dll +0 -0
- nexaai/binds/nexaml/ggml-base.dll +0 -0
- nexaai/binds/nexaml/ggml-cpu.dll +0 -0
- nexaai/binds/nexaml/ggml-opencl.dll +0 -0
- nexaai/binds/nexaml/ggml.dll +0 -0
- nexaai/binds/nexaml/libmp3lame.DLL +0 -0
- nexaai/binds/nexaml/mpg123.dll +0 -0
- nexaai/binds/nexaml/nexa-mm-process.dll +0 -0
- nexaai/binds/nexaml/nexa-sampling.dll +0 -0
- nexaai/binds/nexaml/nexa_plugin.dll +0 -0
- nexaai/binds/nexaml/nexaproc.dll +0 -0
- nexaai/binds/nexaml/ogg.dll +0 -0
- nexaai/binds/nexaml/opus.dll +0 -0
- nexaai/binds/nexaml/qwen3-vl.dll +0 -0
- nexaai/binds/nexaml/qwen3vl-vision.dll +0 -0
- nexaai/binds/nexaml/vorbis.dll +0 -0
- nexaai/binds/nexaml/vorbisenc.dll +0 -0
- nexaai-1.0.21rc5.dist-info/RECORD +0 -162
- {nexaai-1.0.21rc5.dist-info → nexaai-1.0.21rc14.dist-info}/WHEEL +0 -0
- {nexaai-1.0.21rc5.dist-info → nexaai-1.0.21rc14.dist-info}/top_level.txt +0 -0
nexaai/image_gen.py
CHANGED
|
@@ -1,141 +1,141 @@
|
|
|
1
|
-
from typing import List, Optional, Union
|
|
2
|
-
from abc import abstractmethod
|
|
3
|
-
from dataclasses import dataclass
|
|
4
|
-
|
|
5
|
-
from nexaai.base import BaseModel
|
|
6
|
-
from nexaai.common import PluginID
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
@dataclass
|
|
10
|
-
class Image:
|
|
11
|
-
"""Image data structure."""
|
|
12
|
-
data: List[float] # width × height × channels
|
|
13
|
-
width: int
|
|
14
|
-
height: int
|
|
15
|
-
channels: int # 3 = RGB, 4 = RGBA
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
@dataclass
|
|
19
|
-
class ImageSamplerConfig:
|
|
20
|
-
"""Configuration for image sampling."""
|
|
21
|
-
method: str = "ddim"
|
|
22
|
-
steps: int = 20
|
|
23
|
-
guidance_scale: float = 7.5
|
|
24
|
-
eta: float = 0.0
|
|
25
|
-
seed: int = -1 # –1 for random
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
@dataclass
|
|
29
|
-
class ImageGenerationConfig:
|
|
30
|
-
"""Configuration for image generation."""
|
|
31
|
-
prompts: Union[str, List[str]]
|
|
32
|
-
negative_prompts: Optional[Union[str, List[str]]] = None
|
|
33
|
-
height: int = 512
|
|
34
|
-
width: int = 512
|
|
35
|
-
sampler_config: Optional[ImageSamplerConfig] = None
|
|
36
|
-
lora_id: int = -1 # –1 for none
|
|
37
|
-
init_image: Optional[Image] = None
|
|
38
|
-
strength: float = 1.0
|
|
39
|
-
n_images: int = 1
|
|
40
|
-
n_rows: int = 1
|
|
41
|
-
decoding_batch_size: int = 1
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
@dataclass
|
|
45
|
-
class SchedulerConfig:
|
|
46
|
-
"""Configuration for diffusion scheduler."""
|
|
47
|
-
type: str = "ddim"
|
|
48
|
-
num_train_timesteps: int = 1000
|
|
49
|
-
steps_offset: int = 0 # An offset added to the inference steps
|
|
50
|
-
beta_start: float = 0.00085
|
|
51
|
-
beta_end: float = 0.012
|
|
52
|
-
beta_schedule: str = "scaled_linear"
|
|
53
|
-
prediction_type: str = "epsilon"
|
|
54
|
-
timestep_type: str = "discrete"
|
|
55
|
-
timestep_spacing: str = "linspace"
|
|
56
|
-
interpolation_type: str = "linear"
|
|
57
|
-
config_path: Optional[str] = None
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
class ImageGen(BaseModel):
|
|
61
|
-
"""Abstract base class for image generation models."""
|
|
62
|
-
|
|
63
|
-
def __init__(self):
|
|
64
|
-
"""Initialize base image generation class."""
|
|
65
|
-
pass
|
|
66
|
-
|
|
67
|
-
@classmethod
|
|
68
|
-
def _load_from(cls,
|
|
69
|
-
model_path: str,
|
|
70
|
-
scheduler_config_path: str = "",
|
|
71
|
-
plugin_id: Union[PluginID, str] = PluginID.LLAMA_CPP,
|
|
72
|
-
device_id: Optional[str] = None,
|
|
73
|
-
float16: bool = True,
|
|
74
|
-
quantize: bool = False,
|
|
75
|
-
**kwargs
|
|
76
|
-
) -> 'ImageGen':
|
|
77
|
-
"""Load image generation model from local path, routing to appropriate implementation."""
|
|
78
|
-
# Check plugin_id value for routing - handle both enum and string
|
|
79
|
-
plugin_value = plugin_id.value if isinstance(plugin_id, PluginID) else plugin_id
|
|
80
|
-
|
|
81
|
-
if plugin_value == "mlx":
|
|
82
|
-
from nexaai.image_gen_impl.mlx_image_gen_impl import MLXImageGenImpl
|
|
83
|
-
return MLXImageGenImpl._load_from(model_path, scheduler_config_path, plugin_id, device_id, float16, quantize)
|
|
84
|
-
else:
|
|
85
|
-
from nexaai.image_gen_impl.pybind_image_gen_impl import PyBindImageGenImpl
|
|
86
|
-
return PyBindImageGenImpl._load_from(model_path, scheduler_config_path, plugin_id, device_id, float16, quantize)
|
|
87
|
-
|
|
88
|
-
@abstractmethod
|
|
89
|
-
def load_model(self, model_path: str, extra_data: Optional[str] = None) -> bool:
|
|
90
|
-
"""Load model from path."""
|
|
91
|
-
pass
|
|
92
|
-
|
|
93
|
-
@abstractmethod
|
|
94
|
-
def set_scheduler(self, config: SchedulerConfig) -> None:
|
|
95
|
-
"""Set scheduler configuration."""
|
|
96
|
-
pass
|
|
97
|
-
|
|
98
|
-
@abstractmethod
|
|
99
|
-
def set_sampler(self, config: ImageSamplerConfig) -> None:
|
|
100
|
-
"""Set sampler configuration."""
|
|
101
|
-
pass
|
|
102
|
-
|
|
103
|
-
@abstractmethod
|
|
104
|
-
def reset_sampler(self) -> None:
|
|
105
|
-
"""Reset sampler to default configuration."""
|
|
106
|
-
pass
|
|
107
|
-
|
|
108
|
-
@abstractmethod
|
|
109
|
-
def txt2img(self, prompt: str, config: ImageGenerationConfig) -> Image:
|
|
110
|
-
"""Generate image from text prompt."""
|
|
111
|
-
pass
|
|
112
|
-
|
|
113
|
-
@abstractmethod
|
|
114
|
-
def img2img(self, init_image: Image, prompt: str, config: ImageGenerationConfig) -> Image:
|
|
115
|
-
"""Generate image from initial image and text prompt."""
|
|
116
|
-
pass
|
|
117
|
-
|
|
118
|
-
@abstractmethod
|
|
119
|
-
def generate(self, config: ImageGenerationConfig) -> Image:
|
|
120
|
-
"""Generate image from configuration."""
|
|
121
|
-
pass
|
|
122
|
-
|
|
123
|
-
@abstractmethod
|
|
124
|
-
def set_lora(self, lora_id: int) -> None:
|
|
125
|
-
"""Set active LoRA adapter."""
|
|
126
|
-
pass
|
|
127
|
-
|
|
128
|
-
@abstractmethod
|
|
129
|
-
def add_lora(self, lora_path: str) -> int:
|
|
130
|
-
"""Add LoRA adapter and return its ID."""
|
|
131
|
-
pass
|
|
132
|
-
|
|
133
|
-
@abstractmethod
|
|
134
|
-
def remove_lora(self, lora_id: int) -> None:
|
|
135
|
-
"""Remove LoRA adapter."""
|
|
136
|
-
pass
|
|
137
|
-
|
|
138
|
-
@abstractmethod
|
|
139
|
-
def list_loras(self) -> List[int]:
|
|
140
|
-
"""List available LoRA adapters."""
|
|
141
|
-
pass
|
|
1
|
+
from typing import List, Optional, Union
|
|
2
|
+
from abc import abstractmethod
|
|
3
|
+
from dataclasses import dataclass
|
|
4
|
+
|
|
5
|
+
from nexaai.base import BaseModel
|
|
6
|
+
from nexaai.common import PluginID
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
@dataclass
|
|
10
|
+
class Image:
|
|
11
|
+
"""Image data structure."""
|
|
12
|
+
data: List[float] # width × height × channels
|
|
13
|
+
width: int
|
|
14
|
+
height: int
|
|
15
|
+
channels: int # 3 = RGB, 4 = RGBA
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
@dataclass
|
|
19
|
+
class ImageSamplerConfig:
|
|
20
|
+
"""Configuration for image sampling."""
|
|
21
|
+
method: str = "ddim"
|
|
22
|
+
steps: int = 20
|
|
23
|
+
guidance_scale: float = 7.5
|
|
24
|
+
eta: float = 0.0
|
|
25
|
+
seed: int = -1 # –1 for random
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
@dataclass
|
|
29
|
+
class ImageGenerationConfig:
|
|
30
|
+
"""Configuration for image generation."""
|
|
31
|
+
prompts: Union[str, List[str]]
|
|
32
|
+
negative_prompts: Optional[Union[str, List[str]]] = None
|
|
33
|
+
height: int = 512
|
|
34
|
+
width: int = 512
|
|
35
|
+
sampler_config: Optional[ImageSamplerConfig] = None
|
|
36
|
+
lora_id: int = -1 # –1 for none
|
|
37
|
+
init_image: Optional[Image] = None
|
|
38
|
+
strength: float = 1.0
|
|
39
|
+
n_images: int = 1
|
|
40
|
+
n_rows: int = 1
|
|
41
|
+
decoding_batch_size: int = 1
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
@dataclass
|
|
45
|
+
class SchedulerConfig:
|
|
46
|
+
"""Configuration for diffusion scheduler."""
|
|
47
|
+
type: str = "ddim"
|
|
48
|
+
num_train_timesteps: int = 1000
|
|
49
|
+
steps_offset: int = 0 # An offset added to the inference steps
|
|
50
|
+
beta_start: float = 0.00085
|
|
51
|
+
beta_end: float = 0.012
|
|
52
|
+
beta_schedule: str = "scaled_linear"
|
|
53
|
+
prediction_type: str = "epsilon"
|
|
54
|
+
timestep_type: str = "discrete"
|
|
55
|
+
timestep_spacing: str = "linspace"
|
|
56
|
+
interpolation_type: str = "linear"
|
|
57
|
+
config_path: Optional[str] = None
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
class ImageGen(BaseModel):
|
|
61
|
+
"""Abstract base class for image generation models."""
|
|
62
|
+
|
|
63
|
+
def __init__(self):
|
|
64
|
+
"""Initialize base image generation class."""
|
|
65
|
+
pass
|
|
66
|
+
|
|
67
|
+
@classmethod
|
|
68
|
+
def _load_from(cls,
|
|
69
|
+
model_path: str,
|
|
70
|
+
scheduler_config_path: str = "",
|
|
71
|
+
plugin_id: Union[PluginID, str] = PluginID.LLAMA_CPP,
|
|
72
|
+
device_id: Optional[str] = None,
|
|
73
|
+
float16: bool = True,
|
|
74
|
+
quantize: bool = False,
|
|
75
|
+
**kwargs
|
|
76
|
+
) -> 'ImageGen':
|
|
77
|
+
"""Load image generation model from local path, routing to appropriate implementation."""
|
|
78
|
+
# Check plugin_id value for routing - handle both enum and string
|
|
79
|
+
plugin_value = plugin_id.value if isinstance(plugin_id, PluginID) else plugin_id
|
|
80
|
+
|
|
81
|
+
if plugin_value == "mlx":
|
|
82
|
+
from nexaai.image_gen_impl.mlx_image_gen_impl import MLXImageGenImpl
|
|
83
|
+
return MLXImageGenImpl._load_from(model_path, scheduler_config_path, plugin_id, device_id, float16, quantize)
|
|
84
|
+
else:
|
|
85
|
+
from nexaai.image_gen_impl.pybind_image_gen_impl import PyBindImageGenImpl
|
|
86
|
+
return PyBindImageGenImpl._load_from(model_path, scheduler_config_path, plugin_id, device_id, float16, quantize)
|
|
87
|
+
|
|
88
|
+
@abstractmethod
|
|
89
|
+
def load_model(self, model_path: str, extra_data: Optional[str] = None) -> bool:
|
|
90
|
+
"""Load model from path."""
|
|
91
|
+
pass
|
|
92
|
+
|
|
93
|
+
@abstractmethod
|
|
94
|
+
def set_scheduler(self, config: SchedulerConfig) -> None:
|
|
95
|
+
"""Set scheduler configuration."""
|
|
96
|
+
pass
|
|
97
|
+
|
|
98
|
+
@abstractmethod
|
|
99
|
+
def set_sampler(self, config: ImageSamplerConfig) -> None:
|
|
100
|
+
"""Set sampler configuration."""
|
|
101
|
+
pass
|
|
102
|
+
|
|
103
|
+
@abstractmethod
|
|
104
|
+
def reset_sampler(self) -> None:
|
|
105
|
+
"""Reset sampler to default configuration."""
|
|
106
|
+
pass
|
|
107
|
+
|
|
108
|
+
@abstractmethod
|
|
109
|
+
def txt2img(self, prompt: str, config: ImageGenerationConfig) -> Image:
|
|
110
|
+
"""Generate image from text prompt."""
|
|
111
|
+
pass
|
|
112
|
+
|
|
113
|
+
@abstractmethod
|
|
114
|
+
def img2img(self, init_image: Image, prompt: str, config: ImageGenerationConfig) -> Image:
|
|
115
|
+
"""Generate image from initial image and text prompt."""
|
|
116
|
+
pass
|
|
117
|
+
|
|
118
|
+
@abstractmethod
|
|
119
|
+
def generate(self, config: ImageGenerationConfig) -> Image:
|
|
120
|
+
"""Generate image from configuration."""
|
|
121
|
+
pass
|
|
122
|
+
|
|
123
|
+
@abstractmethod
|
|
124
|
+
def set_lora(self, lora_id: int) -> None:
|
|
125
|
+
"""Set active LoRA adapter."""
|
|
126
|
+
pass
|
|
127
|
+
|
|
128
|
+
@abstractmethod
|
|
129
|
+
def add_lora(self, lora_path: str) -> int:
|
|
130
|
+
"""Add LoRA adapter and return its ID."""
|
|
131
|
+
pass
|
|
132
|
+
|
|
133
|
+
@abstractmethod
|
|
134
|
+
def remove_lora(self, lora_id: int) -> None:
|
|
135
|
+
"""Remove LoRA adapter."""
|
|
136
|
+
pass
|
|
137
|
+
|
|
138
|
+
@abstractmethod
|
|
139
|
+
def list_loras(self) -> List[int]:
|
|
140
|
+
"""List available LoRA adapters."""
|
|
141
|
+
pass
|