python_code stringlengths 0 4.04M | repo_name stringlengths 7 58 | file_path stringlengths 5 147 |
|---|---|---|
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
# NB: IMPORT utils FIRST SO THAT MATPLOTLIB DOESN'T GET MESSED UP!!!
from utils import (
generate_data, save_data_plot, OracleDiscriminator
)
from experiments.tfs.ima... | tanda-master | experiments/synthetic/train.py |
tanda-master | experiments/cifar10/__init__.py | |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import numpy as np
import os
import six
from functools import partial
from six.moves import cPickle
from skimage import img_as_float
def load_cifar10_batch(fpath, one_... | tanda-master | experiments/cifar10/dataset.py |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from dataset import load_cifar10_data
from experiments.train_scripts import flags, select_fold, train
from experiments.tfs.image import *
from functools import partial
fr... | tanda-master | experiments/cifar10/train.py |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import numpy as np
import tensorflow as tf
from .discriminator import DCNN
ADAM = tf.train.AdamOptimizer
SGD = tf.train.GradientDescentOptimizer
def get_mse_loss(ms... | tanda-master | tanda/tan.py |
tanda-master | tanda/__init__.py | |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import copy
import numpy as np
from skimage.util import crop, pad
class Transformer(object):
def __init__(self, tfs):
"""Transforms data points given a se... | tanda-master | tanda/transformer.py |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import tensorflow as tf
import tensorflow.contrib.rnn as rnn
from tensorflow.python.framework import ops
from tensorflow.python.ops.rnn_cell_impl import RNNCell
def me... | tanda-master | tanda/generator/rnn_cell_util.py |
from .generator import GRUGenerator, LSTMGenerator, MeanFieldGenerator
| tanda-master | tanda/generator/__init__.py |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import tensorflow as tf
import tensorflow.contrib.rnn as rnn
from .rnn_cell_util import (
GeneratorCellBuilder, GeneratorRNNCellBuilder, mean_field_cell,
OutputR... | tanda-master | tanda/generator/generator.py |
# Copyright 2016 The TensorFlow Authors. 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | tanda-master | tanda/discriminator/resnet_cifar.py |
from .dcnn import DCNN
from .discriminator import Discriminator
from .resnet_cifar import ResNetDefault
from .simple import SimpleDiscriminator
| tanda-master | tanda/discriminator/__init__.py |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import numpy as np
import tensorflow as tf
import tensorflow.contrib.rnn as rnn
from .discriminator import Discriminator
from functools import partial
D_H = 2
D_W = 2
... | tanda-master | tanda/discriminator/dcnn.py |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import tensorflow as tf
from .discriminator import Discriminator
def nnet(input_tensor, n_hidden=4):
h = tf.layers.dense(input_tensor, n_hidden,
activation... | tanda-master | tanda/discriminator/simple.py |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import numpy as np
import tensorflow as tf
ADAM = tf.train.AdamOptimizer
class Discriminator(object):
"""
Parent class for discriminator in TAN module
Als... | tanda-master | tanda/discriminator/discriminator.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 matplotlib.pyplot as plt
from datasets import transformations
import torch
import numpy as np
def plot_x2_reconstruc... | Addressing-the-Topological-Defects-of-Disentanglement-main | plot.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.
"""
"""
Launches experiments locally or on the cluster
python run_experiments.py [name] --cluster
OPTIONS:
python run_experime... | Addressing-the-Topological-Defects-of-Disentanglement-main | run_experiments_real.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 torch
from torch import nn
from collections import OrderedDict
from abc import ABC
class ResNetExplorer(nn.Module):
... | Addressing-the-Topological-Defects-of-Disentanglement-main | models.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 torch
import numpy as np
import functools
import pdb
class ShiftOperator:
"""Performs discrete shift based on n_... | Addressing-the-Topological-Defects-of-Disentanglement-main | latent_operators.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.
"""
| Addressing-the-Topological-Defects-of-Disentanglement-main | __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 torch
import numpy as np
import random
import matplotlib
import matplotlib.pyplot as plt
import models
import latent_... | Addressing-the-Topological-Defects-of-Disentanglement-main | weakly_complex_shift_autoencoder.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 copy
import torch
import json
import os
import random
import numpy as np
import models
import latent_operators
import ... | Addressing-the-Topological-Defects-of-Disentanglement-main | autoencoder.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.
"""
"""Implements CCI VAE
https://arxiv.org/abs/1804.03599
"""
import torch
import os
import numpy as np
import models
import js... | Addressing-the-Topological-Defects-of-Disentanglement-main | cci_variational_autoencoder.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 torch
import numpy as np
import random
import matplotlib
import matplotlib.pyplot as plt
import models
import latent_o... | Addressing-the-Topological-Defects-of-Disentanglement-main | complex_shift_autoencoder.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.
---
Saves model/plots for best validation MSE
"""
import math
import numpy as np
import os
from distutils.dir_util import copy_... | Addressing-the-Topological-Defects-of-Disentanglement-main | save_best_validation.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.
"""
"""
Transformations applied to the input images
"""
import torch
import itertools
import numpy as np
import skimage.transfor... | Addressing-the-Topological-Defects-of-Disentanglement-main | datasets/transformations.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 torch
from torch.utils.data import Dataset
from torchvision import transforms
from sklearn.model_selection import Stra... | Addressing-the-Topological-Defects-of-Disentanglement-main | datasets/datasets.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.
"""
| Addressing-the-Topological-Defects-of-Disentanglement-main | datasets/__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.
"""
"""Script demonstrating drawing of anti-aliased lines using Xiaolin Wu's line
algorithm
usage: python xiaolinwu.py [output-... | Addressing-the-Topological-Defects-of-Disentanglement-main | datasets/xiaolinwu.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 torch.utils.data import Dataset, DataLoader
import numpy as np
from PIL import Image
from .xiaolinwu import draw_line
... | Addressing-the-Topological-Defects-of-Disentanglement-main | datasets/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.
"""
import pytest
from datasets import datasets
from cci_variational_autoencoder import CCIVariationalAutoEncoder
BATCH_SIZE = 1... | Addressing-the-Topological-Defects-of-Disentanglement-main | tests/test_cci_vae.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 torch
import math
from datasets import transformations
from datasets import datasets
class TestSimpleShapes:
def... | Addressing-the-Topological-Defects-of-Disentanglement-main | tests/test_datasets.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 pytest
from datasets import datasets
from autoencoder import AutoEncoder
class TestAutoencoder:
@pytest.fixture(... | Addressing-the-Topological-Defects-of-Disentanglement-main | tests/test_autoencoder.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.
"""
| Addressing-the-Topological-Defects-of-Disentanglement-main | complex_shift_operator/__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 argparse
import torch
import sys
sys.path.append("..")
from datasets import datasets
from weakly_complex_shift_autoen... | Addressing-the-Topological-Defects-of-Disentanglement-main | complex_shift_operator/__main__.py |
# Copyright (c) 2015-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the CC-by-NC license found in the
# LICENSE file in the root directory of this source tree.
#
import torch
import torch.nn as nn
from functools import partial
from convit import VisionTransformer
from timm.model... | convit-main | models.py |
# Copyright (c) 2015-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the CC-by-NC license found in the
# LICENSE file in the root directory of this source tree.
#
"""
A script to run multinode training with submitit.
"""
import argparse
import os
import uuid
from pathlib import P... | convit-main | run_with_submitit.py |
# Copyright (c) 2015-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the CC-by-NC license found in the
# LICENSE file in the root directory of this source tree.
#
import os
import json
import random
from torchvision import datasets, transforms
from torchvision.datasets.folder imp... | convit-main | datasets.py |
# Copyright (c) 2015-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the CC-by-NC license found in the
# LICENSE file in the root directory of this source tree.
#
"""
Train and eval functions used in main.py
"""
import math
import sys
from typing import Iterable, Optional
import ... | convit-main | engine.py |
# Copyright (c) 2015-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the CC-by-NC license found in the
# LICENSE file in the root directory of this source tree.
#
"""
Misc functions, including distributed helpers.
Mostly copy-paste from torchvision references.
"""
import io
impor... | convit-main | utils.py |
# Copyright (c) 2015-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the CC-by-NC license found in the
# LICENSE file in the root directory of this source tree.
#
import argparse
import datetime
import numpy as np
import time
import torch
import torch.backends.cudnn as cudnn
impor... | convit-main | main.py |
# Copyright (c) 2015-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the CC-by-NC license found in the
# LICENSE file in the root directory of this source tree.
#
import torch
import torch.distributed as dist
import math
class RASampler(torch.utils.data.Sampler):
"""Sampler ... | convit-main | samplers.py |
# Copyright (c) 2015-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the CC-by-NC license found in the
# LICENSE file in the root directory of this source tree.
#
'''These modules are adapted from those of timm, see
https://github.com/rwightman/pytorch-image-models/blob/master/tim... | convit-main | convit.py |
# Copyright (c) Meta Platforms, Inc. and affiliates. All rights reserved.
import os
import argparse
# run each job single-threaded, paralellize using pathos
os.environ["OMP_NUM_THREADS"] = "1"
os.environ["MKL_NUM_THREADS"] = "1"
os.environ["NUMEXPR_NUM_THREADS"] = "1"
# multi-socket friendly args
os.environ["KMP_AFF... | bernoulli_lse-main | init_sensitivity_study.py |
# Copyright (c) Meta Platforms, Inc. and affiliates. All rights reserved.
import os
import argparse
from copy import deepcopy
from pathlib import Path
global_seed = 1000
n_reps = 20
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="Gentime Benchmarks")
parser.add_argument("--nproc",... | bernoulli_lse-main | gentime_bench.py |
# Copyright (c) Meta Platforms, Inc. and affiliates. All rights reserved.
import numpy as np
import torch
from aepsych.benchmark.test_functions import (
modified_hartmann6,
discrim_highdim,
novel_discrimination_testfun,
)
from aepsych.models import GPClassificationModel
from aepsych.benchmark.problem im... | bernoulli_lse-main | problems.py |
# Copyright (c) Meta Platforms, Inc. and affiliates. All rights reserved.
import os
import argparse
# run each job single-threaded, paralellize using pathos
os.environ["OMP_NUM_THREADS"] = "1"
os.environ["MKL_NUM_THREADS"] = "1"
os.environ["NUMEXPR_NUM_THREADS"] = "1"
# multi-socket friendly args
os.environ["KMP_AFF... | bernoulli_lse-main | run_experiments.py |
# Copyright (c) Meta Platforms, Inc. and affiliates. All rights reserved.
import os
import argparse
# run each job single-threaded, paralellize using pathos
os.environ["OMP_NUM_THREADS"] = "1"
os.environ["MKL_NUM_THREADS"] = "1"
os.environ["NUMEXPR_NUM_THREADS"] = "1"
# multi-socket friendly args
os.environ["KMP_AFF... | bernoulli_lse-main | thresh_sensitivity_study.py |
# Copyright (c) Meta Platforms, Inc. and affiliates. All rights reserved.
from pathlib import Path
import pandas as pd
import numpy as np
from plot_config import *
run_data = list(Path("../data/gentime_bench/").glob("*out.csv"))
import re
def make_figure():
alld = []
for f in run_data:
dlocal = pd... | bernoulli_lse-main | figures/plot_gentimes.py |
# Copyright (c) Meta Platforms, Inc. and affiliates. All rights reserved.
from matplotlib import pyplot as plt
from matplotlib.lines import Line2D
from matplotlib import rc
import matplotlib
rc('font', family='serif', style='normal', variant='normal', weight='normal', stretch='normal', size=8)
matplotlib.rcParams['ps.... | bernoulli_lse-main | figures/plot_config.py |
# Copyright (c) Meta Platforms, Inc. and affiliates. All rights reserved.
import numpy as np
from contrast_discrimination.helpers import HalfGrating
from psychopy import visual, monitors
screen = monitors.Monitor("testMonitor", gamma=1)
win = visual.Window(
allowGUI=True,
units="deg",
monitor=screen,
... | bernoulli_lse-main | figures/make_stim_plots.py |
# Copyright (c) Meta Platforms, Inc. and affiliates. All rights reserved.
import numpy as np
import pandas as pd
from copy import deepcopy
import sys
sys.path.append("..")
from plot_config import *
from plot_experiment_results import compile_results, run_data
def make_classerr_figure():
res, itrs = compile_re... | bernoulli_lse-main | figures/plot_supplement_experiment_results.py |
# Copyright (c) Meta Platforms, Inc. and affiliates. All rights reserved.
| bernoulli_lse-main | figures/__init__.py |
# Copyright (c) Meta Platforms, Inc. and affiliates. All rights reserved.
from copy import deepcopy
import numpy as np
import torch
from botorch.utils.sampling import draw_sobol_samples
import sys
sys.path.append('..')
from plot_config import *
from problems import DiscrimLowDim
from aepsych.models.gp_classificat... | bernoulli_lse-main | figures/plot_acquisition.py |
# Copyright (c) Meta Platforms, Inc. and affiliates. All rights reserved.
from copy import deepcopy
import numpy as np
import torch
from botorch.utils.sampling import draw_sobol_samples
import sys
sys.path.append('..')
from plot_config import *
from problems import DiscrimLowDim
from aepsych.models.gp_classificat... | bernoulli_lse-main | figures/plot_posteriors.py |
# Copyright (c) Meta Platforms, Inc. and affiliates. All rights reserved.
import numpy as np
import pandas as pd
from pathlib import Path
import matplotlib.pyplot as plt
import sys
sys.path.append("..")
from plot_config import *
# need cameraready for original thresh
rundata = list(Path("../data/cameraready/").glo... | bernoulli_lse-main | figures/plot_thresh_sensitivity_results.py |
# Copyright (c) Meta Platforms, Inc. and affiliates. All rights reserved.
import pickle
import matplotlib.pyplot as plt
import numpy as np
import sys
sys.path.append('..')
from plot_config import *
from plot_experiment_results import compile_results, run_data
def make_figure():
res, itrs = compile_results(r... | bernoulli_lse-main | figures/plot_edge_sampling.py |
# Copyright (c) Meta Platforms, Inc. and affiliates. All rights reserved.
import numpy as np
import pandas as pd
import sys
from pathlib import Path
import matplotlib.pyplot as plt
sys.path.append('..')
from plot_config import *
import re
run_data = list(Path("../data/cameraready/").glob("*out.csv"))
def compile... | bernoulli_lse-main | figures/plot_experiment_results.py |
# Copyright (c) Meta Platforms, Inc. and affiliates. All rights reserved.
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import sys
sys.path.append("..")
from pathlib import Path
from plot_config import *
# need cameraready for init=10
rundata = list(Path("../data/cameraready/").glob("*out.c... | bernoulli_lse-main | figures/plot_init_sensitivity_results.py |
# Copyright (c) Meta Platforms, Inc. and affiliates. All rights reserved.
from datetime import datetime
"""
Develop an experiment that measures and combination of the following features:
spatial_frequency
temporal_frequency
mean_luminance
eccentricity
field_angle
orientation
"""
constants = dict(
savefolder=".... | bernoulli_lse-main | human_data_collection/config.py |
# Copyright (c) Meta Platforms, Inc. and affiliates. All rights reserved.
import numpy as np
import torch
from aepsych.server import AEPsychServer
from psychopy import core, data, event, gui, monitors, visual
from contrast_discrimination import config
from contrast_discrimination.helpers import HalfGrating
class Se... | bernoulli_lse-main | human_data_collection/experiment.py |
# Copyright (c) Meta Platforms, Inc. and affiliates. All rights reserved.
import numpy as np
from psychopy.visual.image import ImageStim
from psychopy import core, event
import pyglet
pyglet.options["debug_gl"] = False
GL = pyglet.gl
def polar_to_cartesian(r, theta):
z = r * np.exp(1j * np.radians(theta))
... | bernoulli_lse-main | human_data_collection/helpers.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
from data import NL2BashDataset
from collectors import CollectorWithInfo
import argparse
if __name__ == "__main__":
dataset = NL2BashDataset()
parser = argparse.ArgumentParser()
parser.add_argument("--num_seeds", type=int, default=25)
parser.add_ar... | coder_reviewer_reranking-main | collect_nl2bash.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
from pathlib import Path
import os
from glob import glob
from argparse import ArgumentParser
import html
import json
from utils import *
from tqdm import tqdm, trange
from data import HumanEvalDataset, rindex, extract_docstring
from functools import partial
from pym... | coder_reviewer_reranking-main | zeroshot_reviewer.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
import argparse
import copy
import json
import openai
import os
import pickle
import random
import signal
import time
from glob import glob
from nltk.translate.bleu_score import sentence_bleu
from tqdm import tqdm, trange
import re
codex_name_mapping = {
"codex... | coder_reviewer_reranking-main | collectors.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
from data import SpiderDataset
from collectors import CollectorWithInfo
import argparse
if __name__ == "__main__":
dataset = SpiderDataset()
parser = argparse.ArgumentParser()
parser.add_argument("--num_seeds", type=int, default=25)
parser.add_argu... | coder_reviewer_reranking-main | collect_spider.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
import bashlex
import json
import os
import pickle
import regex
import signal
import subprocess
import tempfile
import threading
from datasets import load_metric
from glob import glob
from nltk.translate.bleu_score import sentence_bleu
from tqdm import tqdm
from dat... | coder_reviewer_reranking-main | execution.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
import argparse
import data
from collectors import CollectorWithInfo
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument(
"--info-mode",
type=str,
default="assertion",
choices=["function_name",... | coder_reviewer_reranking-main | collect_mbpp.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
import shutil
import torch
from pathlib import Path
import os
from glob import glob
from argparse import ArgumentParser
from tqdm import tqdm, trange
import torch.distributed as dist
from execution import (
execute_humaneval_folder_one,
execute_mbpp_google_f... | coder_reviewer_reranking-main | multi_exec.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
from tqdm import tqdm
import os
import sqlite3
import pickle as pkl
# CONSTANT
db_dir = "./dataset/spider/database/"
# preloading spider data to reduce io
from dataset.spider_official.evaluation import (
build_foreign_key_map_from_json,
build_valid_col_unit... | coder_reviewer_reranking-main | exec_spider_gold.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
################################
# 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: (unit_op, col_unit1,... | coder_reviewer_reranking-main | process_sql.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
################################
# 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, val1, val2)
# condi... | coder_reviewer_reranking-main | utils_sql.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
from time import sleep
import os
import random
import openai
import re
import json
def safe_codex_call(
args, api_text, temperature=None, stop=None, echo=False, max_tokens=256, api_i=0
):
temperature = temperature if temperature else args.temperature
w... | coder_reviewer_reranking-main | utils.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
import keyword, sys
from pyminifier import analyze
from pyminifier.minification import remove_comments_and_docstrings, remove_blank_lines
import re
RESERVED_WORDS = keyword.kwlist + analyze.builtins
def clean_comment(code):
code = remove_comments_and_docstrin... | coder_reviewer_reranking-main | pyminifier_canonicalize.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
import os
import tempfile
from datasets import load_metric
from tqdm import tqdm
import pickle as pkl
from data import MBPPGoogleDataset
from execution import Command
import sys
from utils import time_limit
""" dataset keys: src, trg_prediction, reference """
de... | coder_reviewer_reranking-main | evaluate.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
import bashlex
import collections
import json
import pickle
import numpy as np
import os
import random
from glob import glob
from nltk.translate.bleu_score import sentence_bleu
from evaluate import (
evaluate_charbleu,
evaluate_google_mbpp,
evaluate_spid... | coder_reviewer_reranking-main | sample_selectors.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
from pathlib import Path
import os
from glob import glob
from argparse import ArgumentParser
import html
import json
from utils import *
from tqdm import tqdm, trange
from functools import partial
from utils import write_jsonl, parse_prompt, make_new_context
from py... | coder_reviewer_reranking-main | fewshot_reviewer.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
import argparse
import data
from collectors import CollectorWithInfo
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument(
"--info-mode",
type=str,
default="assertion",
choices=["function_name",... | coder_reviewer_reranking-main | collect_zeroshot.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
import collections
import json
import os
import regex
class NL2BashDataset(object):
def __init__(self, path="dataset/nl2bash/data/bash"):
self.data = collections.defaultdict()
for split in ["train", "dev", "test"]:
nls = [x.strip() ... | coder_reviewer_reranking-main | data.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 torchvision import datasets, transforms
from torch.utils.data.sampler import RandomSampler
import torchvision
import t... | deep-variance-reduction-main | cifar_wrapper.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 __future__ import print_function
import argparse
import pickle
import os
import time
from timeit import default_timer ... | deep-variance-reduction-main | run.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 torch.optim.optimizer import Optimizer, required
import torch
import pdb
import pickle
import math
import logging
clas... | deep-variance-reduction-main | scsg.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 torch.optim.optimizer import Optimizer, required
import torch
import pdb
import pickle
import math
import logging
clas... | deep-variance-reduction-main | recompute_svrg.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 torch
import torch.multiprocessing as multiprocessing
#from torch._C import _update_worker_pids, \
# _remove_work... | deep-variance-reduction-main | UpdatedDataLoaderMult.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 __future__ import print_function
import argparse
import pickle
import os
from timeit import default_timer as timer
imp... | deep-variance-reduction-main | diagnostics.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 torchvision import datasets, transforms
from torch.utils.data.sampler import RandomSampler
import torchvision
import t... | deep-variance-reduction-main | imagenet_wrapper.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 torch
import torch.nn as nn
import torch.nn.functional as F
import math
import pdb
__all__ = ['densenet']
from tor... | deep-variance-reduction-main | densenet.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 __future__ import print_function
import argparse
import pickle
import os
from timeit import default_timer as timer
imp... | deep-variance-reduction-main | run_vr.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 torch
import pdb
import os
class VRSamplerIter(object):
def __init__(self, sampler):
self.sampler = sam... | deep-variance-reduction-main | vr_sampler.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 torch.optim.optimizer import Optimizer, required
import torch
import pdb
import pickle
import math
import logging
impor... | deep-variance-reduction-main | torch_svrg.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 torch.optim as optim
import torch_svrg
import recompute_svrg
import scsg
def optimizer(model, args):
print("Usin... | deep-variance-reduction-main | optimizers.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 torch
import torch.nn as nn
__all__ = ['ResNet', 'resnet18', 'resnet34', 'resnet50', 'resnet101',
'resnet... | deep-variance-reduction-main | resnext.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 os
import torch
import torch.nn as nn
import torch.nn.functional as F
from torchvision import datasets, transforms
fr... | deep-variance-reduction-main | problems.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 numbers
import math
import random
from PIL import Image, ImageOps, ImageEnhance
import numpy as np
import numbers
im... | deep-variance-reduction-main | caching_transforms.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.
'''ResNet in PyTorch.
from
https://github.com/kuangliu/pytorch-cifar/blob/master/models/resnet.py
based on
https://github.co... | deep-variance-reduction-main | resnet.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 torch
import torch.multiprocessing as multiprocessing
from torch.utils.data.sampler import SequentialSampler, RandomS... | deep-variance-reduction-main | UpdatedDataLoader.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 math import atan2,degrees
import numpy as np
#Label line with line2D label data
def labelLine(line,x,label=None,align=... | deep-variance-reduction-main | reproduce/label_lines.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 os
import sys
import run
methods = ["sgd", "recompute_svrg", "scsg"]
try:
pindex = int(sys.argv[1])
seed = i... | deep-variance-reduction-main | reproduce/reproduce_test_error_imagenet_next.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 os
import sys
import run
archs = ['default', 'densenet-40-36']
try:
pindex = int(sys.argv[1])
print(f"probl... | deep-variance-reduction-main | reproduce/reproduce_iterate_distance.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 os
import sys
import run
vr_froms = [1, 21, 41, 61, 81, 1234]
try:
pindex = int(sys.argv[1])
print(f"proble... | deep-variance-reduction-main | reproduce/reproduce_finetuning.py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.