Spaces:
Sleeping
Sleeping
Commit
·
b6a4c0b
1
Parent(s):
167e446
Bug fix
Browse files
app.py
CHANGED
@@ -56,6 +56,7 @@ class Processor:
|
|
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,
|
|
|
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 |
+
print(prompts_tok.input_ids.size(), choices_ids[0].unsqueeze(0).expand(len(knowledges), -1).size())
|
60 |
output = self.model(
|
61 |
input_ids=prompts_tok.input_ids,
|
62 |
attention_mask=prompts_tok.attention_mask,
|