Modifications to make it work on Apple Silicon devices:
Modified the load() method to handle loading the model weights based on the selected device (CPU, MPS, or CUDA). The map_location parameter is set accordingly to ensure the weights are loaded onto the correct device.
Updated the INPUT_TYPES() method to correctly define the available device options based on the availability of MPS and CUDA devices.
In the matting() method, added a step to move the model to the selected device (self.model.to(device)) before performing the forward pass. This ensures that both the input tensor and the model weights are on the same device, avoiding device mismatch errors.
These changes address the issues related to loading the pre-trained model weights on different devices (CPU, MPS, or CUDA) and ensure that the BiRefNet node works correctly on various hardware configurations, including MacBook Pro M2 with MPS.
The modifications improve the compatibility and robustness of the code, allowing users to run the BiRefNet node seamlessly on their specific hardware setup without encountering errors related to device mismatches or unsupported CUDA operations.
Modifications to make it work on Apple Silicon devices:
Modified the load() method to handle loading the model weights based on the selected device (CPU, MPS, or CUDA). The map_location parameter is set accordingly to ensure the weights are loaded onto the correct device.
Updated the INPUT_TYPES() method to correctly define the available device options based on the availability of MPS and CUDA devices.
In the matting() method, added a step to move the model to the selected device (self.model.to(device)) before performing the forward pass. This ensures that both the input tensor and the model weights are on the same device, avoiding device mismatch errors.
These changes address the issues related to loading the pre-trained model weights on different devices (CPU, MPS, or CUDA) and ensure that the BiRefNet node works correctly on various hardware configurations, including MacBook Pro M2 with MPS.
The modifications improve the compatibility and robustness of the code, allowing users to run the BiRefNet node seamlessly on their specific hardware setup without encountering errors related to device mismatches or unsupported CUDA operations.