From 2936950860a827bdcc2b0a43ec60ff9d060cd8be Mon Sep 17 00:00:00 2001 From: Anupam Kumar Date: Thu, 6 Nov 2025 21:13:11 +0530 Subject: [PATCH] fix: use cpu device when rocm is the compute device Signed-off-by: Anupam Kumar --- lib/Service.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/Service.py b/lib/Service.py index 60b792f..544f85b 100644 --- a/lib/Service.py +++ b/lib/Service.py @@ -17,8 +17,6 @@ from sentencepiece import SentencePieceProcessor from util import clean_text -GPU_ACCELERATED = os.getenv("COMPUTE_DEVICE", "CPU") != "CPU" - logger = logging.getLogger(os.environ["APP_ID"] + __name__) class ServiceException(Exception): @@ -43,7 +41,8 @@ def translate_context(config: dict): translator = ctranslate2.Translator( **{ - "device": "cuda" if GPU_ACCELERATED else "cpu", + # only NVIDIA GPUs are supported by CTranslate2 for now + "device": "cuda" if os.getenv("COMPUTE_DEVICE") == "CUDA" else "cpu", **config["loader"], } )