From 04d82e77392ee4f41c0b22b2f219ca810d5d0b7c Mon Sep 17 00:00:00 2001 From: jinchen62 Date: Tue, 21 Jan 2025 17:53:42 -0600 Subject: [PATCH] [shortfin] Adapt input_ids use for tokenization or carrying input_ids from requests --- shortfin/python/shortfin_apps/sd/components/service.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/shortfin/python/shortfin_apps/sd/components/service.py b/shortfin/python/shortfin_apps/sd/components/service.py index a4a7251c2..edf9d2e7b 100644 --- a/shortfin/python/shortfin_apps/sd/components/service.py +++ b/shortfin/python/shortfin_apps/sd/components/service.py @@ -397,9 +397,9 @@ async def _prepare(self, device, requests): # Tokenize the prompts if the request does not hold input_ids. if ids_list is None: for tokenizer in self.service.tokenizers: - input_ids = tokenizer.encode(request.prompt) + input_ids = tokenizer.encode(request.prompt).input_ids input_ids_list.append(input_ids) - neg_ids = tokenizer.encode(request.neg_prompt) + neg_ids = tokenizer.encode(request.neg_prompt).input_ids neg_ids_list.append(neg_ids) ids_list = [*input_ids_list, *neg_ids_list] @@ -465,7 +465,7 @@ async def _encode(self, device, requests): with host_arrs[idx].view(i).map(write=True, discard=True) as m: # TODO: fix this attr redundancy - np_arr = requests[i].input_ids[idx].input_ids + np_arr = requests[i].input_ids[idx] m.fill(np_arr) clip_inputs[idx].copy_from(host_arrs[idx])