Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions pred.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,14 +95,14 @@ def get_pred(data, args, fout):
output = query_llm(prompt, model, tokenizer, client, temperature=0.1, max_new_tokens=1024)
else:
output = query_llm(prompt, model, tokenizer, client, temperature=0.1, max_new_tokens=128)
if output == '':
if output == '' or output is None:
continue
if args.cot: # extract answer
response = output.strip()
item['response_cot'] = response
prompt = template_0shot_cot_ans.replace('$DOC$', context.strip()).replace('$Q$', item['question'].strip()).replace('$C_A$', item['choice_A'].strip()).replace('$C_B$', item['choice_B'].strip()).replace('$C_C$', item['choice_C'].strip()).replace('$C_D$', item['choice_D'].strip()).replace('$COT$', response)
output = query_llm(prompt, model, tokenizer, client, temperature=0.1, max_new_tokens=128)
if output == '':
if output == '' or output is None:
continue
response = output.strip()
item['response'] = response
Expand Down Expand Up @@ -156,4 +156,4 @@ def main():
parser.add_argument("--rag", "-rag", type=int, default=0) # set to 0 if RAG is not used, otherwise set to N when using top-N retrieved context
parser.add_argument("--n_proc", "-n", type=int, default=16)
args = parser.parse_args()
main()
main()