Hi Friends, I am having issues using from a CLI workflow with video processing my server GPU. I am alway falling back to CPU, which is toooo. I spent a day on trying docu and chatgtp, but havenât got any success. Any ideas or how-toâs would be greatly welcomed. thx and cheers, Thomas
Infrastructure:
inference version: v0.59.0
inference-sdk version: v0.59.0
inference-cli version: v0.59.0
running on ubuntu linux server, within docker
starting with âinference server startâ as well as with a shell script. Same effects.
I have verified that
GPU is working
can be reached thru CUDA from the container
here is my script
1_aves_del_pozo_detection_nusakan
inference workflows process-images-directory --help
script is verified to work, but seems not to use GPU
updated inference on 27th of Oct. to v50
updated /etc/docker/daemon.json on 27th of Oct. to include âdefault-runtimeâ: ânvidiaâ
script shall be run on nusakan server
import os
import subprocess
video_path = â/nunki/magellanes/uploads/cam4/2025/04/14/magellanes-cam4_00_20250414153636.mp4â
output_dir = â/nunki/yatina/output/video_output/â
workspace_name = âyatinanetâ
workflow_id = âaves-time-in-zoneâ
api_key = âmykeyâ
processing_target = âapiâ
api_url = âhttp://inference.yatina.net:9001â # installed on Hermannâs nusakan / Docker, verified to run
aggregation_format = âjsonlâ
maxfps = â25â
threads =â1â
import os
output_path = os.path.abspath(output_dir)
print(f"Roboflow is writing files to: {output_path}")
â force workflow to use GPU â
os.environ[âROBOFLOW_DEVICEâ] = âcudaâ
os.environ[âROBOFLOW_TARGETâ] = âapiâ
â debug: check GPU before running â
gpu_test_cmd = [
âinferenceâ, âworkflowsâ, âprocess-videoâ,
ââhelpâ
]
Run help command just to ensure CLI can see environment
result = subprocess.run(gpu_test_cmd, check=False, capture_output=True, text=True, env=os.environ)
if âcudaâ in result.stdout.lower() or âcudaâ in result.stderr.lower():
print(âGPU detected by inference CLI
â)
else:
print(â
Warning: GPU may not be detected by inference CLIâ)
print(âSTDOUT:â, result.stdout)
print(âSTDERR:â, result.stderr)
command = [
âinferenceâ, âworkflowsâ, âprocess-videoâ,
â-vâ, video_path,
â-oâ, output_dir,
â-ptâ, processing_target,
ââworkspace_nameâ, workspace_name,
ââworkflow_idâ, workflow_id,
ââapi-keyâ, api_key,
ââapi_urlâ, api_url,
ââaggregateâ,
ââoutput_file_typeâ, aggregation_format,
"--max_fps", maxfps,
"--save_out_video",
"--allow_override",
"--debug_mode",
ââthreadsâ, threads
]
print(âExecuting command:â)
print(" ".join(command)) # Prints the full command as a string
Print standard output and errors
result = subprocess.run(command, check=False, capture_output=True, text=True)
print(âSTDOUT:\nâ, result.stdout)
print(âSTDERR:\nâ, result.stderr)





