Device Argument Not Working as Expected (cuda:0)
Issue 1: --device cuda in the CLI does not actually enable GPU in image mode
In process_image(), the device passed from the CLI is ignored because the function resets it internally:
def process_image(..., device='cpu'):
# Initialize models with specified device
device = 'cpu' # ← this line overrides the CLI argument
As a result:
openface detect image.jpg --device cuda
still runs on CPU.
Issue 2: cuda:0 is rejected in LandmarkDetector
The constructor expects device="cuda" and a separate device_ids=[0], which is not how PyTorch normally handles device strings. Passing a standard string like cuda:0 results in:
Error: Invalid device type 'cuda:0'. Use 'cpu' or 'cuda'.
Just passing --device cuda results in:
Error: When using 'cuda', provide at least one valid device ID.
Aborted!
Expected Behavior
--device cuda:0 should be accepted and run on GPU 0.
process_image() should not override the device passed from CLI.
Suggested Fixes
Remove or modify the hardcoded device='cpu' line in process_image().
Change device checks to device.startswith("cuda") to support cuda:0, cuda:1, etc.
Device Argument Not Working as Expected (
cuda:0)Issue 1:
--device cudain the CLI does not actually enable GPU in image modeIn
process_image(), the device passed from the CLI is ignored because the function resets it internally:As a result:
openface detect image.jpg --device cudastill runs on CPU.
Issue 2:
cuda:0is rejected inLandmarkDetectorThe constructor expects
device="cuda"and a separatedevice_ids=[0], which is not how PyTorch normally handles device strings. Passing a standard string likecuda:0results in:Error: Invalid device type 'cuda:0'. Use 'cpu' or 'cuda'.Just passing
--device cudaresults in:Expected Behavior
--device cuda:0should be accepted and run on GPU 0.process_image()should not override the device passed from CLI.Suggested Fixes
Remove or modify the hardcoded device='cpu' line in process_image().
Change device checks to device.startswith("cuda") to support cuda:0, cuda:1, etc.