Browse Source

Trying to get the chat to work

oobabooga 2 năm trước cách đây
mục cha
commit
f871971de1
1 tập tin đã thay đổi với 3 bổ sung0 xóa
  1. 3 0
      modules/text_generation.py

+ 3 - 0
modules/text_generation.py

@@ -22,6 +22,9 @@ def get_max_prompt_length(tokens):
     return max_length
     return max_length
 
 
 def encode(prompt, tokens_to_generate=0, add_special_tokens=True):
 def encode(prompt, tokens_to_generate=0, add_special_tokens=True):
+    if shared.is_RWKV:
+        return prompt
+
     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:
         return input_ids
         return input_ids