Description
An error occurs when running the model in a CPU-only environment because the tensor device is hardcoded to "cuda" in sam3/model/position_encoding.py.
Location of the Issue
|
tensors = torch.zeros((1, 1) + size, device="cuda") |
Suggested Fix
We can resolve this by dynamically allocating the device based on an existing tensor or module parameters. For example:
tensors = torch.zeros((1, 1) + size, device="cuda" if torch.cuda.is_available() else "cpu")
Description
An error occurs when running the model in a CPU-only environment because the tensor device is hardcoded to
"cuda"insam3/model/position_encoding.py.Location of the Issue
sam3/sam3/model/position_encoding.py
Line 55 in 5dd401d
Suggested Fix
We can resolve this by dynamically allocating the device based on an existing tensor or module parameters. For example: