GeezerVison is showing github.com — Small modification to spider dataset gen. naming · princeton-nlp/intercode@0fe1880
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: data/sql/spider/README.md +3-2Lines changed: 3 additions & 2 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
| 4 | 4 | * [Link](https://drive.google.com/uc?export=download&id=1TqleXec_OykOYFREKKtschzY29dUcVAQ) to Spider Dataset | 5 | 5 |
| 6 | 6 | ## Set Up | 7 | | -To create the `data/sql/spider/dev_spider.json` file, do the following: | | 7 | +To recreate the `ic_spider_dev.json` file, do the following: | 8 | 8 | 1. Download Spider dataset from the above link | 9 | 9 | 2. Run the below script with the local path to the Spider dataset as an argument | 10 | 10 | ```sh | 11 | | -python transform_spider.py --data_path <Path to spider data folder> | | 11 | +python transform/transform_spider.py <Path to Spider dataset> | 12 | 12 | ``` | | 13 | +* You can also run this script on the `train` set for Spider by simply adding the `--split train` flag | 13 | 14 |
| 14 | 15 | ## Dataset Description | 15 | 16 | The script uses data from the `dev.json` file of the Spider dataset, mapping these original fields to the following new keys: | |
Collapse file Copy file name to clipboard File renamed without changes. Collapse file Copy file name to clipboardExpand all lines: data/sql/spider/transform/transform_spider.py +3-3Lines changed: 3 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 12 | 12 | python transform_spider.py --data_path ~/Desktop/spider --split dev | 13 | 13 | """ | 14 | 14 | parser = argparse.ArgumentParser(description='Script to transform Spider SQL data to Intercode compatible format') | 15 | | -parser.add_argument('--data_path', type=str, help='path to spider data folder') | 16 | | -parser.add_argument('--split', choices=["train", "dev"], help='which data split to create data json file for') | | 15 | +parser.add_argument('data_path', type=str, help='path to spider data folder') | | 16 | +parser.add_argument('--split', choices=["train", "dev"], default="dev", help='which data split to create data json file for') | 17 | 17 | args = parser.parse_args() | 18 | 18 |
| 19 | 19 | cut_spaces = lambda val: " ".join(val.split()) | @@ -77,5 +77,5 @@ def get_hardness(db_dir: str, g: List): | 77 | 77 | print(f'Skipped {skipped} pairs') | 78 | 78 | random.Random(33).shuffle(transform_spider) | 79 | 79 |
| 80 | | - with open(f"{args.split}_spider.json", "w") as fp: | | 80 | + with open(f"ic_spider_{args.split}.json", "w") as fp: | 81 | 81 | json.dump(transform_spider, fp, indent=2) |
Collapse file Copy file name to clipboardExpand all lines: data/test/python_queries.csv -2Lines changed: 0 additions & 2 deletions Collapse file Copy file name to clipboardExpand all lines: intercode/envs/ic_env.py +1Lines changed: 1 addition & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -75,6 +75,7 @@ def __init__(self, image_name: str, **kwargs): | 75 | 75 | self.image_name = image_name | 76 | 76 | self.container_name = f"{self.image_name}_ic_ctr" | 77 | 77 | self.container = get_container(self.container_name, self.image_name, **kwargs) | | 78 | + self.logger.info(f"Connected to `{self.container_name}` container") | 78 | 79 |
| 79 | 80 | self.logger.info("Environment Initialized") | 80 | 81 | if not self.tool_mode: | |
Collapse file Copy file name to clipboardExpand all lines: scripts/expr_multi_turn.sh +2-3Lines changed: 2 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | # !bin/bash | 2 | 2 |
| 3 | 3 | # Data Paths | 4 | | -# - (SQL) ./data/sql/spider/dev_spider.json | | 4 | +# - (SQL) ./data/sql/spider/ic_spider_dev.json | 5 | 5 | # - (SQL) ./data/test/sql_queries.csv | 6 | 6 | # - (Bash) ./data/bash/nl2bash/nl2bash.json | 7 | 7 | # - (Bash) ./data/test/bash_queries.json | 8 | | -# - (Bash) ./data/test/nl2cmd.json | 9 | 8 |
| 10 | 9 | # Environments | 11 | 10 | # - sql, bash | | 33 | 32 |
| 34 | 33 | # SQL Call | 35 | 34 | python -m experiments.eval_n_turn \ | 36 | | - --data_path ./data/sql/spider/dev_spider.json \ | | 35 | + --data_path ./data/sql/spider/ic_spider_dev.json \ | 37 | 36 | --dialogue_limit 5 \ | 38 | 37 | --env sql \ | 39 | 38 | --image_name docker-env-sql \ | |
Collapse file Copy file name to clipboardExpand all lines: scripts/expr_n_turn_others.sh +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | python -m experiments.eval_n_turn_others \ | 2 | | - --data_path ./data/sql/spider/dev_spider.json \ | | 2 | + --data_path ./data/sql/spider/ic_spider_dev.json \ | 3 | 3 | --dialogue_limit 5 \ | 4 | 4 | --env sql \ | 5 | 5 | --image_name docker-env-sql \ | |
Collapse file Copy file name to clipboardExpand all lines: scripts/expr_plan_solve.sh +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -12,7 +12,7 @@ python -m experiments.eval_plan_solve \ | 12 | 12 | # * Include --refine and --refine_turns for plan & solve + refine | 13 | 13 | # * Include --proportion and --seed to randomize order of task instances | 14 | 14 | # python -m experiments.eval_plan_solve \ | 15 | | -# --data_path ./data/sql/spider/dev_spider.json \ | | 15 | +# --data_path ./data/sql/spider/ic_spider_dev.json \ | 16 | 16 | # --env sql \ | 17 | 17 | # --image_name docker-env-sql \ | 18 | 18 | # --log_dir logs/experiments \ | |
Collapse file Copy file name to clipboardExpand all lines: scripts/expr_react.sh +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -9,7 +9,7 @@ python -m experiments.eval_react \ | 9 | 9 |
| 10 | 10 | # SQL Call | 11 | 11 | # python -m experiments.eval_react \ | 12 | | -# --data_path ./data/sql/spider/dev_spider.json \ | | 12 | +# --data_path ./data/sql/spider/ic_spider_dev.json \ | 13 | 13 | # --env sql \ | 14 | 14 | # --image_name docker-env-sql \ | 15 | 15 | # --log_dir logs/experiments \ | |
Collapse file Copy file name to clipboardExpand all lines: tests/test_reward_sql.py +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -8,7 +8,7 @@ def preprocess(record: Dict) -> str: | 8 | 8 | db = record["extra"]["db"] | 9 | 9 | return f"use {db}" | 10 | 10 |
| 11 | | - data_path = "./data/sql/spider/dev_spider.json" | | 11 | + data_path = "./data/sql/spider/ic_spider_dev.json" | 12 | 12 | image_name = "docker-env-sql" | 13 | 13 | env = SqlEnv(image_name, data_path=data_path, preprocess=preprocess) | 14 | 14 | total, errors = 0, [] | |
|