From f43b459e9b3a56cbddcfbbb3260c23c0e9e80941 Mon Sep 17 00:00:00 2001 From: awsr <43862868+awsr@users.noreply.github.com> Date: Fri, 27 Feb 2026 20:11:10 -0800 Subject: [PATCH] Revert "Use manual looping" This reverts commit e5fdb0015727edc68938a8a394a83b3c70f9833a. --- modules/ui_common.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/modules/ui_common.py b/modules/ui_common.py index 0231676c6..99a8a2d22 100644 --- a/modules/ui_common.py +++ b/modules/ui_common.py @@ -458,8 +458,11 @@ def update_token_counter(text: str): max_length = 0 try: - for p in prompt_list: - ids.append(getattr(tokenizer(p), 'input_ids', [])) + try: + ids = getattr(tokenizer(prompt_list), 'input_ids', []) + except TypeError: + for p in prompt_list: + ids.append(getattr(tokenizer(p), 'input_ids', [])) except Exception as e: shared.log.warning("Token counter:", e) return gr.update(value=f"??/{max_length}", visible=True)