python_code stringlengths 0 4.04M | repo_name stringlengths 7 58 | file_path stringlengths 5 147 |
|---|---|---|
# Copyright (c) Meta Platforms, Inc. and affiliates. All Rights Reserved.
#
# 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 collections import OrderedDict
from contextlib import contextmanager
from metaseq.logging.progress_ba... | flash_metaseq-main | metaseq/logging/progress_bar/json_progress_bar.py |
# Copyright (c) Meta Platforms, Inc. and affiliates. All Rights Reserved.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from numbers import Number
from metaseq.logging.meters import AverageMeter
from metaseq.logging.progress_bar.base_prog... | flash_metaseq-main | metaseq/logging/progress_bar/wandb_progress_bar.py |
# Copyright (c) Meta Platforms, Inc. and affiliates. All Rights Reserved.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import math
import torch
import torch.nn.functional as F
from metaseq import metrics, utils
from metaseq.criterions i... | flash_metaseq-main | metaseq/criterions/cross_entropy.py |
# Copyright (c) Meta Platforms, Inc. and affiliates. All Rights Reserved.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import inspect
from typing import Any, Dict, List
from torch.nn.modules.loss import _Loss
from metaseq import metrics... | flash_metaseq-main | metaseq/criterions/base_criterion.py |
# Copyright (c) Meta Platforms, Inc. and affiliates. All Rights Reserved.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""isort:skip_file"""
import importlib
import os
from metaseq import registry
from metaseq.criterions.base_criterion i... | flash_metaseq-main | metaseq/criterions/__init__.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
import setuptools
setuptools.setup(
name="cop3d",
version="1.0.0",
author="Meta AI",
author_e... | cop3d-main | setup.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
from co3d.dataset.download_dataset_impl import build_arg_parser, download_dataset
REPO_ROOT = __file__.rsplit(... | cop3d-main | cop3d/download_dataset.py |
import pathlib
import numpy as np
import matplotlib.pyplot as plt
plt.switch_backend('agg')
import seaborn as sns
sgd_n_epochs = 15
n_trials = 10
def plot_objective_difference():
"""Plot objective difference during training
"""
for model_name in ['kernel', 'lenet']:
for transform_name in ['rotati... | augmentation_code-master | plot.py |
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch import autograd
class MultinomialLogisticRegression(nn.Module):
"""Abstract class for multinomial logistic regression.
Subclasses need to implement @features and @output_from_features.
"""
def features(self, x):
rai... | augmentation_code-master | models.py |
import copy
from collections import namedtuple
import numpy as np
import torch
from torchvision import transforms
from PIL import Image, ImageFilter, ImageEnhance
# An augmentation object consists of its name, the transform functions of type
# torchvision.transforms, and the resulting augmented dataset of type
# torc... | augmentation_code-master | augmentation.py |
import copy
import numpy as np
import pathlib
import torch
import torch.optim as optim
import torch.nn.functional as F
from torchvision import datasets, transforms
from models import LinearLogisticRegression, RBFLogisticRegression, LinearLogisticRegressionAug, RBFLogisticRegressionAug, LeNet, LeNetAug, combine_transf... | augmentation_code-master | mnist_experiments.py |
import copy
import numpy as np
import torch
import torch.nn.functional as F
from sklearn.metrics import roc_auc_score
from models import combine_transformed_dimension, split_transformed_dimension
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
def get_train_valid_datasets(dataset,
... | augmentation_code-master | utils.py |
import copy
import numpy as np
import pathlib
import torch
import torch.optim as optim
import torch.nn.functional as F
from torchvision import datasets, transforms
from models import LinearLogisticRegression, RBFLogisticRegression, RBFLogisticRegressionRotated, LinearLogisticRegressionAug, RBFLogisticRegressionAug, L... | augmentation_code-master | cifar10_experiments.py |
# Copyright (c) 2021-present, Facebook, Inc.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
#
import re
from distutils.core import setup
from setuptools import find_packages
def find_version() -> str:
with open('bisk/__init__.py', 'r... | bipedal-skills-main | setup.py |
# Copyright (c) 2021-present, Facebook, Inc.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
#
import gym
import pytest
import bisk
@pytest.fixture
def env():
env = gym.make('BiskGoalWall-v1', robot='testcube')
obs, _ = env.reset(... | bipedal-skills-main | tests/test_goalwall.py |
# Copyright (c) 2022-present, Facebook, Inc.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
#
import gym
import pytest
import numpy as np
import bisk
@pytest.fixture
def env():
env = gym.make('BiskGoToSphere-v1', robot='testcube')
... | bipedal-skills-main | tests/test_gotosphere.py |
# Copyright (c) 2021-present, Facebook, Inc.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
#
import gym
import pytest
import bisk
@pytest.fixture
def env():
env = gym.make('BiskHurdles-v1', robot='testcube')
obs, _ = env.reset(s... | bipedal-skills-main | tests/test_hurdles.py |
# Copyright (c) 2021-present, Facebook, Inc.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
#
import gym
import pytest
import bisk
# Simple test whether we can instantiate the env with a robot and do a single
# step.
def _create_helper(e... | bipedal-skills-main | tests/test_robots.py |
# Copyright (c) 2021-present, Facebook, Inc.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
#
import gym
import pytest
import bisk
@pytest.fixture
def env():
env = gym.make('BiskPoleBalance-v1', robot='testcube')
obs, _ = env.rese... | bipedal-skills-main | tests/test_polebalance.py |
# Copyright (c) 2022-present, Facebook, Inc.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
#
import gym
import pytest
import numpy as np
import bisk
@pytest.fixture
def env():
env = gym.make('BiskButterflies-v1', robot='testcube')
... | bipedal-skills-main | tests/test_butterflies.py |
# Copyright (c) 2022-present, Facebook, Inc.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
#
import gym
import pytest
import numpy as np
import bisk
@pytest.fixture
def env():
env = gym.make('BiskGoToTargets-v1', robot='testcube')
... | bipedal-skills-main | tests/test_gototargets.py |
# Copyright (c) 2021-present, Facebook, Inc.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
#
import gym
import pytest
import bisk
from bisk.features.joints import JointsFeaturizer
from bisk.single_robot import BiskSingleRobotEnv
def test... | bipedal-skills-main | tests/test_features_joints.py |
# Copyright (c) 2021-present, Facebook, Inc.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
#
import gym
import pytest
import bisk
@pytest.fixture
def env():
env = gym.make('BiskHurdles-v1', robot='testcube')
obs, _ = env.reset(s... | bipedal-skills-main | tests/test_render.py |
# Copyright (c) 2021-present, Facebook, Inc.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
#
import gym
import pytest
import bisk
@pytest.fixture
def env():
env = gym.make('BiskLimbo-v1', robot='testcube')
obs, _ = env.reset(seed... | bipedal-skills-main | tests/test_limbo.py |
# Copyright (c) 2021-present, Facebook, Inc.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
#
import gym
import pytest
import bisk
@pytest.fixture
def env():
env = gym.make('BiskStairs-v1', robot='testcube')
obs, _ = env.reset(se... | bipedal-skills-main | tests/test_stairs.py |
# Copyright (c) 2022-present, Facebook, Inc.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
#
import gym
import numpy as np
import pytest
import bisk
def test_walker_fallover():
env = gym.make('BiskGoalWall-v1', robot='walker')
e... | bipedal-skills-main | tests/test_fallover.py |
# Copyright (c) 2021-present, Facebook, Inc.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
#
import gym
import pytest
import bisk
@pytest.fixture
def env():
env = gym.make('BiskHurdlesLimbo-v1', robot='testcube')
obs, _ = env.res... | bipedal-skills-main | tests/test_hurdleslimbo.py |
# Copyright (c) 2021-present, Facebook, Inc.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
#
import gym
import pytest
import bisk
@pytest.fixture
def env():
env = gym.make('BiskGaps-v1', robot='testcube')
obs, _ = env.reset(seed... | bipedal-skills-main | tests/test_gaps.py |
# Copyright (c) 2021-present, Facebook, Inc.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
#
__version__ = "2.0"
from gym.envs.registration import register
from bisk.base import BiskEnv
from bisk.single_robot import BiskSingleRobotEnv
... | bipedal-skills-main | bisk/__init__.py |
# gym.utils.seeding from gym 0.18.3
# Released under an MIT license
# (https://github.com/openai/gym/blob/0.18.3/LICENSE.md)
#
# This is provided for consistency as seeding changed with gym 0.26.
import hashlib
import numpy as np
import os
import random as _random
import struct
import sys
from gym import error
def n... | bipedal-skills-main | bisk/legacy_seeding.py |
# Copyright (c) 2021-present, Facebook, Inc.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
#
import logging
from typing import Iterable, List
import gym
import numpy as np
from bisk.base import BiskEnv
from bisk.features import make_feat... | bipedal-skills-main | bisk/single_robot.py |
# Copyright (c) 2021-present, Facebook, Inc.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
#
import os
from typing import Tuple, Iterable
import logging
import numpy as np
from gym.utils import seeding
log = logging.getLogger(__name__)
... | bipedal-skills-main | bisk/helpers.py |
# Copyright (c) 2021-present, Facebook, Inc.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
#
import logging
from typing import Optional
import gym
import numpy as np
from bisk import legacy_seeding as seeding
log = logging.getLogger(__n... | bipedal-skills-main | bisk/base.py |
# Copyright (c) 2022-present, Facebook, Inc.
#
# 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 gym
import numpy as np
from dm_control.utils import rewards
from bisk.single_robot import BiskSingleRobotEnv
log = loggin... | bipedal-skills-main | bisk/tasks/velocitycontrol.py |
# Copyright (c) 2021-present, Facebook, Inc.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
#
import logging
from bisect import bisect_left
from typing import Dict, List, Union
import gym
import numpy as np
from dm_control import mjcf
fro... | bipedal-skills-main | bisk/tasks/hurdleslimbo.py |
# Copyright (c) 2022-present, Facebook, Inc.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
#
import logging
from bisect import bisect_left
from typing import List
import gym
import numpy as np
from dm_control import mjcf
from dm_control.m... | bipedal-skills-main | bisk/tasks/butterflies.py |
# Copyright (c) 2021-present, Facebook, Inc.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
#
import logging
from bisect import bisect_left
from typing import List
import gym
import numpy as np
from dm_control import mjcf
from dm_control.m... | bipedal-skills-main | bisk/tasks/polebalance.py |
# Copyright (c) 2021-present, Facebook, Inc.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
#
import logging
from bisect import bisect_left
from typing import Dict, List, Union
import gym
import numpy as np
from dm_control import mjcf
fro... | bipedal-skills-main | bisk/tasks/limbo.py |
# Copyright (c) 2021-present, Facebook, Inc.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
#
import logging
from bisect import bisect_left
import gym
import numpy as np
from dm_control import mjcf
from dm_control.utils import rewards
fro... | bipedal-skills-main | bisk/tasks/goalwall.py |
# Copyright (c) 2021-present, Facebook, Inc.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
#
import logging
from bisect import bisect_left
import gym
import numpy as np
from dm_control import mjcf
from bisk.single_robot import BiskSingle... | bipedal-skills-main | bisk/tasks/hurdles.py |
# Copyright (c) 2021-present, Facebook, Inc.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
#
import logging
from bisect import bisect_left
import gym
import numpy as np
from dm_control import mjcf
from bisk.single_robot import BiskSingle... | bipedal-skills-main | bisk/tasks/stairs.py |
bipedal-skills-main | bisk/tasks/__init__.py | |
# Copyright (c) 2022-present, Facebook, Inc.
#
# 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 gym
import numpy as np
from dm_control import mjcf
from dm_control.utils import rewards
from bisk.single_robot import Bisk... | bipedal-skills-main | bisk/tasks/gototarget.py |
# Copyright (c) 2022-present, Facebook, Inc.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
#
import numpy as np
from bisk.single_robot import BiskSingleRobotEnv
class BiskRunDirEnv(BiskSingleRobotEnv):
'''
Dense-reward task: mov... | bipedal-skills-main | bisk/tasks/rundir.py |
# Copyright (c) 2021-present, Facebook, Inc.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
#
import logging
from bisect import bisect_left
import gym
import numpy as np
from dm_control import mjcf
from bisk.helpers import asset_path
from... | bipedal-skills-main | bisk/tasks/gaps.py |
# Copyright (c) 2021-present, Facebook, Inc.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
#
from bisk.features.base import Featurizer
_registry = {}
def register_featurizer(name, cls):
global _registry
_registry[name] = cls
d... | bipedal-skills-main | bisk/features/__init__.py |
# Copyright (c) 2021-present, Facebook, Inc.
#
# 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 re
from typing import List, Set
import gym
import numpy as np
from bisk.features.base import Featurizer
class JointsFeat... | bipedal-skills-main | bisk/features/joints.py |
# Copyright (c) 2021-present, Facebook, Inc.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
#
import logging
from typing import Dict, List
import gym
import numpy as np
log = logging.getLogger(__name__)
class Featurizer:
n_qpos: Dic... | bipedal-skills-main | bisk/features/base.py |
# Copyright (c) 2021-present, Facebook, Inc.
#
# 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 time
import gym
from dm_control import _render
from dm_control.viewer import gui, renderer, viewer, views
import bisk
pa... | bipedal-skills-main | exp/testgui.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import os
import yaml
def load_configs(file_path, ws_dir):
with open(file_path, 'r') as f:
config_dict = yaml... | AutoAvatar-main | utils/configs.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import numpy as np
import os
import torch
import pickle
from pytorch3d.io import load_ply
# Classes ---------------------... | AutoAvatar-main | utils/DFaust.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import numpy as np
import os
import torch
import torch.nn as nn
import torch.nn.functional as F
from pytorch3d.renderer imp... | AutoAvatar-main | utils/render.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import os
import torch
def load_components(model, ckpt_dir, ckpt_itr, name):
state_dict = model.state_dict()
ckpt... | AutoAvatar-main | utils/io.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
# import openvdb as vdb
import numpy as np
import os
import torch
import torch.nn.functional as F
import math
from skimage ... | AutoAvatar-main | utils/implicit.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import numpy as np
import pickle
import os
import torch
import torch.nn.functional as F
from pytorch3d.ops import norm_lapl... | AutoAvatar-main | utils/CAPE.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import numpy as np
import os
import copy
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn.m... | AutoAvatar-main | models/nets.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import pickle
import numpy as np
import os
import copy
import shutil, inspect
import torch
import torch.nn.functional as F
... | AutoAvatar-main | models/std/trainbox.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import pickle
import numpy as np
import os
import matplotlib.pyplot as plt
import torch
import torch.nn as nn
import torch.... | AutoAvatar-main | models/std/visual.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import numpy as np
import os
import copy
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.au... | AutoAvatar-main | models/std/nets.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import pickle
import numpy as np
import os
import copy
import shutil, inspect
import torch
import torch.nn.functional as F
... | AutoAvatar-main | models/PosedDecKNN_dPoses_dHs/trainbox.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import numpy as np
import os
import copy
import matplotlib.pyplot as plt
import torch
import torch.nn as nn
import torch.nn... | AutoAvatar-main | models/PosedDecKNN_dPoses_dHs/nets.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import numpy as np
import os
import torch
from torch.utils.data import DataLoader
import pickle
import datetime
import shut... | AutoAvatar-main | exps/PosedDecKNN_dPoses_dHs/implicit_eval_dfaust.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import numpy as np
import os
import torch
from torch.utils.data import DataLoader
import pickle
import datetime
import shut... | AutoAvatar-main | exps/PosedDecKNN_dPoses_dHs/implicit_train_dfaust.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import numpy as np
import os
import copy
import torch
from torch.utils.data import Dataset
from pytorch3d.io import load_pl... | AutoAvatar-main | data/CAPE_dataset.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import torch
import numpy as np
import h5py
import sys
import os
import copy
import pickle
import yaml
import smplx
import ... | AutoAvatar-main | data/DFaust_generate.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import numpy as np
import os
import copy
import pickle
import torch
from torch.utils.data import Dataset
from pytorch3d.io ... | AutoAvatar-main | data/DFaust_dataset.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import os
import numpy as np
import pickle
import utils.CAPE as cape_utils
def CAPE_parse_raw(raw_dataset_dir, out_dir, ... | AutoAvatar-main | data/CAPE_generate.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import numpy as np
import os
import copy
import pickle
import torch
from torch.utils.data import Dataset
from pytorch3d.io ... | AutoAvatar-main | data/Aist_dataset.py |
from setuptools import setup
if __name__ == "__main__":
setup(name='flyingsquid',
version='0.0.0a0',
description='Weak supervision with triplet methods',
url='https://github.com/HazyResearch/flyingsquid',
author='Dan Fu',
author_email='danfu@cs.stanford.edu',
... | flyingsquid-master | setup.py |
from pgmpy.models import MarkovModel
from pgmpy.factors.discrete import JointProbabilityDistribution, DiscreteFactor
from itertools import combinations
from flyingsquid.helpers import *
from flyingsquid import _triplets
from flyingsquid import _graphs
from flyingsquid import _observables
from flyingsquid import _lm_par... | flyingsquid-master | flyingsquid/label_model.py |
from pgmpy.models import MarkovModel
from pgmpy.factors.discrete import JointProbabilityDistribution, DiscreteFactor
from itertools import combinations
from flyingsquid.helpers import *
import numpy as np
import math
from tqdm import tqdm
import sys
import random
class Mixin:
'''
Triplet algorithms as a Mixin.... | flyingsquid-master | flyingsquid/_triplets.py |
from pgmpy.models import MarkovModel
from pgmpy.factors.discrete import JointProbabilityDistribution, DiscreteFactor
from itertools import combinations
from flyingsquid.helpers import *
import numpy as np
import math
from tqdm import tqdm
import sys
import random
class Mixin:
'''
Functions to check whether we ... | flyingsquid-master | flyingsquid/_graphs.py |
from flyingsquid.label_model import LabelModel
import torch
import torch.nn as nn
class FSLoss(nn.Module):
'''
Expose FlyingSquid as a loss function.
The loss function takes sequences: one sequence of outputs of your end model,
and another sequence of LF votes.
Let `v` be the length of the seq... | flyingsquid-master | flyingsquid/pytorch_loss.py |
flyingsquid-master | flyingsquid/__init__.py | |
from pgmpy.models import MarkovModel
from pgmpy.factors.discrete import JointProbabilityDistribution, DiscreteFactor
from itertools import combinations
from flyingsquid.helpers import *
import numpy as np
import math
from tqdm import tqdm
import sys
import random
class Mixin:
'''
Functions to compute label mod... | flyingsquid-master | flyingsquid/_lm_parameters.py |
from itertools import product
def dict_product(d):
keys = d.keys()
for element in product(*d.values()):
yield dict(zip(keys, element)) | flyingsquid-master | flyingsquid/helpers.py |
from pgmpy.models import MarkovModel
from pgmpy.factors.discrete import JointProbabilityDistribution, DiscreteFactor
from itertools import combinations
from flyingsquid.helpers import *
import numpy as np
import math
from tqdm import tqdm
import sys
import random
class Mixin:
'''
Functions to compute observabl... | flyingsquid-master | flyingsquid/_observables.py |
'''
This example code shows how to use the PyTorch integration for online training
(example data loaders and training loop).
This code is only provided as a reference. In a real application, you would
need to load in actual image paths to train over.
'''
from flyingsquid.label_model import LabelModel
from flyingsquid... | flyingsquid-master | examples/03_pytorch_integration.py |
'''
This example code shows how to train a FlyingSquid label model for video data.
It loads some labeling functions to detect Tennis Rallies from the tutorials
folder, and trains up a label model.
You can run this file from the examples folder.
'''
from flyingsquid.label_model import LabelModel
import numpy as np
L... | flyingsquid-master | examples/02_video.py |
'''
This example code shows a bare-minimum example of how to get FlyingSquid up and
running.
It generates synthetic data from the tutorials folder, and trains up a label
model.
You can run this file from the examples folder.
'''
from flyingsquid.label_model import LabelModel
from tutorials.tutorial_helpers import *
... | flyingsquid-master | examples/01_basics.py |
flyingsquid-master | examples/tutorials/__init__.py | |
import numpy as np
from numpy.random import seed, rand
import itertools
def exponential_family (lam, y, theta, theta_y):
# without normalization
return np.exp(theta_y * y + y * np.dot(theta, lam))
# create vector describing cumulative distribution of lambda_1, ... lambda_m, Y
def make_pdf(m, v, theta, theta_y... | flyingsquid-master | examples/tutorials/tutorial_helpers.py |
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import argparse
import builtins
import math
import os
import random
import shutil
import time
import warnings
import sys
import operator
from datetime import date
import torch
import torch.nn as nn
#from torch.utils.tensorboard import SummaryWrite... | AttentiveNAS-main | train_attentive_nas.py |
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import argparse
import builtins
import math
import os
import random
import shutil
import time
import warnings
import sys
from datetime import date
import torch
import torch.nn as nn
import torch.nn.parallel
import torch.backends.cudnn as cudnn
imp... | AttentiveNAS-main | test_attentive_nas.py |
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
# Implementation adapted from Slimmable - https://github.com/JiahuiYu/slimmable_networks
import torch
class CrossEntropyLossSoft(torch.nn.modules.loss._Loss):
""" inplace distillation for image classification """
def forward(self, output, ... | AttentiveNAS-main | utils/loss_ops.py |
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import atexit
import builtins
import decimal
import functools
import logging
import os
import sys
from .comm import is_master_process as is_master_proc
def _suppress_print():
"""
Suppresses printing from the current process.
"""
d... | AttentiveNAS-main | utils/logging.py |
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
# implementation adapted from Slimmable: https://github.com/JiahuiYu/slimmable_networks
"""config utilities for yml file."""
import os
import sys
import yaml
class LoaderMeta(type):
"""Constructor for supporting `!include`.
"""
def __... | AttentiveNAS-main | utils/config.py |
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import functools
import logging
import pickle
import torch
import torch.distributed as dist
def get_world_size():
if not dist.is_available():
return 1
if not dist.is_initialized():
return 1
return dist.get_world_size()... | AttentiveNAS-main | utils/comm.py |
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
from copy import deepcopy
import torch
import os
import shutil
import joblib
def copy_file(source_path, target_path):
shutil.copyfile(source_path, target_path)
def save_acc_predictor(args, acc_predictor):
args.curr_acc_predictor_path = o... | AttentiveNAS-main | utils/saver.py |
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
# Implementation adapted from OFA - https://github.com/mit-han-lab/once-for-all
import torch
import torch.nn as nn
import copy
multiply_adds = 1
def count_convNd(m, _, y):
cin = m.in_channels
kernel_ops = m.weight.size()[2] * m.weight.... | AttentiveNAS-main | utils/flops_counter.py |
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import sys
import torch
import torch.nn as nn
class AverageMeter(object):
"""Computes and stores the average and current value"""
def __init__(self, name, fmt=':f'):
self.name = name
self.fmt = fmt
self.reset()
... | AttentiveNAS-main | utils/progress.py |
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
# Implementation adapted from OFA: https://github.com/mit-han-lab/once-for-all
import copy
import random
import collections
import math
import torch
import torch.nn as nn
from .modules.dynamic_layers import DynamicMBConvLayer, DynamicConvBnActLay... | AttentiveNAS-main | models/attentive_nas_dynamic_model.py |
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
from .model_factory import *
| AttentiveNAS-main | models/__init__.py |
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
# adapted from OFA: https://github.com/mit-han-lab/once-for-all
import torch
import torch.nn as nn
from torch.autograd import Variable
import torch.nn.functional as F
import math
from .modules.static_layers import set_layer_from_config, MBInverte... | AttentiveNAS-main | models/attentive_nas_static_model.py |
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
from .attentive_nas_dynamic_model import AttentiveNasDynamicModel
def create_model(args, arch=None):
n_classes = int(getattr(args, 'n_classes', 1000))
bn_momentum = getattr(args, 'bn_momentum', 0.1)
bn_eps = getattr(args, 'bn_eps', 1e... | AttentiveNAS-main | models/model_factory.py |
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
# adapted from OFA: https://github.com/mit-han-lab/once-for-all
from collections import OrderedDict
import torch.nn as nn
from .nn_utils import get_same_padding, build_activation, make_divisible, drop_connect
from .nn_base import MyModule
from .act... | AttentiveNAS-main | models/modules/static_layers.py |
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
# adapted from OFA: https://github.com/mit-han-lab/once-for-all
import math
import torch
import torch.nn as nn
try:
from fvcore.common.file_io import PathManager
except:
pass
class MyModule(nn.Module):
def forward(self, x):
... | AttentiveNAS-main | models/modules/nn_base.py |
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
# adapted from OFA: https://github.com/mit-han-lab/once-for-all
import torch
import torch.nn as nn
import torch.nn.functional as F
# A memory-efficient implementation of Swish function
class SwishImplementation(torch.autograd.Function):
@stati... | AttentiveNAS-main | models/modules/activations.py |
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
# adapted from OFA: https://github.com/mit-han-lab/once-for-all
from collections import OrderedDict
import copy
import torch
import torch.nn as nn
import torch.nn.functional as F
from .static_layers import MBInvertedConvLayer, ConvBnActLayer, Lin... | AttentiveNAS-main | models/modules/dynamic_layers.py |
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
| AttentiveNAS-main | models/modules/__init__.py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.