Spaces:
Sleeping
Sleeping
liujch1998
commited on
Commit
·
437cfa7
1
Parent(s):
58114b7
Bug fix
Browse files
app.py
CHANGED
@@ -55,7 +55,7 @@ class Processor:
|
|
55 |
knowledges = [''] + knowledges
|
56 |
|
57 |
prompts = [question + (f' \\n Knowledge: {knowledge} \\n Answer: ' if knowledge != '' else ' \\n Answer:') for knowledge in knowledges]
|
58 |
-
prompts_tok = self.tokenizer(prompts, return_tensors='pt', padding='max_length', truncation='longest_first', max_length=max_question_len + max_knowledge_len).
|
59 |
output = self.model(
|
60 |
input_ids=prompts_tok.input_ids,
|
61 |
attention_mask=prompts_tok.attention_mask,
|
|
|
55 |
knowledges = [''] + knowledges
|
56 |
|
57 |
prompts = [question + (f' \\n Knowledge: {knowledge} \\n Answer: ' if knowledge != '' else ' \\n Answer:') for knowledge in knowledges]
|
58 |
+
prompts_tok = self.tokenizer(prompts, return_tensors='pt', padding='max_length', truncation='longest_first', max_length=max_question_len + max_knowledge_len).to(device) # (1+K, QL+KL)
|
59 |
output = self.model(
|
60 |
input_ids=prompts_tok.input_ids,
|
61 |
attention_mask=prompts_tok.attention_mask,
|