Skip to content

Failed to load model with both modern and standard methods #174

@Cloudreadypc

Description

@Cloudreadypc

ComfyUI version: 0.11.1
Python version: 3.12.10
Torch version: 2.10.0+cu130

Thanks.

got prompt
[RMBG INFO] Using standard transformers loading (fallback mode)...
[RMBG ERROR] Failed to load model with both modern and standard methods. Modern error: module 'custom_birefnet_model_4209086030571749090' has no attribute 'file'. Standard error: Tensor.item() cannot be called on meta tensors
[RMBG ERROR] Error loading model: Failed to load model with both modern and standard methods. Modern error: module 'custom_birefnet_model_4209086030571749090' has no attribute 'file'. Standard error: Tensor.item() cannot be called on meta tensors
[RMBG ERROR] Error in batch processing: Error loading model: Failed to load model with both modern and standard methods. Modern error: module 'custom_birefnet_model_4209086030571749090' has no attribute 'file'. Standard error: Tensor.item() cannot be called on meta tensors
[RMBG ERROR] Error in image processing: Error in batch processing: Error loading model: Failed to load model with both modern and standard methods. Modern error: module 'custom_birefnet_model_4209086030571749090' has no attribute 'file'. Standard error: Tensor.item() cannot be called on meta tensors
!!! Exception during processing !!! Error in image processing: Error in batch processing: Error loading model: Failed to load model with both modern and standard methods. Modern error: module 'custom_birefnet_model_4209086030571749090' has no attribute 'file'. Standard error: Tensor.item() cannot be called on meta tensors
Traceback (most recent call last):
File "D:\AI\StabilityMatrix\Data\Packages\ComfyUI\custom_nodes\ComfyUI-RMBG\py\AILab_RMBG.py", line 198, in load_model
self.model = attr(model_config)
^^^^^^^^^^^^^^^^^^
File "", line 1982, in init
File "D:\AI\StabilityMatrix\Data\Packages\ComfyUI\venv\Lib\site-packages\transformers\modeling_utils.py", line 1300, in init
self.config._experts_implementation_internal = self._check_and_adjust_experts_implementation(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\AI\StabilityMatrix\Data\Packages\ComfyUI\venv\Lib\site-packages\transformers\modeling_utils.py", line 1893, in _check_and_adjust_experts_implementation
applicable_experts_implementation = self.get_correct_experts_implementation(experts_implementation)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\AI\StabilityMatrix\Data\Packages\ComfyUI\venv\Lib\site-packages\transformers\modeling_utils.py", line 1942, in get_correct_experts_implementation
self._grouped_mm_can_dispatch()
File "D:\AI\StabilityMatrix\Data\Packages\ComfyUI\venv\Lib\site-packages\transformers\modeling_utils.py", line 1764, in _grouped_mm_can_dispatch
if not self._can_set_experts_implementation():
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\AI\StabilityMatrix\Data\Packages\ComfyUI\venv\Lib\site-packages\transformers\modeling_utils.py", line 1973, in _can_set_experts_implementation
class_file = sys.modules[cls.module].file
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: module 'custom_birefnet_model_4209086030571749090' has no attribute 'file'. Did you mean: 'name'?

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "D:\AI\StabilityMatrix\Data\Packages\ComfyUI\custom_nodes\ComfyUI-RMBG\py\AILab_RMBG.py", line 223, in load_model
self.model = AutoModelForImageSegmentation.from_pretrained(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\AI\StabilityMatrix\Data\Packages\ComfyUI\venv\Lib\site-packages\transformers\models\auto\auto_factory.py", line 365, in from_pretrained
return model_class.from_pretrained(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\AI\StabilityMatrix\Data\Packages\ComfyUI\venv\Lib\site-packages\transformers\modeling_utils.py", line 4072, in from_pretrained
model = cls(config, *model_args, **model_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\USER.cache\huggingface\modules\transformers_modules\RMBG_hyphen_2_dot_0\birefnet.py", line 1986, in init
self.bb = build_backbone(self.config.bb, pretrained=bb_pretrained)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\USER.cache\huggingface\modules\transformers_modules\RMBG_hyphen_2_dot_0\birefnet.py", line 1405, in build_backbone
bb = eval('{}({})'.format(bb_name, params_settings))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "", line 1, in
File "C:\Users\USER.cache\huggingface\modules\transformers_modules\RMBG_hyphen_2_dot_0\birefnet.py", line 1224, in swin_v1_l
model = SwinTransformer(embed_dim=192, depths=[2, 2, 18, 2], num_heads=[6, 12, 24, 48], window_size=12)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\USER.cache\huggingface\modules\transformers_modules\RMBG_hyphen_2_dot_0\birefnet.py", line 1130, in init
dpr = [x.item() for x in torch.linspace(0, drop_path_rate, sum(depths))] # stochastic depth decay rule
^^^^^^^^
File "D:\AI\StabilityMatrix\Data\Packages\ComfyUI\venv\Lib\site-packages\torch\utils_device.py", line 109, in torch_function
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "D:\AI\StabilityMatrix\Data\Packages\ComfyUI\venv\Lib\site-packages\torch_meta_registrations.py", line 7779, in meta_local_scalar_dense
raise RuntimeError("Tensor.item() cannot be called on meta tensors")
RuntimeError: Tensor.item() cannot be called on meta tensors

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "D:\AI\StabilityMatrix\Data\Packages\ComfyUI\custom_nodes\ComfyUI-RMBG\py\AILab_RMBG.py", line 229, in load_model
handle_model_error(f"Failed to load model with both modern and standard methods. Modern error: {str(modern_e)}. Standard error: {str(standard_e)}")
File "D:\AI\StabilityMatrix\Data\Packages\ComfyUI\custom_nodes\ComfyUI-RMBG\py\AILab_RMBG.py", line 88, in handle_model_error
raise RuntimeError(message)
RuntimeError: Failed to load model with both modern and standard methods. Modern error: module 'custom_birefnet_model_4209086030571749090' has no attribute 'file'. Standard error: Tensor.item() cannot be called on meta tensors

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "D:\AI\StabilityMatrix\Data\Packages\ComfyUI\custom_nodes\ComfyUI-RMBG\py\AILab_RMBG.py", line 244, in process_image
self.load_model(model_name)
File "D:\AI\StabilityMatrix\Data\Packages\ComfyUI\custom_nodes\ComfyUI-RMBG\py\AILab_RMBG.py", line 232, in load_model
handle_model_error(f"Error loading model: {str(e)}")
File "D:\AI\StabilityMatrix\Data\Packages\ComfyUI\custom_nodes\ComfyUI-RMBG\py\AILab_RMBG.py", line 88, in handle_model_error
raise RuntimeError(message)
RuntimeError: Error loading model: Failed to load model with both modern and standard methods. Modern error: module 'custom_birefnet_model_4209086030571749090' has no attribute 'file'. Standard error: Tensor.item() cannot be called on meta tensors

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "D:\AI\StabilityMatrix\Data\Packages\ComfyUI\custom_nodes\ComfyUI-RMBG\py\AILab_RMBG.py", line 646, in process_image
masks = model_instance.process_image(batch_imgs, model, params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\AI\StabilityMatrix\Data\Packages\ComfyUI\custom_nodes\ComfyUI-RMBG\py\AILab_RMBG.py", line 301, in process_image
handle_model_error(f"Error in batch processing: {str(e)}")
File "D:\AI\StabilityMatrix\Data\Packages\ComfyUI\custom_nodes\ComfyUI-RMBG\py\AILab_RMBG.py", line 88, in handle_model_error
raise RuntimeError(message)
RuntimeError: Error in batch processing: Error loading model: Failed to load model with both modern and standard methods. Modern error: module 'custom_birefnet_model_4209086030571749090' has no attribute 'file'. Standard error: Tensor.item() cannot be called on meta tensors

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "D:\AI\StabilityMatrix\Data\Packages\ComfyUI\execution.py", line 518, in execute
output_data, output_ui, has_subgraph, has_pending_tasks = await get_output_data(prompt_id, unique_id, obj, input_data_all, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb, v3_data=v3_data)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\AI\StabilityMatrix\Data\Packages\ComfyUI\execution.py", line 329, in get_output_data
return_values = await _async_map_node_over_list(prompt_id, unique_id, obj, input_data_all, obj.FUNCTION, allow_interrupt=True, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb, v3_data=v3_data)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\AI\StabilityMatrix\Data\Packages\ComfyUI\execution.py", line 303, in _async_map_node_over_list
await process_inputs(input_dict, i)
File "D:\AI\StabilityMatrix\Data\Packages\ComfyUI\execution.py", line 291, in process_inputs
result = f(**inputs)
^^^^^^^^^^^
File "D:\AI\StabilityMatrix\Data\Packages\ComfyUI\custom_nodes\ComfyUI-RMBG\py\AILab_RMBG.py", line 666, in process_image
handle_model_error(f"Error in image processing: {str(e)}")
File "D:\AI\StabilityMatrix\Data\Packages\ComfyUI\custom_nodes\ComfyUI-RMBG\py\AILab_RMBG.py", line 88, in handle_model_error
raise RuntimeError(message)
RuntimeError: Error in image processing: Error in batch processing: Error loading model: Failed to load model with both modern and standard methods. Modern error: module 'custom_birefnet_model_4209086030571749090' has no attribute 'file'. Standard error: Tensor.item() cannot be called on meta tensors

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions