MCPcopy Create free account
hub / github.com/WangHanLinHenry/SPA-RL-Agent / load_tasks

Method load_tasks

eval_agent/tasks/intercode_sql.py:37–59  ·  view source on GitHub ↗
(cls, split: str, part_num: int, part_idx: int = -1)

Source from the content-addressed store, hash-verified

35
36 @classmethod
37 def load_tasks(cls, split: str, part_num: int, part_idx: int = -1) -> Tuple[Iterable[Task], int]:
38 if split == 'train':
39 idxs = json.load(open("eval_agent/data/intercode_sql/train_indices.json"))
40 env = SqlEnv("docker-env-sql", data_path="eval_agent/data/intercode_sql/ic_spider_train.json", preprocess=preprocess_sql, verbose=False)
41 else:
42 idxs = json.load(open("eval_agent/data/intercode_sql/test_indices.json"))
43 env = SqlEnv("docker-env-sql", data_path="eval_agent/data/intercode_sql/ic_spider_test.json", preprocess=preprocess_sql, verbose=False)
44
45 if part_num == 1:
46 idxs = idxs
47 else:
48 assert part_idx != -1
49 part_len = len(idxs) // part_num + 1
50 idxs = idxs[part_len * part_idx: min(part_len * (part_idx + 1), len(idxs))]
51 N_TASKS = len(idxs)
52
53 def generator():
54 for idx in idxs:
55 env.reset(idx)
56 obs = env.query
57 yield cls(idx, env, obs)
58
59 return generator(), N_TASKS
60

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected