(rank, world_size, data, max_new_tokens, fout, template)
| 54 | return '' |
| 55 | |
| 56 | def get_pred(rank, world_size, data, max_new_tokens, fout, template): |
| 57 | for item in tqdm(data): |
| 58 | prompt = item['prompt'] |
| 59 | prompt = template.replace('$INST$', prompt) |
| 60 | try: |
| 61 | response = get_response_gpt4(prompt, max_new_tokens) |
| 62 | item["plan"] = response |
| 63 | fout.write(json.dumps(item, ensure_ascii=False)+'\n') |
| 64 | fout.flush() |
| 65 | except Exception as e: |
| 66 | print(e) |
| 67 | |
| 68 | def seed_everything(seed): |
| 69 | torch.manual_seed(seed) |
nothing calls this directly
no test coverage detected