python_code
stringlengths
0
4.04M
repo_name
stringlengths
8
58
file_path
stringlengths
5
147
# Copyright (c) Meta Platforms, Inc. and affiliates All Rights Reserved import os import re from datasets import load_dataset base_dir = os.environ['BASE_DIR'] def load_dataset_with_name(dataset_name, split): """ Take a dataset name and split name, load the dataset. Returns a huggingface dataset dict. ...
CompGenRep_MLRC2022-main
utils/helper_utils/helper_methods.py
# Copyright (c) Meta Platforms, Inc. and affiliates All Rights Reserved import logging import os import re import sys import json import torch from dataclasses import dataclass, field from typing import List, Optional, Tuple import pdb import datasets from datasets import load_dataset, load_metric from ast import lite...
CompGenRep_MLRC2022-main
hf_training/fine_tune_t5.py
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team. # Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved. # Copyright (c) Meta Platforms, Inc. and affiliates All Rights Reserved # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use...
CompGenRep_MLRC2022-main
hf_training/trainer_seq2seq_sp.py
#!/usr/bin496/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates All Rights Reserved import sys import os import time import argparse import json import random import shutil import copy import pickle import torch from torch import cuda import numpy as np import time import logging from tokenizer import To...
CompGenRep_MLRC2022-main
baseline_replication/neural-qcfg/train_scan.py
# Copyright (c) Meta Platforms, Inc. and affiliates All Rights Reserved ### Convert tsv data to csv format for transformers training import re from absl import app from absl import flags FLAGS = flags.FLAGS flags.DEFINE_string("tsv", "", "Input tsv file.") flags.DEFINE_string("output", "", "Output tsv file.") def...
CompGenRep_MLRC2022-main
baseline_replication/COGS/convert_to_nqg_format.py
# Copyright (c) Meta Platforms, Inc. and affiliates All Rights Reserved ### Convert tsv data to csv format for transformers training import re from absl import app from absl import flags FLAGS = flags.FLAGS flags.DEFINE_string("tsv", "", "Input tsv file.") flags.DEFINE_string("csv", "", "Output csv file.") def ma...
CompGenRep_MLRC2022-main
baseline_replication/COGS/convert_to_csv.py
# Copyright (c) Meta Platforms, Inc. and affiliates All Rights Reserved ### Convert tsv data to csv format for transformers training import re from absl import app from absl import flags FLAGS = flags.FLAGS flags.DEFINE_string("tsv", "", "Input tsv file.") flags.DEFINE_string("csv", "", "Output csv file.") def ma...
CompGenRep_MLRC2022-main
baseline_replication/TMCD/convert_to_csv.py
CompGenRep_MLRC2022-main
baseline_replication/TMCD/tasks/__init__.py
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors. # Copyright (c) Meta Platforms, Inc. and affiliates All Rights Reserved # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # ...
CompGenRep_MLRC2022-main
baseline_replication/TMCD/tasks/strip_targets.py
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors. # Copyright (c) Meta Platforms, Inc. and affiliates All Rights Reserved # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # ...
CompGenRep_MLRC2022-main
baseline_replication/TMCD/tasks/split_dataset.py
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors. # Copyright (c) Meta Platforms, Inc. and affiliates All Rights Reserved # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # ...
CompGenRep_MLRC2022-main
baseline_replication/TMCD/tasks/tsv_utils.py
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors. # Copyright (c) Meta Platforms, Inc. and affiliates All Rights Reserved # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # ...
CompGenRep_MLRC2022-main
baseline_replication/TMCD/tasks/scan/convert_to_tsv.py
# coding=utf-8 # Copyright 2022 The Google Research Authors. # Copyright (c) Meta Platforms, Inc. and affiliates All Rights Reserved # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # ht...
CompGenRep_MLRC2022-main
baseline_replication/TMCD/tasks/scan/preprocess_main.py
# coding=utf-8 # Copyright 2022 The Google Research Authors. # Copyright (c) Meta Platforms, Inc. and affiliates All Rights Reserved # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # ht...
CompGenRep_MLRC2022-main
baseline_replication/TMCD/tasks/scan/preprocess.py
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors. # Copyright (c) Meta Platforms, Inc. and affiliates All Rights Reserved # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # ...
CompGenRep_MLRC2022-main
baseline_replication/TMCD/tasks/scan/join_txt_to_tsv.py
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors. # Copyright (c) Meta Platforms, Inc. and affiliates All Rights Reserved # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # ...
CompGenRep_MLRC2022-main
baseline_replication/TMCD/tasks/spider/sql_parser_main.py
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors. # Copyright (c) Meta Platforms, Inc. and affiliates All Rights Reserved # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # ...
CompGenRep_MLRC2022-main
baseline_replication/TMCD/tasks/spider/nqg_preprocess.py
# Copyright (c) Meta Platforms, Inc. and affiliates All Rights Reserved ################################ # val: number(float)/string(str)/sql(dict) # col_unit: (agg_id, col_id, isDistinct(bool)) # val_unit: (unit_op, col_unit1, col_unit2) # table_unit: (table_type, col_unit/sql) # cond_unit: (not_op, op_id, val_unit, v...
CompGenRep_MLRC2022-main
baseline_replication/TMCD/tasks/spider/evaluation.py
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors. # Copyright (c) Meta Platforms, Inc. and affiliates All Rights Reserved # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # ...
CompGenRep_MLRC2022-main
baseline_replication/TMCD/tasks/spider/restore_oov.py
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors. # Copyright (c) Meta Platforms, Inc. and affiliates All Rights Reserved # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # ...
CompGenRep_MLRC2022-main
baseline_replication/TMCD/tasks/spider/write_dataset.py
# Copyright (c) Meta Platforms, Inc. and affiliates All Rights Reserved ################################ # Assumptions: # 1. sql is correct # 2. only table name has alias # 3. only one intersect/union/except # # val: number(float)/string(str)/sql(dict) # col_unit: (agg_id, col_id, isDistinct(bool)) # val_unit: (u...
CompGenRep_MLRC2022-main
baseline_replication/TMCD/tasks/spider/process_sql.py
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors. # Copyright (c) Meta Platforms, Inc. and affiliates All Rights Reserved # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # ...
CompGenRep_MLRC2022-main
baseline_replication/TMCD/tasks/spider/nqg_tokenization.py
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors. # Copyright (c) Meta Platforms, Inc. and affiliates All Rights Reserved # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # ...
CompGenRep_MLRC2022-main
baseline_replication/TMCD/tasks/spider/sql_tokenizer.py
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors. # Copyright (c) Meta Platforms, Inc. and affiliates All Rights Reserved # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # ...
CompGenRep_MLRC2022-main
baseline_replication/TMCD/tasks/spider/append_schema.py
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors. # Copyright (c) Meta Platforms, Inc. and affiliates All Rights Reserved # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # ...
CompGenRep_MLRC2022-main
baseline_replication/TMCD/tasks/spider/generate_gold.py
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors. # Copyright (c) Meta Platforms, Inc. and affiliates All Rights Reserved # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # ...
CompGenRep_MLRC2022-main
baseline_replication/TMCD/tasks/spider/database_constants.py
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors. # Copyright (c) Meta Platforms, Inc. and affiliates All Rights Reserved # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # ...
CompGenRep_MLRC2022-main
baseline_replication/TMCD/tasks/geoquery/geobase_utils.py
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors. # Copyright (c) Meta Platforms, Inc. and affiliates All Rights Reserved # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # ...
CompGenRep_MLRC2022-main
baseline_replication/TMCD/tasks/geoquery/gen_template_split.py
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors. # Copyright (c) Meta Platforms, Inc. and affiliates All Rights Reserved # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # ...
CompGenRep_MLRC2022-main
baseline_replication/TMCD/tasks/geoquery/tmcd_utils.py
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors. # Copyright (c) Meta Platforms, Inc. and affiliates All Rights Reserved # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # ...
CompGenRep_MLRC2022-main
baseline_replication/TMCD/tasks/geoquery/measure_unseen_atoms.py
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors. # Copyright (c) Meta Platforms, Inc. and affiliates All Rights Reserved # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # ...
CompGenRep_MLRC2022-main
baseline_replication/TMCD/tasks/geoquery/write_dataset.py
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors. # Copyright (c) Meta Platforms, Inc. and affiliates All Rights Reserved # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # ...
CompGenRep_MLRC2022-main
baseline_replication/TMCD/tasks/geoquery/xml_file_utils.py
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors. # Copyright (c) Meta Platforms, Inc. and affiliates All Rights Reserved # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # ...
CompGenRep_MLRC2022-main
baseline_replication/TMCD/tasks/geoquery/measure_compound_divergence.py
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors. # Copyright (c) Meta Platforms, Inc. and affiliates All Rights Reserved # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # ...
CompGenRep_MLRC2022-main
baseline_replication/TMCD/tasks/geoquery/entity_utils.py
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors. # Copyright (c) Meta Platforms, Inc. and affiliates All Rights Reserved # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # ...
CompGenRep_MLRC2022-main
baseline_replication/TMCD/tasks/geoquery/funql_normalization.py
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors. # Copyright (c) Meta Platforms, Inc. and affiliates All Rights Reserved # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # ...
CompGenRep_MLRC2022-main
baseline_replication/TMCD/tasks/geoquery/gen_tmcd_split.py
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors. # Copyright (c) Meta Platforms, Inc. and affiliates All Rights Reserved # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # ...
CompGenRep_MLRC2022-main
baseline_replication/TMCD/common/cky/cfg_parser.py
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors. # Copyright (c) Meta Platforms, Inc. and affiliates All Rights Reserved # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # ...
CompGenRep_MLRC2022-main
baseline_replication/TMCD/common/cky/cky_utils.py
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors. # Copyright (c) Meta Platforms, Inc. and affiliates All Rights Reserved # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # ...
CompGenRep_MLRC2022-main
baseline_replication/TMCD/common/cky/cfg_rule.py
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors. # Copyright (c) Meta Platforms, Inc. and affiliates All Rights Reserved # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # ...
CompGenRep_MLRC2022-main
baseline_replication/TMCD/common/cky/trie_utils.py
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors. # Copyright (c) Meta Platforms, Inc. and affiliates All Rights Reserved # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # ...
CompGenRep_MLRC2022-main
baseline_replication/TMCD/model/parser/test_utils.py
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors. # Copyright (c) Meta Platforms, Inc. and affiliates All Rights Reserved # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # ...
CompGenRep_MLRC2022-main
baseline_replication/TMCD/model/parser/nqg_model.py
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors. # Copyright (c) Meta Platforms, Inc. and affiliates All Rights Reserved # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # ...
CompGenRep_MLRC2022-main
baseline_replication/TMCD/model/parser/config_utils.py
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors. # Copyright (c) Meta Platforms, Inc. and affiliates All Rights Reserved # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # ...
CompGenRep_MLRC2022-main
baseline_replication/TMCD/model/parser/training/train_model.py
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors. # Copyright (c) Meta Platforms, Inc. and affiliates All Rights Reserved # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # ...
CompGenRep_MLRC2022-main
baseline_replication/TMCD/model/parser/training/forest_utils.py
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors. # Copyright (c) Meta Platforms, Inc. and affiliates All Rights Reserved # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # ...
CompGenRep_MLRC2022-main
baseline_replication/TMCD/model/parser/training/training_utils.py
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors. # Copyright (c) Meta Platforms, Inc. and affiliates All Rights Reserved # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # ...
CompGenRep_MLRC2022-main
baseline_replication/TMCD/model/parser/training/input_utils.py
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors. # Copyright (c) Meta Platforms, Inc. and affiliates All Rights Reserved # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # ...
CompGenRep_MLRC2022-main
baseline_replication/TMCD/model/parser/inference/inference_parser.py
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors. # Copyright (c) Meta Platforms, Inc. and affiliates All Rights Reserved # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # ...
CompGenRep_MLRC2022-main
baseline_replication/TMCD/model/parser/inference/generate_predictions.py
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors. # Copyright (c) Meta Platforms, Inc. and affiliates All Rights Reserved # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # ...
CompGenRep_MLRC2022-main
baseline_replication/TMCD/model/parser/inference/inference_wrapper.py
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors. # Copyright (c) Meta Platforms, Inc. and affiliates All Rights Reserved # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # ...
CompGenRep_MLRC2022-main
baseline_replication/TMCD/model/parser/inference/eval_model.py
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors. # Copyright (c) Meta Platforms, Inc. and affiliates All Rights Reserved # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # ...
CompGenRep_MLRC2022-main
baseline_replication/TMCD/model/parser/inference/targets/target_grammar.py
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors. # Copyright (c) Meta Platforms, Inc. and affiliates All Rights Reserved # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # ...
CompGenRep_MLRC2022-main
baseline_replication/TMCD/model/parser/inference/targets/generate_spider_grammars.py
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors. # Copyright (c) Meta Platforms, Inc. and affiliates All Rights Reserved # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # ...
CompGenRep_MLRC2022-main
baseline_replication/TMCD/model/parser/data/tokenization_utils.py
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors. # Copyright (c) Meta Platforms, Inc. and affiliates All Rights Reserved # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # ...
CompGenRep_MLRC2022-main
baseline_replication/TMCD/model/parser/data/data_constants.py
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors. # Copyright (c) Meta Platforms, Inc. and affiliates All Rights Reserved # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # ...
CompGenRep_MLRC2022-main
baseline_replication/TMCD/model/parser/data/write_examples.py
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors. # Copyright (c) Meta Platforms, Inc. and affiliates All Rights Reserved # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # ...
CompGenRep_MLRC2022-main
baseline_replication/TMCD/model/parser/data/example_converter.py
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors. # Copyright (c) Meta Platforms, Inc. and affiliates All Rights Reserved # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # ...
CompGenRep_MLRC2022-main
baseline_replication/TMCD/model/parser/data/forest_serialization.py
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors. # Copyright (c) Meta Platforms, Inc. and affiliates All Rights Reserved # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # ...
CompGenRep_MLRC2022-main
baseline_replication/TMCD/model/parser/data/parsing_utils.py
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors. # Copyright (c) Meta Platforms, Inc. and affiliates All Rights Reserved # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # ...
CompGenRep_MLRC2022-main
baseline_replication/TMCD/model/qcfg/qcfg_rule.py
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors. # Copyright (c) Meta Platforms, Inc. and affiliates All Rights Reserved # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # ...
CompGenRep_MLRC2022-main
baseline_replication/TMCD/model/qcfg/qcfg_file.py
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors. # Copyright (c) Meta Platforms, Inc. and affiliates All Rights Reserved # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # ...
CompGenRep_MLRC2022-main
baseline_replication/TMCD/model/qcfg/qcfg_parser.py
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors. # Copyright (c) Meta Platforms, Inc. and affiliates All Rights Reserved # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # ...
CompGenRep_MLRC2022-main
baseline_replication/TMCD/model/qcfg/qcfg_parser_test.py
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors. # Copyright (c) Meta Platforms, Inc. and affiliates All Rights Reserved # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # ...
CompGenRep_MLRC2022-main
baseline_replication/TMCD/model/qcfg/compute_recall.py
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors. # Copyright (c) Meta Platforms, Inc. and affiliates All Rights Reserved # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # ...
CompGenRep_MLRC2022-main
baseline_replication/TMCD/model/induction/induction_utils.py
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors. # Copyright (c) Meta Platforms, Inc. and affiliates All Rights Reserved # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # ...
CompGenRep_MLRC2022-main
baseline_replication/TMCD/model/induction/split_utils.py
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors. # Copyright (c) Meta Platforms, Inc. and affiliates All Rights Reserved # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # ...
CompGenRep_MLRC2022-main
baseline_replication/TMCD/model/induction/rule_utils.py
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors. # Copyright (c) Meta Platforms, Inc. and affiliates All Rights Reserved # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # ...
CompGenRep_MLRC2022-main
baseline_replication/TMCD/model/induction/codelength_utils.py
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors. # Copyright (c) Meta Platforms, Inc. and affiliates All Rights Reserved # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # ...
CompGenRep_MLRC2022-main
baseline_replication/TMCD/model/induction/exact_match_utils.py
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors. # Copyright (c) Meta Platforms, Inc. and affiliates All Rights Reserved # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # ...
CompGenRep_MLRC2022-main
baseline_replication/TMCD/model/induction/induce_rules.py
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors. # Copyright (c) Meta Platforms, Inc. and affiliates All Rights Reserved # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # ...
CompGenRep_MLRC2022-main
baseline_replication/TMCD/model/induction/derivation_utils.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. """ Training script for permute MNIST experiment. """ from __future__ import print_function import argparse import os import ...
agem-main
fc_permute_mnist.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. """ Training script for split AWA experiment. """ from __future__ import print_function import argparse import os import sys ...
agem-main
conv_split_awa.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. """ Training script for split CUB experiment. """ from __future__ import print_function import argparse import os import sys ...
agem-main
conv_split_cub.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. """ Training script for split CIFAR 100 experiment. """ from __future__ import print_function import argparse import os impor...
agem-main
conv_split_cifar.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. """ Training script for split AWA experiment with hybrid learning. """ from __future__ import print_function import argparse ...
agem-main
conv_split_awa_hybrid.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. """ Training script for split CUB experiment with zero shot transfer. """ from __future__ import print_function import argpar...
agem-main
conv_split_cub_hybrid.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. import math import tensorflow as tf import numpy as np def vgg_conv_layer(x, kernel_size, out_channels, stride, var_list, pad...
agem-main
utils/vgg_utils.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. from .data_utils import construct_permute_mnist, construct_split_mnist, construct_split_cifar, construct_split_cub, construct_...
agem-main
utils/__init__.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. import math import tensorflow as tf import numpy as np def _conv(x, kernel_size, out_channels, stride, var_list, pad="SAME", ...
agem-main
utils/resnet_utils.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. """ Define utility functions for manipulating datasets """ import os import numpy as np import sys from copy import deepcopy ...
agem-main
utils/data_utils.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. """ Define some utility functions """ import numpy as np import tensorflow as tf def clone_variable_list(variable_list): ...
agem-main
utils/utils.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. """ Define some utility functions """ import numpy as np import matplotlib matplotlib.use('agg') import matplotlib.colors as ...
agem-main
utils/vis_utils.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. from .model import Model
agem-main
model/__init__.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. """ Model defintion """ import tensorflow as tf import numpy as np import mat...
agem-main
model/model.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. import os from typing import List import argparse import numpy as np import random import torch import torch.cuda import ...
atlas-main
finetune_qa.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. import os import time from collections import defaultdict import numpy as np import torch import torch.cuda import loggi...
atlas-main
train.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. import os import time from collections import defaultdict import numpy as np import torch import torch.cuda import torch...
atlas-main
evaluate.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. import argparse import json import os SUBCATEGORIES = { "humanities": [ "high_school_european_history", ...
atlas-main
evaluation_scripts/evaluate_mmlu_predictions.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. import os import json from pathlib import Path import argparse import shutil import tarfile from download_tools import m...
atlas-main
preprocessing/prepare_qa.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. import argparse import json import os from pathlib import Path from download_tools import maybe_download_file URLS = { ...
atlas-main
preprocessing/prepare_templama.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. import argparse from download_tools import get_download_path, get_s3_path, maybe_download_file BASE_URL = "https://dl.f...
atlas-main
preprocessing/download_index.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. import os import wget BASE_URL = "https://dl.fbaipublicfiles.com/atlas" def maybe_download_file(source, target): ...
atlas-main
preprocessing/download_tools.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. import os import json from pathlib import Path import argparse from download_tools import maybe_download_file fever_64s...
atlas-main
preprocessing/prepare_fever.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. import argparse from download_tools import get_download_path, get_s3_path, maybe_download_file BASE_URL = "https://dl.f...
atlas-main
preprocessing/download_model.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. import argparse import csv import json import os import random import tarfile from pathlib import Path from download_too...
atlas-main
preprocessing/prepare_mmlu.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. import argparse from download_tools import get_download_path, get_s3_path, maybe_download_file AVAILABLE_CORPORA = { ...
atlas-main
preprocessing/download_corpus.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. import argparse import logging from pathlib import Path logger = logging.getLogger(__name__) class Options: def __...
atlas-main
src/options.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. import logging import math import os import pickle from typing import Optional, Set, Tuple, Union, Any import faiss import...
atlas-main
src/index.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. import datetime import os import signal import socket import subprocess import sys from logging import getLogger import ...
atlas-main
src/slurm.py