repo stringlengths 2 99 | file stringlengths 13 225 | code stringlengths 0 18.3M | file_length int64 0 18.3M | avg_line_length float64 0 1.36M | max_line_length int64 0 4.26M | extension_type stringclasses 1
value |
|---|---|---|---|---|---|---|
Quantum | Quantum-master/applications/intent_classification/intent_classification.py | # !/usr/bin/env python3
# Copyright (c) 2023 Institute for Quantum Computing, Baidu Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/lic... | 1,511 | 35 | 94 | py |
Quantum | Quantum-master/applications/handwritten_digits_classification/vsql_classification.py | # !/usr/bin/env python3
# Copyright (c) 2022 Institute for Quantum Computing, Baidu Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/lic... | 1,940 | 37.058824 | 108 | py |
Quantum | Quantum-master/applications/quality_detection/qnn_quality_detection.py | # !/usr/bin/env python3
# Copyright (c) 2020 Institute for Quantum Computing, Baidu Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/lic... | 1,524 | 36.195122 | 128 | py |
Quantum | Quantum-master/applications/portfolio_optimization/qpo.py | # !/usr/bin/env python3
# Copyright (c) 2021 Institute for Quantum Computing, Baidu Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/lic... | 4,377 | 42.346535 | 129 | py |
Quantum | Quantum-master/applications/linear_solver/vqls.py | # !/usr/bin/env python3
# Copyright (c) 2020 Institute for Quantum Computing, Baidu Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/lic... | 1,818 | 32.685185 | 93 | py |
Quantum | Quantum-master/applications/regression/vqr_analysis.py | # !/usr/bin/env python3
# Copyright (c) 2022 Institute for Quantum Computing, Baidu Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/lic... | 1,712 | 33.26 | 99 | py |
Quantum | Quantum-master/applications/protein_folding/folding_protein.py | # !/usr/bin/env python3
# Copyright (c) 2021 Institute for Quantum Computing, Baidu Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the 'License');
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/lic... | 3,328 | 37.264368 | 111 | py |
upLCP_solver | upLCP_solver-master/read_flags.py | ###############################################################################
#
# Author: Nathan Adelgren
# Affiliation: Andlinger Center For Energy and the Environment
# Princeton University
#
# Purpose: Read in and set parameters passed from the command line in
# ... | 3,732 | 41.908046 | 195 | py |
upLCP_solver | upLCP_solver-master/matrix_manipulation.py | ###############################################################################
#
# Author: Nathan Adelgren
# Affiliation: Andlinger Center For Energy and the Environment
# Princeton University
#
# Purpose: Perform matrix manipulations -- primarily principal pivots.
# ... | 2,012 | 30.453125 | 80 | py |
upLCP_solver | upLCP_solver-master/crisscross.py | ###############################################################################
#
# Author: Nathan Adelgren
# Affiliation: Andlinger Center For Energy and the Environment
# Princeton University
#
# Purpose: Use the criss cross method for the Linear Complementary
# ... | 6,822 | 48.086331 | 473 | py |
upLCP_solver | upLCP_solver-master/read_problem.py | ###############################################################################
#
# Author: Nathan Adelgren
# Affiliation: Andlinger Center For Energy and the Environment
# Princeton University
#
# Purpose: Read in and solve an instance of the multiparametric
# ... | 25,489 | 58.27907 | 312 | py |
upLCP_solver | upLCP_solver-master/up_inv_region.py | ###############################################################################
#
# Author: Nathan Adelgren
# Affiliation: Andlinger Center For Energy and the Environment
# Princeton University
#
# Purpose: Define the class to be associated with an invariancy region.
#
########... | 4,359 | 35.033058 | 107 | py |
upLCP_solver | upLCP_solver-master/upLCP_solver.py | ###############################################################################
#
# Author: Nathan Adelgren
# Affiliation: Andlinger Center For Energy and the Environment
# Princeton University
#
# Purpose: To read in and solve an instance of the uni-parametric
# ... | 13,456 | 45.243986 | 404 | py |
SWTD3 | SWTD3-main/main.py | import argparse
import os
import socket
import gym
import numpy as np
import torch
import TD3
import SWTD3
import utils
# Runs policy for X episodes and returns average reward
# A fixed seed is used for the eval environment
def evaluate_policy(agent, env_name, seed, eval_episodes=10):
eval_env = gym.make(env_na... | 6,850 | 41.552795 | 118 | py |
SWTD3 | SWTD3-main/utils.py | import numpy as np
import torch
class ExperienceReplayBuffer(object):
def __init__(self, state_dim, action_dim, max_size=int(1e6)):
self.max_size = max_size
self.ptr = 0
self.size = 0
self.state = np.zeros((max_size, state_dim))
self.action = np.zeros((max_size, action_dim... | 1,398 | 34.871795 | 82 | py |
SWTD3 | SWTD3-main/TD3.py | import copy
import torch
import torch.nn as nn
import torch.nn.functional as F
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
# Implementation of the Twin Delayed Deep Deterministic Policy Gradient algorithm (TD3)
# Paper: https://arxiv.org/abs/1802.09477
# Note: This implementation heavily r... | 5,894 | 34.512048 | 107 | py |
SWTD3 | SWTD3-main/SWTD3.py | import copy
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
# Implementation of the Stochastic Weighted Twin Delayed Deep Deterministic Policy Gradient algorithm (SWTD3)
# Note: This implementation heavily re... | 6,521 | 35.033149 | 118 | py |
multigen | multigen-master/evaluation/eval_story.py | from typing import List, Dict
import sys
import collections
import math
import csv
import spacy
from tqdm import tqdm
from collections import Counter
def get_ngram_counter(text, n):
"""
Returns a counter, indicating how many times each n-gram appeared in text.
Note: this function does NOT lowercase text. I... | 6,887 | 33.964467 | 147 | py |
multigen | multigen-master/evaluation/eval.py | from bleu.bleu import Bleu
from meteor.meteor_nltk import Meteor
from rouge.rouge import Rouge
from cider.cider import Cider
from collections import defaultdict
from argparse import ArgumentParser
import csv
import os
import sys
import json
import random
#reload(sys)
#sys.setdefaultencoding('utf-8')
class QGEvalCap:
... | 4,739 | 25.779661 | 79 | py |
multigen | multigen-master/evaluation/__init__.py | 0 | 0 | 0 | py | |
multigen | multigen-master/evaluation/meteor/meteor_nltk.py | #!/usr/bin/env python
# Python wrapper for METEOR implementation, by Xinlei Chen
# Acknowledge Michael Denkowski for the generous discussion and help
import os
import sys
import nltk
from nltk.translate.meteor_score import meteor_score
# Assumes meteor-1.5.jar is in the same directory as meteor.py. Change as neede... | 1,176 | 26.372093 | 82 | py |
multigen | multigen-master/evaluation/meteor/meteor.py | #!/usr/bin/env python
# Python wrapper for METEOR implementation, by Xinlei Chen
# Acknowledge Michael Denkowski for the generous discussion and help
import os
import sys
import subprocess
import threading
# Assumes meteor-1.5.jar is in the same directory as meteor.py. Change as needed.
METEOR_JAR = 'meteor-1.5.ja... | 3,467 | 36.695652 | 106 | py |
multigen | multigen-master/evaluation/meteor/__init__.py | __author__ = 'tylin'
| 21 | 10 | 20 | py |
multigen | multigen-master/evaluation/rouge/rouge.py | #!/usr/bin/env python
#
# File Name : rouge.py
#
# Description : Computes ROUGE-L metric as described by Lin and Hovey (2004)
#
# Creation Date : 2015-01-07 06:03
# Author : Ramakrishna Vedantam <vrama91@vt.edu>
import numpy as np
import pdb
def my_lcs(string, sub):
"""
Calculates longest common subsequence ... | 3,643 | 33.377358 | 123 | py |
multigen | multigen-master/evaluation/rouge/__init__.py | __author__ = 'vrama91'
| 23 | 11 | 22 | py |
multigen | multigen-master/evaluation/cider/cider_scorer.py | #!/usr/bin/env python
# Tsung-Yi Lin <tl483@cornell.edu>
# Ramakrishna Vedantam <vrama91@vt.edu>
import copy
from collections import defaultdict
import numpy as np
import pdb
import math
def precook(s, n=4, out=False):
"""
Takes a string as input and returns an object that can be given to
either cook_refs... | 7,681 | 38.803109 | 116 | py |
multigen | multigen-master/evaluation/cider/__init__.py | __author__ = 'tylin'
| 21 | 10 | 20 | py |
multigen | multigen-master/evaluation/cider/cider.py | # Filename: cider.py
#
# Description: Describes the class to compute the CIDEr (Consensus-Based Image Description Evaluation) Metric
# by Vedantam, Zitnick, and Parikh (http://arxiv.org/abs/1411.5726)
#
# Creation Date: Sun Feb 8 14:16:54 2015
#
# Authors: Ramakrishna Vedantam <vrama91@vt.edu> and Tsung... | 1,677 | 29.509091 | 121 | py |
multigen | multigen-master/evaluation/bleu/bleu_scorer.py | #!/usr/bin/env python
# bleu_scorer.py
# David Chiang <chiang@isi.edu>
# Copyright (c) 2004-2006 University of Maryland. All rights
# reserved. Do not redistribute without permission from the
# author. Not for commercial use.
# Modified by:
# Hao Fang <hfang@uw.edu>
# Tsung-Yi Lin <tl483@cornell.edu>
'''Provides:
... | 8,704 | 31.849057 | 150 | py |
multigen | multigen-master/evaluation/bleu/bleu.py | #!/usr/bin/env python
#
# File Name : bleu.py
#
# Description : Wrapper for BLEU scorer.
#
# Creation Date : 06-01-2015
# Last Modified : Thu 19 Mar 2015 09:13:28 PM PDT
# Authors : Hao Fang <hfang@uw.edu> and Tsung-Yi Lin <tl483@cornell.edu>
from bleu.bleu_scorer import BleuScorer
class Bleu:
def __init__(self... | 1,251 | 25.083333 | 79 | py |
multigen | multigen-master/evaluation/bleu/__init__.py | __author__ = 'tylin'
| 21 | 10 | 20 | py |
multigen | multigen-master/scripts/main.py | from __future__ import absolute_import, division, print_function
import json
import argparse
import glob
import logging
import os
import pickle
import random
import re
import shutil
import subprocess
from typing import List, Dict
import csv
import logging
import sys
import collections
import math
import spacy
import n... | 26,926 | 42.360709 | 239 | py |
multigen | multigen-master/scripts/optimization.py | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICEN... | 8,634 | 44.687831 | 130 | py |
multigen | multigen-master/scripts/dictionary.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from collections import Counter
from multiprocessing import Pool
import os
import torch
from fairseq.tokenizer import tokenize_line
from fai... | 10,932 | 33.05919 | 109 | py |
multigen | multigen-master/scripts/modeling_gpt2.py | # coding=utf-8
# Copyright 2018 The OpenAI Team Authors and HuggingFace Inc. team.
# Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License... | 50,225 | 46.788773 | 148 | py |
multigen | multigen-master/scripts/data.py | import torch
import os
import json
import logging
import csv
import itertools
from torch.utils.data import Dataset
import random
from transformers import BertTokenizer
logger = logging.getLogger()
def normalize_case(text):
if len(text) > 1:
try:
normalized = text[0].upper() + text[1:].lower()... | 9,321 | 38.004184 | 151 | py |
multigen | multigen-master/scripts/tokenization_gpt2.py | # coding=utf-8
# Copyright 2018 The Open AI Team Authors and The HuggingFace Inc. team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# ... | 9,814 | 40.944444 | 182 | py |
multigen | multigen-master/scripts/seq_generator.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import math
import torch
from fairseq import search, utils
from fairseq.data import data_utils
from fairseq.models import FairseqIncremental... | 33,724 | 41.36809 | 136 | py |
multigen | multigen-master/scripts/add_special_tokens.py | import json
f = open('../models/gpt2-small/gpt2-vocab.json', 'r')
vocab = json.load(f)
f.close()
vocab["<|bos|>"] = len(vocab)
vocab["<|pad|>"] = len(vocab)
print(len(vocab))
f = open('../models/gpt2-small/vocab.json', 'w')
vocab = json.dump(vocab, f)
f.close()
| 265 | 18 | 53 | py |
multigen | multigen-master/preprocess/find_neighbours.py | import configparser
import networkx as nx
import itertools
import math
import random
import json
from tqdm import tqdm
import sys
import time
import timeit
import numpy as np
import torch
from collections import Counter
import spacy
from scipy import spatial
import sys
config = configparser.ConfigParser()
config.read(... | 6,759 | 29.86758 | 117 | py |
multigen | multigen-master/preprocess/ground_concepts_simple.py | import configparser
import json
import csv
import spacy
from spacy.matcher import Matcher
import sys
import timeit
from tqdm import tqdm
import numpy as np
import multiprocessing
import sys
blacklist = set(["from", "as", "more", "either", "in", "and", "on", "an", "when", "too", "to", "i", "do", "can", "be", "that", "... | 12,346 | 87.827338 | 8,272 | py |
multigen | multigen-master/preprocess/filter_triple.py | import json
from tqdm import tqdm
import collections
import configparser
import sys
config = configparser.ConfigParser()
config.read("paths.cfg")
def read_json(filename):
data = []
with open(filename, 'r') as f:
for line in f.readlines():
data.append(json.loads(line))
return data
def ... | 4,390 | 27.329032 | 94 | py |
multigen | multigen-master/preprocess/graph_construction.py | import configparser
import networkx as nx
import itertools
import math
import random
import json
from tqdm import tqdm
import sys
import time
import timeit
import nltk
import json
# print('NLTK Version: %s' % (nltk.__version__))
nltk.download('stopwords')
nltk_stopwords = nltk.corpus.stopwords.words('english')
nltk_sto... | 2,646 | 30.511905 | 104 | py |
multigen | multigen-master/preprocess/extract_cpnet.py | import configparser
import json
relation_mapping = dict()
def load_merge_relation():
config = configparser.ConfigParser()
config.read("paths.cfg")
with open(config["paths"]["merge_relation"], encoding="utf8") as f:
for line in f.readlines():
ls = line.strip().split('/')
re... | 2,707 | 32.02439 | 120 | py |
ActiveRagdollControllers | ActiveRagdollControllers-master/python/learn.py | # # Unity ML-Agents Toolkit
# ## ML-Agent Learning
import logging
import os
import multiprocessing
import numpy as np
from docopt import docopt
from unitytrainers.trainer_controller import TrainerController
from unitytrainers.exception import TrainerError
def run_training(sub_id, use_seed, options):
# Docker P... | 4,598 | 38.646552 | 117 | py |
ActiveRagdollControllers | ActiveRagdollControllers-master/python/setup.py | #!/usr/bin/env python
from setuptools import setup, Command, find_packages
with open('requirements.txt') as f:
required = f.read().splitlines()
setup(name='unityagents',
version='0.4.0',
description='Unity Machine Learning Agents',
license='Apache License 2.0',
author='Unity Technologies... | 874 | 37.043478 | 93 | py |
ActiveRagdollControllers | ActiveRagdollControllers-master/python/unityagents/environment.py | import atexit
import glob
import io
import logging
import numpy as np
import os
import subprocess
from .brain import BrainInfo, BrainParameters, AllBrainInfo
from .exception import UnityEnvironmentException, UnityActionException, UnityTimeOutException
from communicator_objects import UnityRLInput, UnityRLOutput, Agen... | 26,255 | 49.011429 | 120 | py |
ActiveRagdollControllers | ActiveRagdollControllers-master/python/unityagents/curriculum.py | import json
from .exception import UnityEnvironmentException
import logging
logger = logging.getLogger("unityagents")
class Curriculum(object):
def __init__(self, location, default_reset_parameters):
"""
Initializes a Curriculum object.
:param location: Path to JSON defining curriculum.... | 4,404 | 40.952381 | 105 | py |
ActiveRagdollControllers | ActiveRagdollControllers-master/python/unityagents/exception.py | import logging
logger = logging.getLogger("unityagents")
class UnityException(Exception):
"""
Any error related to ml-agents environment.
"""
pass
class UnityEnvironmentException(UnityException):
"""
Related to errors starting and closing environment.
"""
pass
class UnityActionExcept... | 1,636 | 31.74 | 101 | py |
ActiveRagdollControllers | ActiveRagdollControllers-master/python/unityagents/socket_communicator.py | import logging
import socket
import struct
from .communicator import Communicator
from communicator_objects import UnityMessage, UnityOutput, UnityInput
from .exception import UnityTimeOutException
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger("unityagents")
class SocketCommunicator(Communicat... | 4,009 | 39.505051 | 120 | py |
ActiveRagdollControllers | ActiveRagdollControllers-master/python/unityagents/__init__.py | from .environment import *
from .brain import *
from .exception import *
| 73 | 17.5 | 26 | py |
ActiveRagdollControllers | ActiveRagdollControllers-master/python/unityagents/communicator.py | import logging
from communicator_objects import UnityOutput, UnityInput
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger("unityagents")
class Communicator(object):
def __init__(self, worker_id=0, base_port=5005):
"""
Python side of the communication. Must be used in pair with t... | 1,355 | 35.648649 | 114 | py |
ActiveRagdollControllers | ActiveRagdollControllers-master/python/unityagents/brain.py | from typing import Dict
class BrainInfo:
def __init__(self, visual_observation, vector_observation, text_observations, memory=None,
reward=None, agents=None, local_done=None,
vector_action=None, text_action=None, max_reached=None):
"""
Describes experience at curr... | 2,602 | 45.482143 | 104 | py |
ActiveRagdollControllers | ActiveRagdollControllers-master/python/unityagents/rpc_communicator.py | import logging
import grpc
from multiprocessing import Pipe
from concurrent.futures import ThreadPoolExecutor
from .communicator import Communicator
from communicator_objects import UnityToExternalServicer, add_UnityToExternalServicer_to_server
from communicator_objects import UnityMessage, UnityInput, UnityOutput
fr... | 3,863 | 38.030303 | 114 | py |
ActiveRagdollControllers | ActiveRagdollControllers-master/python/tests/test_trainer_controller.py | import json
import unittest.mock as mock
import yaml
import pytest
import tensorflow as tf
from unitytrainers.trainer_controller import TrainerController
from unitytrainers.buffer import Buffer
from unitytrainers.ppo.trainer import PPOTrainer
from unitytrainers.bc.trainer import BehavioralCloningTrainer
from unitytra... | 6,598 | 34.101064 | 90 | py |
ActiveRagdollControllers | ActiveRagdollControllers-master/python/tests/test_curriculum.py | import pytest
import json
from unittest.mock import patch, mock_open
from unitytrainers.exception import CurriculumError
from unitytrainers import Curriculum
dummy_curriculum_json_str = '''
{
"measure" : "reward",
"thresholds" : [10, 20, 50],
"min_lesson_length" : 3,
"signal_smoot... | 2,853 | 29.361702 | 100 | py |
ActiveRagdollControllers | ActiveRagdollControllers-master/python/tests/test_unityagents.py | import unittest.mock as mock
import pytest
import struct
import numpy as np
from unityagents import UnityEnvironment, UnityEnvironmentException, UnityActionException, \
BrainInfo
from .mock_communicator import MockCommunicator
def test_handles_bad_filename():
with pytest.raises(UnityEnvironmentException):
... | 4,037 | 41.0625 | 109 | py |
ActiveRagdollControllers | ActiveRagdollControllers-master/python/tests/mock_communicator.py |
from unityagents.communicator import Communicator
from communicator_objects import UnityMessage, UnityOutput, UnityInput,\
ResolutionProto, BrainParametersProto, UnityRLInitializationOutput,\
AgentInfoProto, UnityRLOutput
class MockCommunicator(Communicator):
def __init__(self, discrete_action=False, vis... | 3,366 | 34.072917 | 114 | py |
ActiveRagdollControllers | ActiveRagdollControllers-master/python/tests/test_buffer.py | import json
import unittest.mock as mock
import yaml
import pytest
import numpy as np
from unitytrainers.trainer_controller import TrainerController
from unitytrainers.buffer import Buffer
from unitytrainers.ppo.trainer import PPOTrainer
from unitytrainers.bc.trainer import BehavioralCloningTrainer
from unitytrainers... | 2,208 | 37.754386 | 95 | py |
ActiveRagdollControllers | ActiveRagdollControllers-master/python/tests/__init__.py | from unityagents import *
from unitytrainers import *
| 54 | 17.333333 | 27 | py |
ActiveRagdollControllers | ActiveRagdollControllers-master/python/tests/test_meta_curriculum.py | import pytest
from unittest.mock import patch, call, Mock
from unitytrainers.meta_curriculum import MetaCurriculum
from unitytrainers.exception import MetaCurriculumError
class MetaCurriculumTest(MetaCurriculum):
"""This class allows us to test MetaCurriculum objects without calling
MetaCurriculum's __init__... | 3,848 | 33.990909 | 74 | py |
ActiveRagdollControllers | ActiveRagdollControllers-master/python/tests/test_bc.py | import unittest.mock as mock
import pytest
import numpy as np
import tensorflow as tf
from unitytrainers.bc.models import BehavioralCloningModel
from unityagents import UnityEnvironment
from .mock_communicator import MockCommunicator
@mock.patch('unityagents.UnityEnvironment.executable_launcher')
@mock.patch('unity... | 4,615 | 41.740741 | 72 | py |
ActiveRagdollControllers | ActiveRagdollControllers-master/python/tests/test_ppo.py | import unittest.mock as mock
import pytest
import numpy as np
import tensorflow as tf
from unitytrainers.ppo.models import PPOModel
from unitytrainers.ppo.trainer import discount_rewards
from unityagents import UnityEnvironment
from .mock_communicator import MockCommunicator
@mock.patch('unityagents.UnityEnvironmen... | 13,427 | 45.951049 | 97 | py |
ActiveRagdollControllers | ActiveRagdollControllers-master/python/tests/test_unitytrainers.py | import yaml
import unittest.mock as mock
import pytest
from unitytrainers.trainer_controller import TrainerController
from unitytrainers.buffer import Buffer
from unitytrainers.models import *
from unitytrainers.ppo.trainer import PPOTrainer
from unitytrainers.bc.trainer import BehavioralCloningTrainer
from unityagent... | 7,251 | 32.419355 | 95 | py |
ActiveRagdollControllers | ActiveRagdollControllers-master/python/communicator_objects/unity_rl_output_pb2.py | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: communicator_objects/unity_rl_output.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobu... | 6,849 | 39.05848 | 652 | py |
ActiveRagdollControllers | ActiveRagdollControllers-master/python/communicator_objects/engine_configuration_proto_pb2.py | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: communicator_objects/engine_configuration_proto.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from goo... | 4,604 | 42.037383 | 460 | py |
ActiveRagdollControllers | ActiveRagdollControllers-master/python/communicator_objects/resolution_proto_pb2.py | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: communicator_objects/resolution_proto.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protob... | 3,124 | 35.337209 | 295 | py |
ActiveRagdollControllers | ActiveRagdollControllers-master/python/communicator_objects/command_proto_pb2.py | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: communicator_objects/command_proto.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf.internal import enum_type_wrapper
from google.protobuf import descriptor as _descriptor
from google.pr... | 2,037 | 30.353846 | 255 | py |
ActiveRagdollControllers | ActiveRagdollControllers-master/python/communicator_objects/header_pb2.py | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: communicator_objects/header.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import ... | 2,577 | 31.632911 | 235 | py |
ActiveRagdollControllers | ActiveRagdollControllers-master/python/communicator_objects/unity_to_external_pb2.py | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: communicator_objects/unity_to_external.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.proto... | 2,142 | 35.322034 | 335 | py |
ActiveRagdollControllers | ActiveRagdollControllers-master/python/communicator_objects/agent_info_proto_pb2.py | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: communicator_objects/agent_info_proto.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protob... | 6,189 | 44.851852 | 639 | py |
ActiveRagdollControllers | ActiveRagdollControllers-master/python/communicator_objects/brain_type_proto_pb2.py | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: communicator_objects/brain_type_proto.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf.internal import enum_type_wrapper
from google.protobuf import descriptor as _descriptor
from google... | 2,489 | 33.583333 | 347 | py |
ActiveRagdollControllers | ActiveRagdollControllers-master/python/communicator_objects/unity_output_pb2.py | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: communicator_objects/unity_output.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf i... | 3,616 | 42.059524 | 483 | py |
ActiveRagdollControllers | ActiveRagdollControllers-master/python/communicator_objects/unity_to_external_pb2_grpc.py | # Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
import grpc
from communicator_objects import unity_message_pb2 as communicator__objects_dot_unity__message__pb2
class UnityToExternalStub(object):
# missing associated documentation comment in .proto file
pass
def __init__(self, channel):
... | 1,632 | 33.744681 | 107 | py |
ActiveRagdollControllers | ActiveRagdollControllers-master/python/communicator_objects/brain_parameters_proto_pb2.py | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: communicator_objects/brain_parameters_proto.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.... | 6,803 | 52.15625 | 878 | py |
ActiveRagdollControllers | ActiveRagdollControllers-master/python/communicator_objects/unity_message_pb2.py | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: communicator_objects/unity_message.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf ... | 4,141 | 43.537634 | 539 | py |
ActiveRagdollControllers | ActiveRagdollControllers-master/python/communicator_objects/unity_rl_input_pb2.py | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: communicator_objects/unity_rl_input.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf... | 8,590 | 44.455026 | 968 | py |
ActiveRagdollControllers | ActiveRagdollControllers-master/python/communicator_objects/unity_rl_initialization_output_pb2.py | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: communicator_objects/unity_rl_initialization_output.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from... | 5,289 | 49.380952 | 655 | py |
ActiveRagdollControllers | ActiveRagdollControllers-master/python/communicator_objects/unity_input_pb2.py | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: communicator_objects/unity_input.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf im... | 3,575 | 41.571429 | 475 | py |
ActiveRagdollControllers | ActiveRagdollControllers-master/python/communicator_objects/space_type_proto_pb2.py | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: communicator_objects/space_type_proto.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf.internal import enum_type_wrapper
from google.protobuf import descriptor as _descriptor
from google... | 2,179 | 34.16129 | 291 | py |
ActiveRagdollControllers | ActiveRagdollControllers-master/python/communicator_objects/unity_rl_initialization_input_pb2.py | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: communicator_objects/unity_rl_initialization_input.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from ... | 2,493 | 33.638889 | 242 | py |
ActiveRagdollControllers | ActiveRagdollControllers-master/python/communicator_objects/__init__.py | from .agent_action_proto_pb2 import *
from .agent_info_proto_pb2 import *
from .brain_parameters_proto_pb2 import *
from .brain_type_proto_pb2 import *
from .command_proto_pb2 import *
from .engine_configuration_proto_pb2 import *
from .environment_parameters_proto_pb2 import *
from .header_pb2 import *
from .resolutio... | 720 | 35.05 | 49 | py |
ActiveRagdollControllers | ActiveRagdollControllers-master/python/communicator_objects/environment_parameters_proto_pb2.py | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: communicator_objects/environment_parameters_proto.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from g... | 5,006 | 40.380165 | 458 | py |
ActiveRagdollControllers | ActiveRagdollControllers-master/python/communicator_objects/agent_action_proto_pb2.py | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: communicator_objects/agent_action_proto.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.prot... | 3,612 | 37.849462 | 351 | py |
ActiveRagdollControllers | ActiveRagdollControllers-master/python/unitytrainers/meta_curriculum.py | """Contains the MetaCurriculum class."""
import os
from unitytrainers.curriculum import Curriculum
from unitytrainers.exception import MetaCurriculumError
import logging
logger = logging.getLogger('unitytrainers')
class MetaCurriculum(object):
"""A MetaCurriculum holds curriculums. Each curriculum is associate... | 3,968 | 36.443396 | 111 | py |
ActiveRagdollControllers | ActiveRagdollControllers-master/python/unitytrainers/curriculum.py | import os
import json
from .exception import CurriculumError
import logging
logger = logging.getLogger('unitytrainers')
class Curriculum(object):
def __init__(self, location, default_reset_parameters):
"""
Initializes a Curriculum object.
:param location: Path to JSON defining curriculu... | 4,288 | 39.462264 | 105 | py |
ActiveRagdollControllers | ActiveRagdollControllers-master/python/unitytrainers/exception.py | """
Contains exceptions for the unitytrainers package.
"""
class TrainerError(Exception):
"""
Any error related to the trainers in the ML-Agents Toolkit.
"""
pass
class CurriculumError(TrainerError):
"""
Any error related to training with a curriculum.
"""
pass
class MetaCurriculumErr... | 418 | 18.952381 | 63 | py |
ActiveRagdollControllers | ActiveRagdollControllers-master/python/unitytrainers/buffer.py | import numpy as np
from unityagents.exception import UnityException
class BufferException(UnityException):
"""
Related to errors with the Buffer.
"""
pass
class Buffer(dict):
"""
Buffer contains a dictionary of AgentBuffer. The AgentBuffers are indexed by agent_id.
Buffer also contains ... | 10,778 | 46.276316 | 120 | py |
ActiveRagdollControllers | ActiveRagdollControllers-master/python/unitytrainers/models.py | import logging
import numpy as np
import tensorflow as tf
import tensorflow.contrib.layers as c_layers
logger = logging.getLogger("unityagents")
class LearningModel(object):
def __init__(self, m_size, normalize, use_recurrent, brain):
self.brain = brain
self.vector_in = None
self.normali... | 16,598 | 50.871875 | 123 | py |
ActiveRagdollControllers | ActiveRagdollControllers-master/python/unitytrainers/__init__.py | from .buffer import *
from .curriculum import *
from .meta_curriculum import *
from .models import *
from .trainer_controller import *
from .bc.models import *
from .bc.trainer import *
from .ppo.models import *
from .ppo.trainer import *
from .exception import *
| 264 | 23.090909 | 33 | py |
ActiveRagdollControllers | ActiveRagdollControllers-master/python/unitytrainers/trainer_controller.py | # # Unity ML-Agents Toolkit
# ## ML-Agent Learning
"""Launches unitytrainers for each External Brains in a Unity Environment."""
import os
import logging
import yaml
import re
import numpy as np
import tensorflow as tf
from tensorflow.python.tools import freeze_graph
from unityagents.environment import UnityEnvironme... | 18,801 | 47.963542 | 84 | py |
ActiveRagdollControllers | ActiveRagdollControllers-master/python/unitytrainers/trainer.py | # # Unity ML-Agents Toolkit
import logging
import tensorflow as tf
import numpy as np
from unityagents import UnityException, AllBrainInfo
logger = logging.getLogger("unitytrainers")
class UnityTrainerException(UnityException):
"""
Related to errors with the Trainer.
"""
pass
class Trainer(object... | 7,170 | 40.450867 | 118 | py |
ActiveRagdollControllers | ActiveRagdollControllers-master/python/unitytrainers/ppo/models.py | import logging
import numpy as np
import tensorflow as tf
from unitytrainers.models import LearningModel
logger = logging.getLogger("unityagents")
class PPOModel(LearningModel):
def __init__(self, brain, lr=1e-4, h_size=128, epsilon=0.2, beta=1e-3, max_step=5e6,
normalize=False, use_recurrent=F... | 11,776 | 59.086735 | 118 | py |
ActiveRagdollControllers | ActiveRagdollControllers-master/python/unitytrainers/ppo/__init__.py | from .models import *
from .trainer import *
| 45 | 14.333333 | 22 | py |
ActiveRagdollControllers | ActiveRagdollControllers-master/python/unitytrainers/ppo/trainer.py | # # Unity ML-Agents Toolkit
# ## ML-Agent Learning (PPO)
# Contains an implementation of PPO as described (https://arxiv.org/abs/1707.06347).
import logging
import os
import numpy as np
import tensorflow as tf
from unityagents import AllBrainInfo, BrainInfo
from unitytrainers.buffer import Buffer
from unitytrainers.... | 29,207 | 52.790055 | 120 | py |
ActiveRagdollControllers | ActiveRagdollControllers-master/python/unitytrainers/bc/models.py | import tensorflow as tf
import tensorflow.contrib.layers as c_layers
from unitytrainers.models import LearningModel
class BehavioralCloningModel(LearningModel):
def __init__(self, brain, h_size=128, lr=1e-4, n_layers=2, m_size=128,
normalize=False, use_recurrent=False):
LearningModel.__in... | 3,427 | 61.327273 | 121 | py |
ActiveRagdollControllers | ActiveRagdollControllers-master/python/unitytrainers/bc/__init__.py | from .models import *
from .trainer import *
| 45 | 14.333333 | 22 | py |
ActiveRagdollControllers | ActiveRagdollControllers-master/python/unitytrainers/bc/trainer.py | # # Unity ML-Agents Toolkit
# ## ML-Agent Learning (Imitation)
# Contains an implementation of Behavioral Cloning Algorithm
import logging
import os
import numpy as np
import tensorflow as tf
from unityagents import AllBrainInfo
from unitytrainers.bc.models import BehavioralCloningModel
from unitytrainers.buffer imp... | 14,949 | 47.697068 | 121 | py |
DeepModel | DeepModel-master/testing/demo.py | import sys
paths = {}
with open('../path.config', 'r') as f:
for line in f:
name, path = line.split(': ')
print name, path
paths[name] = path
sys.path.insert(0, paths['pycaffe_root'])
import caffe
import numpy as np
import matplotlib.pyplot as plt
import mpl_toolkits.mplot3d
from mpl_toolkits.mplot3d impo... | 2,400 | 33.797101 | 100 | py |
DeepModel | DeepModel-master/training/GetH5DataNYU.py | import numpy as np
import h5py
import cv2
import scipy.io as sio
import sys
import os
import math
paths = {}
with open('../path.config', 'r') as f:
for line in f:
name, path = line.split(': ')
print name, path
paths[name] = path
## This part of code is modified from [DeepPrior](https://cvarlab.icg.tu... | 3,948 | 32.184874 | 135 | py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.