When running ComfyUI-RMBG Background Remover with method InspyreNet, i get the following exception:
File "H:\AI\Tools\ComfyUI-Test\venv\Lib\site-packages\transparent_background\Remover.py", line 156, in __init__
from pymatting.foreground.estimate_foreground_ml_cupy import estimate_foreground_ml_cupy as estimate_foreground_ml
File "H:\AI\Tools\ComfyUI-Test\venv\Lib\site-packages\pymatting\foreground\estimate_foreground_ml_cupy.py", line 2, in <module>
import cupy as cp
File "H:\AI\Tools\ComfyUI-Test\venv\Lib\site-packages\cupy\__init__.py", line 16, in <module>
from cupy import _core # NOQA
^^^^^^^^^^^^^^^^^^^^^^
File "H:\AI\Tools\ComfyUI-Test\venv\Lib\site-packages\cupy\_core\__init__.py", line 3, in <module>
from cupy._core import core # NOQA
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "cupy\\_core\\core.pyx", line 1, in init cupy._core.core
File "cupy\\_core\\_scalar.pyx", line 1, in init cupy._core._scalar
File "cupy\\_core\\_dtype.pyx", line 47, in init cupy._core._dtype
File "cupy\\_core\\_dtype.pyx", line 43, in cupy._core._dtype._init_dtype_dict
TypeError: Alias 'bool8' was removed in NumPy 2.0. Use a name without a digit at the end.
The issue here is firstly in cupy that is not 100% compatible with numpy 2.x, nothing you or i can do here atm, because i need numpy >= 2.0. But since cupyisn't even needed - as you can see in the Remover.py code:
try:
from pymatting.foreground.estimate_foreground_ml_cupy import estimate_foreground_ml_cupy as estimate_foreground_ml
except ImportError:
try:
from pymatting.foreground.estimate_foreground_ml_pyopencl import estimate_foreground_ml_pyopencl as estimate_foreground_ml
except ImportError:
try:
from pymatting import estimate_foreground_ml
except ImportError:
warnings.warn('Failed to load pymatting. Ignore this message if post-processing is not needed')
The issue would be solved by not only catching the ImportError exception, but also TypeError.
I fixed it locally by changing
try:
from pymatting.foreground.estimate_foreground_ml_cupy import estimate_foreground_ml_cupy as estimate_foreground_ml
except ImportError:
to
try:
from pymatting.foreground.estimate_foreground_ml_cupy import estimate_foreground_ml_cupy as estimate_foreground_ml
except (ImportError, TypeError):
If you have the time, please change your code to make it more robust - thank you very much!
When running ComfyUI-RMBG Background Remover with method InspyreNet, i get the following exception:
The issue here is firstly in cupy that is not 100% compatible with numpy 2.x, nothing you or i can do here atm, because i need numpy >= 2.0. But since cupyisn't even needed - as you can see in the Remover.py code:
The issue would be solved by not only catching the ImportError exception, but also TypeError.
I fixed it locally by changing
to
If you have the time, please change your code to make it more robust - thank you very much!