python_code stringlengths 0 66.4k |
|---|
# 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.
"""
cvpr19_models.models.evaluator.py
=================================
Active acquisition model as described in `Zhang, Zizhao, et al. "Reduci... |
# 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 json
import os
import numpy as np
import torch
import torch.utils.data
import activemri.experimental.cvpr19_models.models.fft_utils as... |
# 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 os
import pathlib
import numpy as np
import torch
import torch.utils.data
from . import dicom_data_loader, masking_utils, raw_data_loa... |
# 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 . import base_data_loader
def create_data_loaders(options, is_test=False):
if not is_test:
train_loader, valid_loader = bas... |
# 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 numpy as np
import torch
def get_mask_func(mask_type, which_dataset, rnl_params=None):
# Whether the number of lin... |
# 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 pathlib
import h5py
import numpy as np
import torch
import torch.utils.data
def ifftshift(x, dim=None):
if dim is None:
d... |
# 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 typing import Any, Dict, Optional
import fastmri.models
import torch
import activemri.models
# noinspection PyAbstractClass
class Unet... |
# 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
from typing import Any, Dict, Optional
import torch.nn
class Reconstructor(torch.nn.Module):
def __init__(self, **kwargs):
... |
# 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 typing import Any, Dict
import torch
import activemri.experimental.cvpr19_models.models.reconstruction as cvpr19_reconstruction
import a... |
# 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.
"""
activemri.baselines.ddqn.py
=======================================
Baseline implementation of Double DQN, as described in
*Van Hasselt, Ha... |
# 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 typing import Any, Dict, List, Optional, Tuple
import numpy as np
import activemri.baselines as baselines
import activemri.envs as envs
... |
# 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
from typing import Any, Dict, List
class Policy:
""" A basic policy interface. """
def __init__(self, *args, **kwargs):
... |
# 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.
"""
activemri.baselines.simple_baselines.py
=======================================
Simple baselines for active MRI acquisition.
"""
from typin... |
# 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 os
import tempfile
from typing import Dict, Optional
import numpy as np
import torch
class ReplayMemory:
"""Replay memory of tran... |
# 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 typing import Any, Dict, List
import torch
import activemri.experimental.cvpr19_models.models.evaluator as cvpr19_evaluator
from . impo... |
# 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.
"""
activemri.envs.envs.py
====================================
Gym-like environment for active MRI acquisition.
"""
import functools
import js... |
# 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 importlib
import json
import pathlib
from typing import Dict, Tuple
import numpy as np
import skimage.metrics
import torch
def get_u... |
# 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.
__all__ = [
"ActiveMRIEnv",
"MICCAI2020Env",
"FastMRIEnv",
"SingleCoilKneeEnv",
"MultiCoilKneeEnv",
]
from .envs import (
... |
# 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.
"""
activemri.envs.masks.py
====================================
Utilities to generate and manipulate active acquisition masks.
"""
from typing... |
# 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.
"""
activemri.data.transforms.py
====================================
Transform functions to process fastMRI data for reconstruction models.
""... |
# 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 pathlib
from typing import Callable, List, Optional, Tuple
import fastmri
import h5py
import numpy as np
import torch.utils.data
# --... |
# 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 typing import Any, Dict, List
import numpy as np
import torch
from . import singlecoil_knee_data
from . import transforms
__all__ = ["s... |
# 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 functools
import numpy as np
import pytest # noqa: F401
import torch
import activemri.envs.envs as envs
import activemri.envs.util as... |
# 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 pytest # noqa: F401
import torch
import activemri.envs.masks as masks
def test_update_masks_from_indices():
m... |
# 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 pytest # noqa: F401
import torch
import activemri.baselines as baselines
def test_random():
policy = baselines.RandomPolicy()
... |
# 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 json
from typing import Dict
import numpy as np
import torch
import activemri.envs.envs as envs
cfg_json_str = """
{
"data_locati... |
# 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 json
import os
import pytest # noqa: F401
import activemri.envs.util
def test_all_configs():
configs_root = "configs/"
for ... |
# 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 pytest # noqa: F401
import activemri.envs.envs as envs
class TestMICCAIEnv:
env = envs.MICCAI2020Env()
d... |
# 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.
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# lis... |
# 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 argparse
import os
import pickle
from typing import cast
import numpy as np
import torch
import activemri.baselines as baselines
impo... |
# 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 argparse
import activemri.baselines.ddqn as ddqn
import activemri.envs as envs
if __name__ == "__main__":
parser = argparse.Argume... |
# 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 argparse
import torch
import activemri.baselines as mri_baselines
import activemri.envs as envs
if __name__ == "__main__":
parser... |
# Copyright (c) Meta Platforms, Inc. and affiliates.
import logging
from dataclasses import dataclass, field
from math import sqrt
from typing import List, Optional, Union
import torch
import torch.nn as nn
logger: logging.Logger = logging.getLogger(__name__)
@dataclass
class MtlConfigs:
mtl_model: str = "att... |
# 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 pickle
from fig_1 import *
def evaluate_function_in_polytope():
# Generate projection matrix
np.random.seed(3)... |
# 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 numpy as np
from fig_1 import *
def hesbo_branin(X, mode):
# In 2-D, HESBO has 3 possible embeddings:
# Full r... |
# 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 matplotlib import pyplot as plt
from matplotlib.lines import Line2D
from matplotlib import rc
import matplotlib
rc('font', ... |
# 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 numpy as np
import pickle
from plot_config import *
def make_fig_S5():
with open('data/fig4_sim_output.pckl', 'rb'... |
# 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 pickle
import time
import torch
import numpy as np
import cvxpy as cp # 1.0.25
from plot_config import *
def gen_A_re... |
# 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 json
import numpy as np
from ax.storage.json_store.decoder import object_from_json
from plot_config_nr import *
def m... |
# 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 json
import numpy as np
from ax.storage.json_store.decoder import object_from_json
def table_S1_data():
with open(... |
# 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 numpy as np
from ax.utils.measurement.synthetic_functions import branin, hartmann6
from plot_config import *
def bran... |
import json
import numpy as np
from ax.storage.json_store.decoder import object_from_json
from plot_config import *
def make_nasbench_figure():
with open('../benchmarks/results/nasbench_aggregated_results.json', 'r') as fin:
res = object_from_json(json.load(fin))
# A map from method idx in plot_met... |
# 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 json
import numpy as np
from ax.storage.json_store.decoder import object_from_json
from plot_config import *
def extr... |
# 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 numpy as np
from plot_config import *
def make_fig_2():
# Run the simulation
np.random.seed(1)
Ds = [20, ... |
# 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
os.environ['OPENBLAS_NUM_THREADS'] = '1'
os.environ['OMP_NUM_THREADS'] = '1'
import time
import numpy as np
import to... |
# 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 fig_S8 import *
def make_fig_S9():
ys1, ys2 = extract_sensitivity_results()
d_es = [2, 3, 4, 5, 6, 7, 8]
mus... |
# 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 json
import numpy as np
from ax.storage.json_store.decoder import object_from_json
from plot_config import *
def extr... |
# 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 numpy as np
import pickle
from plot_config import *
def make_fig_S2():
# Load in simulation results
with open(... |
# 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 fig_4 import *
def run_simulation():
t1 = time.time()
nsamp = 1000
res = {'unitsphere': {}}
for D in [50,... |
# 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 json
import numpy as np
from ax.storage.json_store.decoder import object_from_json
from plot_config import *
def make... |
# 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 pi
from fig_3 import *
def compute_ll(f, var, test_Y):
return -0.5 * (torch.log(2 * pi * var) + ((test_Y... |
# 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.
"""
Run NASBench benchmarks
"""
import os
os.environ['OPENBLAS_NUM_THREADS'] = '1'
os.environ['OMP_NUM_THREADS'] = '1'
import j... |
# 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 typing import Any, Callable, Dict, List, MutableMapping, Optional, Tuple, Union
from ax.models.torch.botorch_defaults impo... |
# 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.
"""
Run benchmarks for CMAES.
Requires installing cma from pip. The experiments here used version 2.7.0.
"""
import os
os.envir... |
# 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.
"""
Run benchmarks for SMAC.
Requires installing smac from pip. The experiments here used version 2.7.0.
"""
import os
os.envir... |
# 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.
"""
Run benchmarks for TuRBO.
Requires installing turbo from https://github.com/uber-research/TuRBO.
The experiments here used... |
# 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.
"""
Compile all of the benchmark results from the different methods (potentially
run in a distributed fashion) into a single Ben... |
# 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 json
import numpy as np
from scipy.stats import special_ortho_group
from typing import List, Optional
from ax.benchmark.... |
# 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.
"""
Run benchmarks for Add-GP-UCB.
Requires installing dragonfly-opt from pip. The experiments here used version
0.1.4.
"""
imp... |
# 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.
"""
Run benchmarks for LineBO on the Hartmann6 100 problem.
These benchmarks are run using the benchmarking suite contained in ... |
# 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.
"""
Run benchmarks for: ALEBO, REMBO, HeSBO, and Sobol.
"""
import os
os.environ['OPENBLAS_NUM_THREADS'] = '1'
os.environ['OMP_N... |
# 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.
"""
Run benchmarks for Ensemble BO.
A few steps are required to use EBO:
(1) git clone https://github.com/zi-w/Ensemble-Bayesi... |
# 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.
"""
Requires nasbench==1.0 from https://github.com/google-research/nasbench
Also requires dataset nasbench_only108.tfrecord to b... |
# 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 crlapi.benchmark import StreamTrainer
import hydra
from omegaconf import DictConfig, OmegaConf
def ... |
# 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 crlapi.benchmark import StreamTrainer
import hydra
from omegaconf import DictConfig, OmegaConf
def ... |
# 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 crlapi import instantiate_class,get_class,get_arguments
class StreamTrainer:
def create_logger(self, logger_a... |
# 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.
#
def instantiate_class(arguments):
from importlib import import_module
d = dict(arguments)
if "classname" in... |
# 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
class TaskResources:
""" Describe resources for a task (e.g a dataset, and environments, etc...)
"... |
#
# 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 torch.utils.tensorboard import SummaryWriter
import sqlite3
import os
import os.path
import csv
import copy
from datetime import date... |
# 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 crlapi.core import TaskResources, Stream, Task
import torchvision.datasets
import torchvision.transforms
import num... |
# 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 crlapi.core import TaskResources, Stream, Task
import torchvision.datasets
import torchvision.transforms
import nump... |
# 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 crlapi.core import TaskResources, Stream, Task
import torchvision.datasets
import torchvision.transforms
import num... |
# 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 numpy as np
from copy import deepcopy
from crlapi.sl.architectures.mixture_mod... |
# 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 copy
import random
import numpy as np
class So... |
# 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
from crlapi.sl.architectures.mixture_model import MixtureLayer,SoftMaxGateModule,HardS... |
# 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 logging
import numpy as np
import torch
from torch import nn
import torch.utils.data
from torch.nn im... |
# 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 copy
import torch
import torch.autograd as autograd
import torch.nn as nn
import torch.nn.functional a... |
# 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 import nn
from functools import partial
from einops.layers.torch import Rearrange, Reduce
import torch.nn as n... |
# 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 torchvision
import numpy as np
import time
im... |
# 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.
#
# *** MODULES taken from original code https://github.com/klightz/Firefly
import numpy as np
import time
import torch... |
# 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.
#
# *** MODULES taken from original code https://github.com/klightz/Firefly
from .conv import Conv2d
from .net import SpN... |
# 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.
#
# *** MODULES taken from original code https://github.com/klightz/Firefly
import numpy as np
import torch
import torch... |
# 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.
#
# *** MODULES taken from original code https://github.com/klightz/Firefly
import math
import numpy as np
import torch... |
# 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 sys
import copy
import time
from pydoc import locate
import numpy as np
import torch
import torch.nn as nn
import... |
# 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 crlapi.core import CLModel
from crlapi.sl.clmodel... |
# 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 crlapi.core import CLModel
from crlapi.sl.clmodel... |
# 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 crlapi.core import CLModel
from crlapi.sl.clmodel... |
# 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 crlapi.core import CLModel
from crlapi.sl.clmodel... |
# 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 numpy as np
from pydoc import locate
from random import shuffle
from crlapi.core import CLModel
from f... |
# 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 crlapi.core import CLModel
from crlapi.sl.clmodel... |
# 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 crlapi.core import CLModel
from crlapi.sl.clmodel... |
# 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 crlapi.core import CLModel
from crlapi.sl.clmodel... |
# 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 numpy as np
import torch.nn.functional as F
from crlapi.core import CLModel
from crlapi.... |
# 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 crlapi.core import CLModel
from crlapi.sl.clmodel... |
#!/usr/bin/env python3
# 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 json
import re
from datetime import datetime
import requests
def get_ad_archive_id(data):... |
#!/usr/bin/env python3
# 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 datetime
import json
from collections import Counter
def get_operators():
"""
Feel... |
#!/usr/bin/env python3
# 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 iso3166 import countries
supported_countries = [
"AT",
"BE",
"BG",
"CA",
... |
#!/usr/bin/env python3
# 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 sys
from fb_ads_library_api import FbAdsLibraryTraversal
from fb_ads_library... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.