Skip to content

Commit

Permalink
[shortfin] Adapt input_ids use for tokenization or carrying input_ids…
Browse files Browse the repository at this point in the history
… from requests
  • Loading branch information
jinchen62 committed Jan 21, 2025
1 parent d4298df commit 04d82e7
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions shortfin/python/shortfin_apps/sd/components/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]

Expand Down Expand Up @@ -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])
Expand Down

0 comments on commit 04d82e7

Please sign in to comment.