Nexa SDK is a comprehensive toolkit for supporting GGML and ONNX models. It supports text generation, image generation, vision-language models (VLM), Audio Language Model, auto-speech-recognition (ASR), and text-to-speech (TTS) capabilities.
When trying to import and use components (NexaTTSInference and NexaVoiceInference) following the official documentation examples, the code fails with a circular import error. The error suggests there's a circular dependency between nexa.general, nexa.constants, and nexa.gguf modules.
Expected behavior:
The code from the documentation should work without any import errors for both TTS and Voice Recognition:
# TTS Example
from nexa.onnx import NexaTTSInference
model_path = "ljspeech"
inference = NexaTTSInference(
model_path=model_path,
local_path=None
)
# Voice Recognition Example
from nexa.onnx import NexaVoiceInference
model_path = "whisper-tiny"
inference = NexaVoiceInference(
model_path=model_path,
local_path=None
)
Actual behavior:
Both imports fail with the same error:
ImportError: cannot import name 'pull_model' from partially initialized module 'nexa.general' (most likely due to a circular import) (/opt/conda/lib/python3.10/site-packages/nexa/general.py)
Full Error Traceback
ImportError Traceback (most recent call last)
Cell In[8], line 1
----> 1 from nexa.onnx import NexaVoiceInference
3 model_path = "whisper-tiny"
4 inference = NexaVoiceInference(
5 model_path=model_path,
6 local_path=None
7 )
File /opt/conda/lib/python3.10/site-packages/nexa/onnx/__init__.py:1
----> 1 from .nexa_inference_image import NexaImageInference
2 from .nexa_inference_text import NexaTextInference
3 from .nexa_inference_tts import NexaTTSInference
[... rest of the traceback as provided in the error message ...]
ImportError: cannot import name 'pull_model' from partially initialized module 'nexa.general' (most likely due to a circular import) (/opt/conda/lib/python3.10/site-packages/nexa/general.py)
Additional Notes
The code exactly follows the documentation examples
The error appears to be caused by circular imports in the library's internal structure:
nexa.onnx tries to import pull_model from nexa.general
nexa.general imports from nexa.constants
nexa.constants imports from nexa.gguf
nexa.gguf tries to import pull_model from nexa.general again
The same error occurs for both TTS and Voice Recognition components, suggesting a fundamental issue in the library's import structure
3. The error occurs immediately on import for both components.
### OS
Kaggle Notebook Environment
### Python Version
3.10
### Nexa SDK Version
Latest from the provided index URL
### GPU (if using one)
NVIDIA (CUDA 12.4 compatible)
Issue Description
When trying to import and use components (
NexaTTSInference
andNexaVoiceInference
) following the official documentation examples, the code fails with a circular import error. The error suggests there's a circular dependency betweennexa.general
,nexa.constants
, andnexa.gguf
modules.Expected behavior: The code from the documentation should work without any import errors for both TTS and Voice Recognition:
Actual behavior: Both imports fail with the same error:
Full Error Traceback
Additional Notes
Steps to Reproduce
Install the required packages:
Try either of these examples:
Example 2: Voice Recognition
from nexa.onnx import NexaVoiceInference model_path = "whisper-tiny" inference = NexaVoiceInference( model_path=model_path, local_path=None )