From 060f74ce15cd90d8d23407e989399614ed8b138e Mon Sep 17 00:00:00 2001 From: Glary-Bot Date: Tue, 4 Aug 2026 06:23:39 +0000 Subject: [PATCH] Guard cpu fallback in gemma4 template test like the seedvr2 tests --- tests-unit/comfy_test/gemma4_template_test.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tests-unit/comfy_test/gemma4_template_test.py b/tests-unit/comfy_test/gemma4_template_test.py index cd82ea09c..104e2f0ae 100644 --- a/tests-unit/comfy_test/gemma4_template_test.py +++ b/tests-unit/comfy_test/gemma4_template_test.py @@ -1,8 +1,13 @@ +"""Gemma4 chat template regression tests.""" + +import torch + from comfy.cli_args import args -args.cpu = True # importing comfy.model_management probes the torch device at import time +if not torch.cuda.is_available(): + args.cpu = True -from comfy.text_encoders.gemma4 import Gemma4_Tokenizer +from comfy.text_encoders.gemma4 import Gemma4_Tokenizer # noqa: E402 PROMPT = "describe a cute anime girl with fennec ears"