python_code stringlengths 0 4.04M | repo_name stringlengths 8 58 | file_path stringlengths 5 147 |
|---|---|---|
# Copyright (c) 2015-present, Meta Platforms, Inc. and affiliates.
# All rights reserved.
import itertools
import logging
import os
import os.path as osp
from os.path import join as osj
from time import time
import hydra
import numpy as np
import pytorch_lightning as pl
import torch
import wandb
from omegaconf import ... | cycle_gan_for_complementary_item_recommendations-main | src/main_inference_pcomp.py |
# Copyright (c) 2015-present, Meta Platforms, Inc. and affiliates.
# All rights reserved.
import logging
import time
from os.path import join as osj
from time import time
from itertools import chain
import numpy as np
import pytorch_lightning as pl
import torch
import wandb
from sklearn.metrics import ndcg_score
from ... | cycle_gan_for_complementary_item_recommendations-main | src/lit/lit_utils.py |
# Copyright (c) 2015-present, Meta Platforms, Inc. and affiliates.
# All rights reserved.
import logging
import pytorch_lightning as pl
import torch
from torch import nn, optim
logger = logging.getLogger(__name__)
class LitImgClassifier(pl.LightningModule):
def __init__(self, input_dim, num_classes, cfg):
... | cycle_gan_for_complementary_item_recommendations-main | src/lit/lit_img_classifier.py |
# Copyright (c) 2015-present, Meta Platforms, Inc. and affiliates.
# All rights reserved.
import logging
import time
from os.path import join as osj
from time import time
import numpy as np
import pytorch_lightning as pl
import torch
import wandb
from sklearn.metrics import ndcg_score
from torch import nn, optim
from ... | cycle_gan_for_complementary_item_recommendations-main | src/lit/lit_pcomp.py |
# Copyright (c) 2015-present, Meta Platforms, Inc. and affiliates.
# All rights reserved.
import logging
import numpy as np
import torch
import pandas as pd
from os.path import join as osj
logger = logging.getLogger(__name__)
def generate_test_set_hot_labels(
asin_src_test: np.ndarray,
category_pos_test: np... | cycle_gan_for_complementary_item_recommendations-main | src/lit/eval_utils.py |
# Copyright (c) 2015-present, Meta Platforms, Inc. and affiliates.
# All rights reserved.
import logging
import time
from os.path import join as osj
from time import time
import numpy as np
import pytorch_lightning as pl
import torch
import wandb
from sklearn.metrics import ndcg_score
from torch import nn, optim
from... | cycle_gan_for_complementary_item_recommendations-main | src/lit/lit_dcf.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
class FastGradConv2dFunction(torch.autograd.Function)... | certified-removal-main | fast_grad_conv.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 math
import time
import numpy as np
import torch
import torch... | certified-removal-main | test_removal.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
class Extractor(nn.Module):
def __init__(self, nu... | certified-removal-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 torchvision
import torchvision.transforms as transforms
import numpy as np
import torch.nn as nn
impor... | certified-removal-main | train_svhn.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
from fast_grad_conv import FastGradConv2d
class FastG... | certified-removal-main | fast_grad_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 math
import os
import sys
from fast_grad.goodfellow_backprop import goodfellow_backprop
from torchvisi... | certified-removal-main | 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 torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import numpy as np
from tra... | certified-removal-main | test_func.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.functional as F
import math
from utils import per_example_gradient, clip_and_sum_gradients, a... | certified-removal-main | train_func.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.functional as F
import pdb #debugging
from goodfellow_backprop import goodfellow_backprop
d... | certified-removal-main | fast_grad/gradient_funcs.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 #debugging
def goodfellow_backprop(activations, linearGrads):
grads = []
for i in range(len(lin... | certified-removal-main | fast_grad/goodfellow_backprop.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 pdb
import helpers
from gradient_funcs import full, goodfellow, naive
def runWith(N, D, L):
X, y, model = helpers... | certified-removal-main | fast_grad/main.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 time import time
from torch.nn.utils import parameters_to_vector, vector_to_parameters
import cProfile, ... | certified-removal-main | fast_grad/helpers.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 sys
import scip_solver as scip
import xpress_solver as xp
# Wrap is the various MILP solvers including SCIP... | CL-LNS-main | ilp_solver.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.
#
from numpy.lib.utils import byte_bounds
class Solution:
def __init__(self, model, scip_solution, obj_value):
... | CL-LNS-main | ilp_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 xpress as xp
# Wrap is the xpress solver (https://pypi.org/project/xpress/, doc available at
# https://www.f... | CL-LNS-main | xpress_solver.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 os.path
import tarfile
import zipfile
import ecole
import geco
import geco.generator
import glob
imp... | CL-LNS-main | instance_loader.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 multiprocessing
import os
import re
import subprocess
import sys
import sysconfig
from distutils.version impo... | CL-LNS-main | setup.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 submitit
import os
import argparse
from graph_datasets.bipartite_graph_loader import BipartiteGraphLoader
impo... | CL-LNS-main | train_neural_LNS.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.
#
from graph_datasets.bipartite_graph import *
from graph_datasets.bipartite_graph_dataset import BipartiteGraphDataset... | CL-LNS-main | LNS.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 pyscipopt as scip
# Wrap is the scip solver under a common API
class ScipSolver:
def __init__(self, time... | CL-LNS-main | scip_solver.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 torch_geometric
import torch
import torch.nn.init as init
#from neural_nets import prenorm
# GINConv network... | CL-LNS-main | neural_nets/gin_convolution.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 torch_geometric
import torch
import torch.nn.init as init
from neural_nets import prenorm
# GATConvolution... | CL-LNS-main | neural_nets/gat_convolution.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 torch
class LogScoreLoss(torch.nn.Module):
"""
Loss function to weight sample loss by confidence in ... | CL-LNS-main | neural_nets/losses.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 torch
import torch.nn.init as init
from neural_nets import gat_convolution
from neural_nets import gin_convol... | CL-LNS-main | neural_nets/gnn_policy.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 torch
class PrenormOld(torch.nn.Module):
def __init__(self, num_features, shift=True, scale=True, eps=1e... | CL-LNS-main | neural_nets/prenorm.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 torch_geometric
import torch
import torch.nn.init as init
from neural_nets import prenorm
# Implements the ... | CL-LNS-main | neural_nets/gasse_convolution.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.
#
| CL-LNS-main | ml4co/__init__.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 hypothesis
import hypothesis.strategies as st
import unittest
import torch
import torch.nn.functional as F
f... | CL-LNS-main | ml4co/ops/split_and_pad_test.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 hypothesis
import hypothesis.strategies as st
import unittest
import torch
from ml4co.ops.prenorm import Pre... | CL-LNS-main | ml4co/ops/prenorm_test.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.
#
| CL-LNS-main | ml4co/ops/__init__.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 torch
import ml4co
torch.ops.load_library(
os.path.join(os.path.dirname(os.path.dirname(ml4co.... | CL-LNS-main | ml4co/ops/split_and_pad.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 torch
import ml4co
torch.ops.load_library(
os.path.join(os.path.dirname(os.path.dirname(ml4co.... | CL-LNS-main | ml4co/ops/prenorm.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 ecole
import ilp_model
import numpy as np
import torch
from typing import Any, Callable, Optional, Tuple
im... | CL-LNS-main | ml4co/rl/env/ecole_wrapper.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 unittest
import numpy as np
import string
import random
import os
import sys
import graph_datasets.evaluation... | CL-LNS-main | graph_datasets/evaluation_data_test.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 sqlite3
import pickle
from pathlib import Path
import hashlib
import string
import random
import base64
import... | CL-LNS-main | graph_datasets/solved_milp_dataset.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 ecole
import torch
import numpy as np
import math
import time
def augment_variable_features_with_dynamic_ones... | CL-LNS-main | graph_datasets/bipartite_graph_observations.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 ecole.typing
class DualBound(ecole.typing.InformationFunction):
def __init__(self):
super().__in... | CL-LNS-main | graph_datasets/informations.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 unittest
import torch
import random
import string
import os
import graph_datasets.bipartite_graph as bg
impor... | CL-LNS-main | graph_datasets/bipartite_graph_loader_test.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.
#
from pyscipopt import Eventhdlr
from pyscipopt import SCIP_EVENTTYPE
class DualBoundEventHandler(Eventhdlr):
def... | CL-LNS-main | graph_datasets/event_handlers.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 sqlite3
from pathlib import Path
import hashlib
import string
import random
import functools
from collections ... | CL-LNS-main | graph_datasets/evaluation_data.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 torch_geometric
import sqlite3
import pickle
import base64
import random
from pathlib import Path
from graph_d... | CL-LNS-main | graph_datasets/bipartite_graph_dataset.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 unittest
import ecole
import torch
import torch_geometric
import numpy as np
import pyscipopt
import graph_dat... | CL-LNS-main | graph_datasets/featurization_test.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.
#
| CL-LNS-main | graph_datasets/__init__.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 graph_datasets.bipartite_graph_dataset as bgd
import torch_geometric
#import dgl
import random
import torch
... | CL-LNS-main | graph_datasets/bipartite_graph_loader.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 torch_geometric
import torch
import numpy as np
import networkx as nx
class BipartiteGraph(torch_geometric.d... | CL-LNS-main | graph_datasets/bipartite_graph.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 ecole.typing
import competition.common.rewards as competition_rewards
# Returns the relative improvement in ... | CL-LNS-main | graph_datasets/step_rewards.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 unittest
import ilp_solver
import random
import string
from graph_datasets.solved_milp_dataset import SolvedMi... | CL-LNS-main | graph_datasets/solved_milp_dataset_test.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 unittest
import ecole
import torch
import torch_geometric
import numpy as np
import string
import random
impor... | CL-LNS-main | graph_datasets/bipartite_graph_dataset_test.py |
# coding=utf-8
# Copyright (c) Facebook, Inc. and its affiliates.
# Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team.
# Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in ... | accentor-main | run_language_modeling.py |
# Copyright (c) Facebook, Inc. and its affiliates.
import json
import random
import argparse
import os
def clean(x):
return x.replace("\n", "").replace("\r", "").replace("\t", " ").strip()
parser = argparse.ArgumentParser()
parser.add_argument("--data", default="./accentor-sgd/", type=str, required=False, help="... | accentor-main | gen_parlai_data.py |
# Copyright (c) Facebook, Inc. and its affiliates.
import json
import os
from utils import bleuscorer
import argparse
def main():
parser = argparse.ArgumentParser()
parser.add_argument("--inference", default="dev.inference.gpt2_10epoch_1e-3_fp16.json", type=str, required=False, help='inference file')
pars... | accentor-main | gen_predict.py |
# Copyright (c) Facebook, Inc. and its affiliates.
import json
import os
import copy
import random
import argparse
def main():
parser = argparse.ArgumentParser()
parser.add_argument("--all", default=False, type=bool, required=False, help="use all dialogues rather than only augmented dialogues")
parser.add... | accentor-main | gen_delex.py |
# Copyright (c) Facebook, Inc. and its affiliates.
from transformers import GPT2LMHeadModel, GPT2Tokenizer
import torch
import argparse
import numpy as np
import json
from tqdm import tqdm
def set_seed(args):
np.random.seed(args.seed)
torch.manual_seed(args.seed)
if args.n_gpu > 0:
torch.cuda.manu... | accentor-main | run_generation.py |
# Copyright (c) Facebook, Inc. and its affiliates.
import json
import random
import argparse
import os
parser = argparse.ArgumentParser()
parser.add_argument("--data", default="./simpletod/", type=str, required=False, help="path to delexed & augmented SGD")
args = parser.parse_args()
def clean(x):
return x.repla... | accentor-main | gen_arranger_input.py |
# Copyright (c) Facebook, Inc. and its affiliates.
import nltk
def bleuscorer(hyps, refs):
#print(hyps, refs)
bleu = []
for hyp, ref in zip(hyps, refs):
hyp = hyp.split()
ref = [a.split() for a in ref]
#hyp = nltk.word_tokenize(hyp)
#ref = [nltk.word_tokenize(a) for a in re... | accentor-main | utils.py |
# coding=utf-8
# Copyright (c) Facebook, Inc. and its affiliates.
# Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team.
# Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in ... | accentor-main | run_multiple_choice.py |
# coding=utf-8
# Copyright (c) Facebook, Inc. and its affiliates.
# Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team.
# Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in ... | accentor-main | utils_multiple_choice.py |
# Copyright (c) Facebook, Inc. and its affiliates.
import json
for fns in [["./lm.input.dev.eval.txt", "./lm.output.dev.cc.txt", "./dev.inference.gpt2_10epoch_1e-3_fp16.json", "lm.input.dev.eval.ff.txt"],
["./lm.input.test.eval.txt", "./lm.output.test.cc.txt", "./test.inference.gpt2_10epoch_1e-3_fp16.json... | accentor-main | gen_rewriter_data.py |
# Copyright (c) Facebook, Inc. and its affiliates.
import json
with open("./acc_arranger_roberta_base_3epoch/is_test_true_eval_logits.txt", "r") as f:
model_outputs = f.read().strip().split("\n")
for i in range(len(model_outputs)):
model_outputs[i] = model_outputs[i].split()
for j in range(len... | accentor-main | gen_arranger_output.py |
# Copyright (c) Facebook, Inc. and its affiliates.
import json
import argparse
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument("--source", default="./MultiWOZ_2.1/data.json", type=str, required=False, help="Path to the MultiWOZ dataset.")
args = parser.parse_args()
... | accentor-main | v1.0/accentor-multiwoz.py |
# Copyright (c) Facebook, Inc. and its affiliates.
import json
import argparse
import os
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument("--source", default="./dstc8-schema-guided-dialogue", type=str, required=False, help="Path to the SGD dataset.")
parser.add_argument("-... | accentor-main | v1.0/accentor-sgd.py |
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
# Implementation adapted from Slimmable - https://github.com/JiahuiYu/slimmable_networks
import torch
class CrossEntropyLossSoft(torch.nn.modules.loss._Loss):
""" inplace distillation for image classification """
def forward(self, output, ... | AlphaNet-main | loss_ops.py |
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import argparse
import random
import torch
import torch.nn as nn
import torch.distributed as dist
import torch.multiprocessing as mp
import models
from utils.config import setup
import utils.comm as comm
import utils.saver as saver
from data.dat... | AlphaNet-main | parallel_supernet_evo_search.py |
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
# Modified from AttentiveNAS (https://github.com/facebookresearch/AttentiveNAS)
import argparse
import builtins
import math
import os
import random
import shutil
import time
import warnings
import sys
import operator
from datetime import date
imp... | AlphaNet-main | train_alphanet.py |
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
# Modified from AttentiveNAS (https://github.com/facebookresearch/AttentiveNAS)
import argparse
import builtins
import math
import os
import random
import shutil
import time
import warnings
import sys
from datetime import date
import torch
import ... | AlphaNet-main | test_alphanet.py |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import setuptools
setuptools.setup(
name="ctrl-benchmark",
version="0.0.3",
author="Tom Veniat, Ludovic Denoyer & Marc'Aurelio Ra... | CTrLBenchmark-master | setup.py |
from .streams import get_stream | CTrLBenchmark-master | ctrl/__init__.py |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import logging
import os
import random
from collections import defaultdict
import torch
import torchvision
from sklearn.decomposition import ... | CTrLBenchmark-master | ctrl/tasks/task.py |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
| CTrLBenchmark-master | ctrl/tasks/__init__.py |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import logging
import os
import random
import time
from types import SimpleNamespace
import numpy as np
import torch
import torch.nn.function... | CTrLBenchmark-master | ctrl/tasks/task_generator.py |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import torch
from ctrl.transformations.transformation_tree import TransformationTree
from torch import nn
from tqdm import tqdm
class NoisyN... | CTrLBenchmark-master | ctrl/transformations/noisy_nn_transformation.py |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import torch
class Transformation(object):
def __init__(self, transfo_pool, path, trans_descr):
assert path[0] == transfo_pool.r... | CTrLBenchmark-master | ctrl/transformations/transformation.py |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from functools import partial
import torch
from ctrl.transformations.transformation_tree import TransformationTree
from ctrl.transformations.... | CTrLBenchmark-master | ctrl/transformations/rainbow_transformation.py |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import abc
class TransformationPool(abc.ABC):
@abc.abstractmethod
def get_transformation(self, exclude_trans=None):
raise No... | CTrLBenchmark-master | ctrl/transformations/transformation_pool.py |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import numpy as np
from ctrl.transformations.transformation_tree import TransformationTree
from torchvision import transforms
from torchvisio... | CTrLBenchmark-master | ctrl/transformations/img_rotations.py |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from .identity_transformation import IdentityTransformation
from .img_rotations import ImgRotationTransformationTree
from .noisy_nn_transforma... | CTrLBenchmark-master | ctrl/transformations/__init__.py |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import numpy as np
import torch
import torchvision.transforms.functional as F
from PIL import Image
from ctrl.transformations.transformation_t... | CTrLBenchmark-master | ctrl/transformations/identity_transformation.py |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import torch
class BatchedTransformation(object):
def __init__(self, transfo, descr=None):
self.transfo = transfo
self.d... | CTrLBenchmark-master | ctrl/transformations/utils.py |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import logging
import random
from abc import ABC
from collections import defaultdict
from numbers import Number
import networkx as nx
from to... | CTrLBenchmark-master | ctrl/transformations/transformation_tree.py |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import torch
from ctrl.transformations.transformation_tree import TransformationTree
from ctrl.transformations.utils import BatchedTransformat... | CTrLBenchmark-master | ctrl/transformations/randperm_transformation.py |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import abc
import random
from functools import lru_cache
import networkx as nx
class Tree(abc.ABC):
"""
Abstract Tree structure con... | CTrLBenchmark-master | ctrl/commons/tree.py |
# Copyright (c) Facebook, Inc. and its affiliates.
"""
Common components shared across the project.
""" | CTrLBenchmark-master | ctrl/commons/__init__.py |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import re
import plotly
def plotly_rgb_to_hex(rgb_colors):
"""
Convert a list of RGB strings in the format used by plotly ("rgb(<R>... | CTrLBenchmark-master | ctrl/commons/utils.py |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from ctrl.strategies.task_creation_strategy import TaskCreationStrategy
class LabelPermutationStrategy(TaskCreationStrategy):
def __init... | CTrLBenchmark-master | ctrl/strategies/label_permutation_strategy.py |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from ctrl.strategies.task_creation_strategy import TaskCreationStrategy
class MixedStrategy(TaskCreationStrategy):
def __init__(self, st... | CTrLBenchmark-master | ctrl/strategies/mixed_strategy.py |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from ctrl.strategies.task_creation_strategy import TaskCreationStrategy
from ctrl.transformations.identity_transformation import \
load_or... | CTrLBenchmark-master | ctrl/strategies/input_domain_strategy.py |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import logging
from ctrl.concepts.concept import ComposedConcept
from ctrl.strategies.input_domain_strategy import TaskCreationStrategy
logg... | CTrLBenchmark-master | ctrl/strategies/random_mutation_strategy.py |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from .incremental_strategy import IncrementalStrategy
from .input_domain_strategy import InputDomainMutationStrategy
from .label_permutation_s... | CTrLBenchmark-master | ctrl/strategies/__init__.py |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import abc
import logging
import random
logger = logging.getLogger(__name__)
class TaskCreationStrategy(abc.ABC):
def __init__(self, do... | CTrLBenchmark-master | ctrl/strategies/task_creation_strategy.py |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from ctrl.strategies.task_creation_strategy import TaskCreationStrategy
class IncrementalStrategy(TaskCreationStrategy):
def __init__(se... | CTrLBenchmark-master | ctrl/strategies/incremental_strategy.py |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import numpy as np
from ctrl.strategies.task_creation_strategy import TaskCreationStrategy
class DataStrategy(TaskCreationStrategy):
def... | CTrLBenchmark-master | ctrl/strategies/data_strategy.py |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from ctrl.strategies.input_domain_strategy import TaskCreationStrategy
class AttributeStrategy(TaskCreationStrategy):
def __init__(self,... | CTrLBenchmark-master | ctrl/strategies/attributes_strategy.py |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from collections import defaultdict
import networkx as nx
import numpy as np
from ctrl.strategies.task_creation_strategy import TaskCreationS... | CTrLBenchmark-master | ctrl/strategies/split_strategy.py |
"""
This module contains a bunch of code extracted from
https://github.com/TomVeniat/MNTDP in order to allow the usage of automatic
configuration and initialization on the CTrL benchmark.
"""
import collections
import os
from os import path
from copy import deepcopy
import yaml
from numpy.random import default_rng
fr... | CTrLBenchmark-master | ctrl/streams/__init__.py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.