python_code stringlengths 0 4.04M | repo_name stringlengths 7 58 | file_path stringlengths 5 147 |
|---|---|---|
# Copyright (c) Facebook, Inc. and its affiliates.
''' Modified based on: https://github.com/erikwijmans/Pointnet2_PyTorch '''
from __future__ import (
division,
absolute_import,
with_statement,
print_function,
unicode_literals,
)
import torch
from torch.autograd import Function
import torch.nn as ... | 3detr-main | third_party/pointnet2/pointnet2_utils.py |
# Copyright (c) Facebook, Inc. and its affiliates.
''' Testing customized ops. '''
import torch
from torch.autograd import gradcheck
import numpy as np
import os
import sys
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
sys.path.append(BASE_DIR)
import pointnet2_utils
def test_interpolation_grad():
batch... | 3detr-main | third_party/pointnet2/pointnet2_test.py |
# Copyright (c) Facebook, Inc. and its affiliates.
''' Pointnet2 layers.
Modified based on: https://github.com/erikwijmans/Pointnet2_PyTorch
Extended with the following:
1. Uniform sampling in each local region (sample_uniformly)
2. Return sampled points indices to support votenet.
'''
import torch
import torch.nn as ... | 3detr-main | third_party/pointnet2/pointnet2_modules.py |
# Copyright (c) 2019-present, Facebook, Inc.
# 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 contextual.contextual_models import *
from contextual.contextual_linucb import *
from tqdm import trange
from collections ... | ContextualBanditsAttacks-main | isoexp/test_distance_attack_one_user.py |
# Copyright (c) 2019-present, Facebook, Inc.
# 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
sys.path.append('/private/home/broz/workspaces/bandits_attacks')
import isoexp.contextual.contextual_models as arm... | ContextualBanditsAttacks-main | isoexp/devfair_reward_attack.py |
# Copyright (c) 2019-present, Facebook, Inc.
# 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 isoexp.contextual.contextual_models import RandomContextualLinearArms
from isoexp.contextual.contextual_linucb import *
fro... | ContextualBanditsAttacks-main | isoexp/main_attacked_context.py |
# Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
__version__ = '0.0.dev0'
| ContextualBanditsAttacks-main | isoexp/__init__.py |
# Copyright (c) 2019-present, Facebook, Inc.
# 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 in_hull(points, x):
n_points = len(points)
n_dim = len(x)
c = np.zeros(n_points)
A = np.r_[points.T, np.on... | ContextualBanditsAttacks-main | isoexp/main_attack_one_user.py |
# Copyright (c) 2019-present, Facebook, Inc.
# 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
sys.path.append('/isoexp')
import numpy as np
import isoexp.mab.arms as arms
import pickle
from isoexp.mab.smab_algs... | ContextualBanditsAttacks-main | isoexp/main_mab.py |
# Copyright (c) 2019-present, Facebook, Inc.
# 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 matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import pickle
import tikzplotlib
im... | ContextualBanditsAttacks-main | isoexp/parse_reward_attack.py |
# Copyright (c) 2019-present, Facebook, Inc.
# 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 isoexp.contextual.contextual_models import RandomContextualLinearArms
from isoexp.contextual.contextual_linucb import *
fr... | ContextualBanditsAttacks-main | isoexp/main_attack_reward.py |
# Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
__version__ = '0.0.dev0' | ContextualBanditsAttacks-main | isoexp/contextual/__init__.py |
# Copyright (c) 2019-present, Facebook, Inc.
# 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 cvxpy as cp
from scipy.optimize import minimize
class RandomArm(object):
def __init__(self, ini... | ContextualBanditsAttacks-main | isoexp/contextual/contextual_linucb.py |
# Copyright (c) 2019-present, Facebook, Inc.
# 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
import matplotlib.pyplot as plt
class ContextualLinearMABModel(object):
def __init__(sel... | ContextualBanditsAttacks-main | isoexp/contextual/contextual_models.py |
# Copyright (c) 2019-present, Facebook, Inc.
# 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 cvxpy as cp
from scipy.optimize import minimize
class RandomArm(object):
def __init__(self, ini... | ContextualBanditsAttacks-main | isoexp/linear/linearbandit.py |
# Copyright (c) 2019-present, Facebook, Inc.
# 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
class LinearMABModel(object):
def __init__(self, random_state=0, noise=0.1, features=None, theta=None)... | ContextualBanditsAttacks-main | isoexp/linear/linearmab_models.py |
# Copyright (c) 2019-present, Facebook, Inc.
# 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 .linearmab_models import LinearMABModel
class ColdStartFromDatasetModel(LinearMABModel):
def __in... | ContextualBanditsAttacks-main | isoexp/linear/coldstart.py |
# Copyright (c) 2019-present, Facebook, Inc.
# 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 numpy as np
import sys
import numpy.random as npr
from tqdm import tqdm
class contextEpsGREEDY():
"""
... | ContextualBanditsAttacks-main | isoexp/mab/contextual_mab_algs.py |
# Copyright (c) 2019-present, Facebook, Inc.
# 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 math
from scipy.stats import truncnorm
class ContextualLinearMABModel(object):
def __init__(sel... | ContextualBanditsAttacks-main | isoexp/mab/contextual_arms.py |
# Copyright (c) 2019-present, Facebook, Inc.
# 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 sys
import numpy.random as npr
import cvxpy as cp
from tqdm import trange
from tqdm import tqdm
def ... | ContextualBanditsAttacks-main | isoexp/mab/smab_algs.py |
# Copyright (c) 2019-present, Facebook, Inc.
# 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 math
from scipy.stats import truncnorm
class AbstractArm(object):
def __init__(self, mean, varia... | ContextualBanditsAttacks-main | isoexp/mab/arms.py |
# Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
__version__ = '0.0.dev0'
| ContextualBanditsAttacks-main | isoexp/mab/__init__.py |
# Copyright (c) 2019-present, Facebook, Inc.
# 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
sys.path.append('/isoexp')
import numpy as np
import isoexp.mab.arms as arms
import pickle
from isoexp.mab.smab_algs... | ContextualBanditsAttacks-main | isoexp/mab/main_mab.py |
# Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Sep 3 23:30:58 2019
@author: evrardgarcelon
"""
import nump... | ContextualBanditsAttacks-main | examples/parse_real_data_results.py |
# Copyright (c) 2019-present, Facebook, Inc.
# 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 isoexp.monenvs import Env1
from sklearn.isotonic import IsotonicRegression
import matplotlib.pyplot as p... | ContextualBanditsAttacks-main | examples/show_confidence.py |
# Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Sep 1 14:23:15 2019
@author: evrardgarcelon
"""
import nump... | ContextualBanditsAttacks-main | examples/untitled0.py |
# Copyright (c) 2019-present, Facebook, Inc.
# 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
import logging
import os
import pickle
from collections import namedtuple
import numpy as np
from ... | ContextualBanditsAttacks-main | examples/linear_contextual_bandit.py |
# Copyright (c) 2019-present, Facebook, Inc.
# 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 isoexp.linear.linearbandit import EfficientLinearBandit, LinearBandit, LinPHE
from isoexp.conservative.... | ContextualBanditsAttacks-main | examples/main_linearmab.py |
# Copyright (c) 2019-present, Facebook, Inc.
# 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
import os
import pickle
import sys
from collections import namedtuple
import numpy as np
from jobl... | ContextualBanditsAttacks-main | examples/experiment_one_context.py |
# Copyright (c) 2019-present, Facebook, Inc.
# 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 isoexp.mab.arms as arms
import pickle
from isoexp.mab.smab_algs import UCB1, UCBV, BootstrapedUCB, PH... | ContextualBanditsAttacks-main | examples/main_mab.py |
# Copyright (c) 2019-present, Facebook, Inc.
# 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
import os
import pickle
import sys
from collections import namedtuple
import numpy as np
from jobl... | ContextualBanditsAttacks-main | examples/experiment_all_contexts.py |
# Copyright (c) 2019-present, Facebook, Inc.
# 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 matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import pickle
import tikzplotlib
imp... | ContextualBanditsAttacks-main | examples/parse_linear_results.py |
# Copyright (c) 2019-present, Facebook, Inc.
# 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
sys.path[0] = '/Users/evrard/Desktop/monotone_mabs/'
import numpy as np
import isoexp.linear.linearmab_models as arm... | ContextualBanditsAttacks-main | examples/runner_GLM.py |
# Copyright (c) 2019-present, Facebook, Inc.
# 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 os
from cycler import cycler
import matplotlib.pyplot as plt
import tikzplotlib
n = 9 # Number of c... | ContextualBanditsAttacks-main | examples/merge_real_data_results.py |
# Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Aug 22 15:37:36 2019
@author: evrard
"""
filename = '/Users... | ContextualBanditsAttacks-main | examples/reader_GLM.py |
# Copyright (c) 2019-present, Facebook, Inc.
# 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 isoexp.isotonicsim import LIsotron
import matplotlib.pyplot as plt
import numpy as np
from isoexp.LPAV_cvx import cvx_lip_i... | ContextualBanditsAttacks-main | examples/run_lisotron.py |
# Copyright (c) 2019-present, Facebook, Inc.
# 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 isoexp.knnmab import KnnMab
from isoexp.isomab import IsoMab
import isoexp.monenvs as monenvs
import matplotlib.pyplot as ... | ContextualBanditsAttacks-main | examples/main.py |
# Copyright (c) 2019-present, Facebook, Inc.
# 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 matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import pickle
import tikzplotlib
imp... | ContextualBanditsAttacks-main | examples/parse_mab_results.py |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
"""
Created on Thu Aug 22 15:37:36 2019
@author: evrard
"""
import pickle
impor... | ContextualBanditsAttacks-main | examples/parse_batch_results.py |
# Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Aug 22 15:37:36 2019
@author: evrard
"""
filename = '201908... | ContextualBanditsAttacks-main | examples/reader_linear.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 pickle
import numpy as np
import os
np.random.seed(1234)
# we want 500 for training, 100 for test for wach class
n = ... | Adversarial-Continual-Learning-main | ACL-resnet/data/split_miniimagenet.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 sys, time, os
import numpy as np
import torch
import copy
import utils
from copy import deepcopy
from tqdm import tqd... | Adversarial-Continual-Learning-main | ACL-resnet/src/acl.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 numpy as np
from copy import deepcopy
import pickle
import time
import uuid
from subprocess import call
#####... | Adversarial-Continual-Learning-main | ACL-resnet/src/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 os,argparse,time
import numpy as np
from omegaconf import OmegaConf
from copy import deepcopy
import torch
import torc... | Adversarial-Continual-Learning-main | ACL-resnet/src/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.
from __future__ import print_function
from PIL import Image
import os
import os.path
import sys
if sys.version_info[0] == 2:... | Adversarial-Continual-Learning-main | ACL-resnet/src/dataloaders/cifar100.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.
# https://github.com/pytorch/vision/blob/8635be94d1216f10fb8302da89233bd86445e449/torchvision/datasets/utils.py
import os
im... | Adversarial-Continual-Learning-main | ACL-resnet/src/dataloaders/utils.py |
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
from __future__ import print_function
from PIL import Image
import os
import os.path
import sys
if sys.version_info[0] == 2:
... | Adversarial-Continual-Learning-main | ACL-resnet/src/dataloaders/miniimagenet.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 os.path
import sys
import warnings
import urllib.request
if sys.version_info[0]... | Adversarial-Continual-Learning-main | ACL-resnet/src/dataloaders/datasets_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 utils
class Shared(torch.nn.Module):
def __init__(self,args):
super(Shared, self).__init__()... | Adversarial-Continual-Learning-main | ACL-resnet/src/networks/alexnet_acl.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
class Shared(torch.nn.Module):
def __init__(self,args):
super(Shared, self)... | Adversarial-Continual-Learning-main | ACL-resnet/src/networks/resnet_acl.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
class Private(torch.nn.Module):
def __init__(self, args):
super(Private, self).__init__()
... | Adversarial-Continual-Learning-main | ACL-resnet/src/networks/mlp_acl.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 utils
class Discriminator(torch.nn.Module):
def __init__(self,args,task_id):
super(Discrimina... | Adversarial-Continual-Learning-main | ACL-resnet/src/networks/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 pickle
import numpy as np
import os
np.random.seed(1234)
# we want 500 for training, 100 for test for wach class
n = ... | Adversarial-Continual-Learning-main | data/split_miniimagenet.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 sys, time, os
import numpy as np
import torch
import copy
import utils
from copy import deepcopy
from tqdm import tqd... | Adversarial-Continual-Learning-main | src/acl.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 numpy as np
from copy import deepcopy
import pickle
import time
import uuid
from subprocess import call
#####... | Adversarial-Continual-Learning-main | src/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 os,argparse,time
import numpy as np
from omegaconf import OmegaConf
import torch
import torch.backends.cudnn as cudnn... | Adversarial-Continual-Learning-main | src/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.
from __future__ import print_function
from PIL import Image
import os
import os.path
import sys
if sys.version_info[0] == 2:... | Adversarial-Continual-Learning-main | src/dataloaders/cifar100.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 sys
if sys.version_info[0] == 2:
import cPickle as pickle
else:
import p... | Adversarial-Continual-Learning-main | src/dataloaders/mulitidatasets.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.
# https://github.com/pytorch/vision/blob/8635be94d1216f10fb8302da89233bd86445e449/torchvision/datasets/utils.py
import os
im... | Adversarial-Continual-Learning-main | src/dataloaders/utils.py |
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
from __future__ import print_function
from PIL import Image
import os
import os.path
import sys
if sys.version_info[0] == 2:
... | Adversarial-Continual-Learning-main | src/dataloaders/miniimagenet.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
from PIL import Image
import torch
import numpy as np
import os.path
import sys
import ... | Adversarial-Continual-Learning-main | src/dataloaders/mnist5.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 sys, os
import numpy as np
from PIL import Image
import torch.utils.data as data
from torchvision import d... | Adversarial-Continual-Learning-main | src/dataloaders/pmnist.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 os.path
import sys
import warnings
import urllib.request
if sys.version_info[0]... | Adversarial-Continual-Learning-main | src/dataloaders/datasets_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 utils
class Shared(torch.nn.Module):
def __init__(self,args):
super(Shared, self).__init__()... | Adversarial-Continual-Learning-main | src/networks/alexnet_acl.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
class Private(torch.nn.Module):
def __init__(self, args):
super(Private, self).__init__()
... | Adversarial-Continual-Learning-main | src/networks/mlp_acl.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 utils
class Discriminator(torch.nn.Module):
def __init__(self,args,task_id):
super(Discrimina... | Adversarial-Continual-Learning-main | src/networks/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.
"""
Wrapper script for launching a job on the fair cluster.
Sample usage:
python cluster_run.py --name=trial --setup=... | CausalSkillLearning-main | Experiments/cluster_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 headers import *
# Check if CUDA is available, set device to GPU if it is, otherwise use CPU.
use_cuda = torch.cuda.is... | CausalSkillLearning-main | Experiments/PolicyNetworks.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 mocap_processing, glob, numpy as np, os
from mocap_processing.motion.pfnn import Animation, BVH
from mocap_processing... | CausalSkillLearning-main | Experiments/Processing_MocapData.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 headers import *
class GridWorldDataset(Dataset):
# Class implementing instance of dataset class for gridworld data.... | CausalSkillLearning-main | Experiments/DataLoaders.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 headers import *
from PolicyNetworks import *
from Visualizers import BaxterVisualizer, SawyerVisualizer, ToyDataVisual... | CausalSkillLearning-main | Experiments/PolicyManagers.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 headers import *
def resample(original_trajectory, desired_number_timepoints):
original_traj_len = len(original_traje... | CausalSkillLearning-main | Experiments/RLUtils.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.
# Code referenced from https://gist.github.com/gyglim/1f8dfb1b5c82627ae3efcfbbadb9f514
import tensorflow as tf
import numpy... | CausalSkillLearning-main | Experiments/TFLogger.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 headers import *
class TestLoaderWithKwargs(unittest.TestLoader):
"""A test loader which allows to parse keyword ... | CausalSkillLearning-main | Experiments/TestClass.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 absolute_import
from __future__ import division
from __future__ import print_function
from headers i... | CausalSkillLearning-main | Experiments/MIME_DataLoader.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 absolute_import
from __future__ import division
from __future__ import print_function
from absl impo... | CausalSkillLearning-main | Experiments/Visualizers.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 absolute_import
from __future__ import division
from __future__ import print_function
from headers i... | CausalSkillLearning-main | Experiments/Roboturk_DataLoader.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 headers import *
import DataLoaders, MIME_DataLoader, Roboturk_DataLoader, Mocap_DataLoader
from PolicyManagers import ... | CausalSkillLearning-main | Experiments/Master.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 absolute_import
from __future__ import division
from __future__ import print_function
from headers i... | CausalSkillLearning-main | Experiments/Mocap_DataLoader.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 headers import *
class DMP():
# def __init__(self, time_steps=100, num_ker=25, dimensions=3, kernel_bandwidth=None,... | CausalSkillLearning-main | Experiments/DMP.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 numpy as np
import glob, os, sys, argparse
import torch, copy
from torch.utils.data import Dataset, DataLoader
from t... | CausalSkillLearning-main | Experiments/headers.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 numpy as np, glob, os
from IPython import embed
# Env list.
environment_names = ["SawyerPickPlaceBread","SawyerPic... | CausalSkillLearning-main | Experiments/Eval_RLRewards.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 mocap_processing.motion.pfnn import Animation, BVH
from basecode.render import glut_viewer as viewer
from basecode.rend... | CausalSkillLearning-main | Experiments/MocapVisualizationUtils.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 MocapVisualizationUtils
import threading, time, numpy as np
# bvh_filename = "/home/tanmayshankar/Research/Code/Cau... | CausalSkillLearning-main | Experiments/MocapVisualizationExample.py |
# Copyright (c) Facebook, Inc. and its affiliates.
# Debugging cycle consistency transfer.
python Master.py --name=CTdebug --train=1 --setting=cycle_transfer --source_domain=ContinuousNonZero --target_domain=ContinuousNonZero --z_dimensions=64 --number_layers=5 --hidden_size=64 --data=ContinuousNonZero --training_pha... | CausalSkillLearning-main | Experiments/Code_Runs/CycleTransfer_Runs.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 headers import *
class GridWorldDataset(Dataset):
# Class implementing instance of dataset class for gridworld data.... | CausalSkillLearning-main | DataLoaders/GridWorld_DataLoader.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 absolute_import
from __future__ import division
from __future__ import print_function
from .headers ... | CausalSkillLearning-main | DataLoaders/MIME_Img_DataLoader.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 absolute_import
from __future__ import division
from __future__ import print_function
from .headers i... | CausalSkillLearning-main | DataLoaders/InteractiveDataLoader.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 absolute_import
from __future__ import division
from __future__ import print_function
from .headers ... | CausalSkillLearning-main | DataLoaders/Plan_DataLoader.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 headers import *
class GridWorldDataset(Dataset):
# Class implementing instance of dataset class for gridworld data.... | CausalSkillLearning-main | DataLoaders/SmallMaps_DataLoader.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 absolute_import
from __future__ import division
from __future__ import print_function
import sys
imp... | CausalSkillLearning-main | DataLoaders/RandomWalks.py |
CausalSkillLearning-main | DataLoaders/__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.
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from .headers ... | CausalSkillLearning-main | DataLoaders/MIME_DataLoader.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.
"""
A convenience script to playback random demonstrations from
a set of demonstrations stored in a hdf5 file.
Arguments:
... | CausalSkillLearning-main | DataLoaders/RoboturkeExp.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 absolute_import
from __future__ import division
from __future__ import print_function
from __future__... | CausalSkillLearning-main | DataLoaders/Translation.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 numpy as np
import torch
import glob, cv2, os
from torch.utils.data import Dataset, DataLoader
from torchvision impor... | CausalSkillLearning-main | DataLoaders/headers.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 absolute_import
from __future__ import division
from __future__ import print_function
from .headers ... | CausalSkillLearning-main | DataLoaders/MIMEandPlan_DataLoader.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.
"""
# For both arms and grippers.
python -m SkillsfromDemonstrations.Experiments.UseSkillsRL.TrainZPolicyRL --train --tra... | CausalSkillLearning-main | DownstreamRL/TrainZPolicyRL.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 ..SkillNetwork.headers import *
from ..SkillNetwork.LSTMNetwork import LSTMNetwork, LSTMNetwork_Fixed
class PolicyNet... | CausalSkillLearning-main | DownstreamRL/PolicyNet.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 numpy as np
from IPython import embed
number_datapoints = 50000
number_timesteps = 25
x_array_dataset = np.zeros((n... | CausalSkillLearning-main | DataGenerator/DirectedContinuousTrajs.py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.