MCPcopy Create free account
hub / github.com/THUDM/LongWriter / get_pred

Function get_pred

agentwrite/plan.py:56–66  ·  view source on GitHub ↗
(rank, world_size, data, max_new_tokens, fout, template)

Source from the content-addressed store, hash-verified

54 return ''
55
56def 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
68def seed_everything(seed):
69 torch.manual_seed(seed)

Callers

nothing calls this directly

Calls 1

get_response_gpt4Function · 0.70

Tested by

no test coverage detected