mirror of
https://github.com/oobabooga/text-generation-webui.git
synced 2024-12-01 11:54:04 +01:00
Fix encode() for RWKV
This commit is contained in:
parent
44e6d82185
commit
8e89bc596b
@ -24,6 +24,7 @@ def encode(prompt, tokens_to_generate=0, add_special_tokens=True):
|
|||||||
if shared.is_RWKV:
|
if shared.is_RWKV:
|
||||||
input_ids = shared.tokenizer.encode(str(prompt))
|
input_ids = shared.tokenizer.encode(str(prompt))
|
||||||
input_ids = np.array(input_ids).reshape(1, len(input_ids))
|
input_ids = np.array(input_ids).reshape(1, len(input_ids))
|
||||||
|
return input_ids
|
||||||
else:
|
else:
|
||||||
input_ids = shared.tokenizer.encode(str(prompt), return_tensors='pt', truncation=True, max_length=get_max_prompt_length(tokens_to_generate), add_special_tokens=add_special_tokens)
|
input_ids = shared.tokenizer.encode(str(prompt), return_tensors='pt', truncation=True, max_length=get_max_prompt_length(tokens_to_generate), add_special_tokens=add_special_tokens)
|
||||||
if shared.args.cpu:
|
if shared.args.cpu:
|
||||||
|
Loading…
Reference in New Issue
Block a user