Environment
- ComfyUI 0.29.2, Python 3.12.10, torch 2.9.1+cu128, Windows
- ComfyUI-RMBG 3.1.0 + TTS-Audio-Suite (latest)
Steps to reproduce
- Start ComfyUI, run any TTS-Audio-Suite voice-changer (RVC) workflow once. This inserts
TTS-Audio-Suite\engines\rvc\impl\lib\infer_pack into sys.path[0] at runtime (see minimal_reference_wrapper.py).
- Run a workflow using any Florence2 node (e.g. CogFlorence-2.2-Large). Model files download/load fine.
Expected: Florence2 inference runs.
Actual: Node fails with:
File "py\AILab_Florence2.py", line 168, in _get_model
from models.modeling_florence2 import Florence2ForConditionalGeneration
File "TTS-Audio-Suite\engines\rvc\impl\lib\infer_pack\models.py", line 5, in <module>
from . import modules
ImportError: attempted relative import with no known parent package
Root cause
AILab_Florence2.py uses a bare top-level import from models.modeling_florence2 import .... Python's PathFinder resolves models by walking sys.path in order; after TTS-Audio-Suite's RVC engine inserts its infer_pack directory at sys.path[0], the plain file infer_pack\models.py shadows this repo's models/ package. That file is then imported as a top-level models module, and its internal from . import modules fails (no parent package). The error is intermittent: it only appears after an RVC workflow has run in the same process.
Suggested fix
Resolve the import without relying on a bare models name, e.g. insert this repo's own models dir at sys.path[0] before importing:
sys.path.insert(0, os.path.normpath(os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", "models")))
from modeling_florence2 import Florence2ForConditionalGeneration
(This is what I applied locally and it works; modeling_florence2.py has no relative imports so it loads fine as a top-level module.)
Additionally, TTS-Audio-Suite should be asked to stop globally polluting the process namespace: pushing a directory containing a generic models.py onto sys.path[0] at runtime is a landmine for any other custom node doing bare-name imports.
Environment
Steps to reproduce
TTS-Audio-Suite\engines\rvc\impl\lib\infer_packintosys.path[0]at runtime (seeminimal_reference_wrapper.py).Expected: Florence2 inference runs.
Actual: Node fails with:
Root cause
AILab_Florence2.pyuses a bare top-level importfrom models.modeling_florence2 import .... Python's PathFinder resolvesmodelsby walkingsys.pathin order; after TTS-Audio-Suite's RVC engine inserts itsinfer_packdirectory atsys.path[0], the plain fileinfer_pack\models.pyshadows this repo'smodels/package. That file is then imported as a top-levelmodelsmodule, and its internalfrom . import modulesfails (no parent package). The error is intermittent: it only appears after an RVC workflow has run in the same process.Suggested fix
Resolve the import without relying on a bare
modelsname, e.g. insert this repo's ownmodelsdir atsys.path[0]before importing:(This is what I applied locally and it works;
modeling_florence2.pyhas no relative imports so it loads fine as a top-level module.)Additionally, TTS-Audio-Suite should be asked to stop globally polluting the process namespace: pushing a directory containing a generic
models.pyontosys.path[0]at runtime is a landmine for any other custom node doing bare-name imports.