MCPcopy Index your code
hub / github.com/najoungkim/COGS

github.com/najoungkim/COGS @v1.0.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release v1.0.0 ↗ · + Follow
920 symbols 2,630 edges 108 files 369 documented · 40% 1 cross-repo links updated 3y agov1.0.0 · 2022-09-13★ 631 open issues

Browse by type

Functions 775 Types & classes 138 Endpoints 7
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

COGS

This repository contains the dataset used in the paper COGS: A Compositional Generalization Challenge Based on Semantic Interpretation, accepted to EMNLP 2020.

Dataset

The dataset can be found under data/. dev and test contain in-distribution examples and gen contains the generalization examples discussed in our paper. We used examples in train for our main experiment and train_100 for the additional experiment in the appendix with increased number of exposure examples.

Types of generalization

The final column in gen.tsv contains information about the particular generalization case described in the paper (see Table 7 for a full list). You can use data/gen_cases_to_paper_sections.json to map the column values to a more informative description of the generalization tested, plus a link to the relevant paper section.

We encourage reporting generalization performance by case as well as the aggregate performance on the full generalization set. In particular, lexical vs. structural divide seems important. cp_recursion, pp_recursion, and obj_pp_to_subj_pp correspond to structural generalization and the rest, lexical generalization.

Experiments

We used OpenNMT for our experiments. This repo contains the version of OpenNMT that we used. You can follow the instructions below to rerun our experiments.

Preprocessing

First, reformat the .tsv format dataset into format used by the OpenNMT preprocessing code:

python reformat_data_for_opennmt.py --input_path path_to_data --output_path output_path

Second, run OpenNMT preprocess. output_path should be the same as the output of the previous step, and opennmt_path should point to the src/OpenNMT directory in this repo.

bash opennmt_preprocess.sh output_path opennmt_path

Training and inference

See scripts named run_x.sh under scripts/, where x is one of transformer, lstm_uni, lstm_bi. Run with the same commandline arguments as the preprocessing step:

bash run_transformer.sh output_path opennmt_path

Please refer to the individual script files for the hyperparameter settings for each model and random seed.

After running the script, the predictions of the model for in-distribution dev/test sets and out-of-distribution generalization set will be saved under $OPENNMT_PATH/pred/ as a .tsv file. It will be a tab-delimited file with 3 columns: source, target, model_prediction.

Core symbols most depended-on inside this repo

Shape

Method 577
Function 198
Class 138
Route 7

Languages

Python100%

Modules by API surface

src/OpenNMT-py/onmt/translate/translation_server.py49 symbols
src/OpenNMT-py/onmt/inputters/inputter.py45 symbols
src/OpenNMT-py/onmt/utils/optimizers.py34 symbols
src/OpenNMT-py/onmt/utils/earlystopping.py34 symbols
src/OpenNMT-py/tools/vid_feature_extractor.py24 symbols
src/OpenNMT-py/onmt/modules/source_noise.py22 symbols
src/OpenNMT-py/onmt/utils/loss.py21 symbols
src/OpenNMT-py/onmt/decoders/decoder.py21 symbols
src/OpenNMT-py/onmt/tests/test_beam_search.py20 symbols
src/OpenNMT-py/onmt/models/sru.py20 symbols
src/OpenNMT-py/onmt/decoders/ensemble.py19 symbols
src/OpenNMT-py/onmt/bin/server.py19 symbols

Used by 1 indexed graphs manifest dependencies, hub-wide

For agents

$ claude mcp add COGS \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page