python_code
stringlengths
0
4.04M
repo_name
stringlengths
8
58
file_path
stringlengths
5
147
# 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
# 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 = 20 x_array_dataset = np.zeros((n...
CausalSkillLearning-main
DataGenerator/ContinuousTrajs.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 = 20 x_array_dataset = np.zeros((n...
CausalSkillLearning-main
DataGenerator/ContinuousNonZero.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 import matplotlib.pyplot as plt #number_datapoints = 20 number_datapoints = 50...
CausalSkillLearning-main
DataGenerator/DeterministicGoalDirectedTraj.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 import matplotlib.pyplot as plt number_datapoints = 1 # number_datapoints = 50...
CausalSkillLearning-main
DataGenerator/GoalDirectedTrajs.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, copy from IPython import embed import matplotlib.pyplot as plt number_datapoints = 20 # number_datapoin...
CausalSkillLearning-main
DataGenerator/PolicyVisualizer.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/DirectedContinuousNonZero.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, copy from IPython import embed import matplotlib.pyplot as plt number_datapoints = 20 # number_datapoin...
CausalSkillLearning-main
DataGenerator/NewGoalDirectedTraj.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 import matplotlib.pyplot as plt # number_datapoints = 20 number_datapoints = 5...
CausalSkillLearning-main
DataGenerator/SeparableTrajs.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 setuptools import setup, find_packages from setuptools.extension import Extension from Cython.Build import cythonize import numpy extensi...
CPC_audio-main
setup.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 argparse import torch from cpc.model import CPCModel as cpcmodel from cpc.cpc_default_config import get_default_cpc_config from cpc.feat...
CPC_audio-main
hubconf.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 import torchaudio import os import json import argparse from .cpc_default_config import get_default_cpc_config from .dataset impor...
CPC_audio-main
cpc/feature_loader.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 import torch.nn as nn import math class ScaledDotProductAttention(nn.Module): def __init__(self, sizeSeq, ...
CPC_audio-main
cpc/transformers.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.
CPC_audio-main
cpc/__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 torch.nn as nn import torch.nn.functional as F import torchaudio import torch ########################################### # Networks #...
CPC_audio-main
cpc/model.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 os import random import time import tqdm import torch import soundfile as sf from pathlib import Path from copy import deepcopy from tor...
CPC_audio-main
cpc/dataset.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 argparse import json import os import numpy as np import torch import time from copy import deepcopy import random import psutil import ...
CPC_audio-main
cpc/train.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 unittest import torch import os import cpc.feature_loader as fl from .dataset import AudioBatchData, findAllSeqs, filterSeqs from nose.t...
CPC_audio-main
cpc/unit_tests.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 argparse def get_default_cpc_config(): parser = set_default_cpc_config(argparse.ArgumentParser()) return parser.parse_args([])...
CPC_audio-main
cpc/cpc_default_config.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 json import numpy as np import random import torch import sys import psutil from copy import deepcopy from bisect import bisect_left d...
CPC_audio-main
cpc/utils/misc.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.
CPC_audio-main
cpc/utils/__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 unittest import torch import os from nose.tools import eq_, ok_ from .misc import SchedulerCombiner, ramp_scheduling_function class T...
CPC_audio-main
cpc/utils/unit_tests.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. # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved import math import torch.nn as nn from numpy import prod class Norma...
CPC_audio-main
cpc/criterion/custom_layers.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 .criterion import CPCUnsupersivedCriterion, SpeakerCriterion, \ PhoneCriterion, NoneCriterion, CTCPhoneCriterion
CPC_audio-main
cpc/criterion/__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 progressbar import torch from multiprocessing import Lock, Manager, Process from copy import deepcopy def beam_search(score_preds, nKe...
CPC_audio-main
cpc/criterion/seq_alignment.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 import torch.nn as nn from .seq_alignment import collapseLabelChain from .custom_layers import EqualizedLinear, EqualizedConv1d ...
CPC_audio-main
cpc/criterion/criterion.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 argparse import sys import torch import json from pathlib import Path import ABX.abx_group_computation as abx_g import ABX.abx_iterators...
CPC_audio-main
cpc/eval/ABX.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 argparse import os import torchaudio from copy import deepcopy import torch import time import random import math import json import sub...
CPC_audio-main
cpc/eval/common_voices_eval.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 os import json import torch import progressbar import argparse import numpy as np from cpc.dataset import findAllSeqs from cpc.feature_...
CPC_audio-main
cpc/eval/build_zeroSpeech_features.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 argparse import sys import torch import json import time import numpy as np from pathlib import Path from copy import deepcopy import os...
CPC_audio-main
cpc/eval/linear_separability.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.
CPC_audio-main
cpc/eval/__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 torch import progressbar import math import random def normalize_with_singularity(x): r""" Normalize the given vector across t...
CPC_audio-main
cpc/eval/ABX/abx_iterators.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.
CPC_audio-main
cpc/eval/ABX/__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 unittest import torch from nose.tools import eq_, ok_ from . import abx_group_computation from . import abx_iterators from pathlib impor...
CPC_audio-main
cpc/eval/ABX/unit_tests.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 import math from . import dtw import progressbar def get_distance_function_from_name(name_str): if name_str == 'euclidian': ...
CPC_audio-main
cpc/eval/ABX/abx_group_computation.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 argparse import torchaudio import progressbar import os import sys from pathlib import Path def adjust_sample_rate(path_db, file_list,...
CPC_audio-main
cpc/eval/utils/adjust_sample_rate.py
#!/usr/bin/env python # 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 glob import argparse import numpy as np import resampy from scikits.audiolab impo...
2.5D-Visual-Sound-main
reEncodeAudio.py
#!/usr/bin/env python # 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 time import torch from options.train_options import TrainOptions from data.data_loa...
2.5D-Visual-Sound-main
train.py
#!/usr/bin/env python # 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 librosa import argparse import numpy as np from numpy import linalg as LA from sci...
2.5D-Visual-Sound-main
evaluate.py
#!/usr/bin/env python # 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 argparse import librosa import numpy as np from PIL import Image import subprocess ...
2.5D-Visual-Sound-main
demo.py
#!/usr/bin/env python # 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 .base_options import BaseOptions class TestOptions(BaseOptions): def initialize(self): Base...
2.5D-Visual-Sound-main
options/test_options.py
#!/usr/bin/env python # 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 .base_options import BaseOptions class TrainOptions(BaseOptions): def initialize(self): Bas...
2.5D-Visual-Sound-main
options/train_options.py
2.5D-Visual-Sound-main
options/__init__.py
#!/usr/bin/env python # 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 os from util import util import torch class BaseOptions(): def __init__(sel...
2.5D-Visual-Sound-main
options/base_options.py
#!/usr/bin/env python # 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 def mkdirs(paths): if isinstance(paths, list) and not isinstance(paths, str): ...
2.5D-Visual-Sound-main
util/util.py
2.5D-Visual-Sound-main
util/__init__.py
#!/usr/bin/env python # 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 from .networks import VisualNet, AudioNet, weights_init class Model...
2.5D-Visual-Sound-main
models/models.py