repo_name
stringlengths
6
97
path
stringlengths
3
341
text
stringlengths
8
1.02M
wejdeneHaouari/blockbench-sawtooth
benchmark/sawtooth_v1_2/block_server_subscriber/main.py
import argparse import logging import sys from block_server_subscriber.subscriber import Subscriber from block_server_subscriber.databaseImp import DatabaseImp from block_server_subscriber.event_handling import EventHandler LOGGER = logging.getLogger(__name__) def parse_args(args): parser = argparse.ArgumentPar...
wejdeneHaouari/blockbench-sawtooth
src/macro/kvstore/parse_output.py
#! /usr/bin/env python import sys import re def main(): if len(sys.argv) != 3 or sys.argv[1] == '-h': print("Usage: %s InputFileName OutputFileName" % sys.argv[0]) print("Statistics (.cv file) for each workload " + \ "will be written to the target file.") sys.exit(-1) p...
wejdeneHaouari/blockbench-sawtooth
src/macro/kvstore/parse_result.py
#! /usr/bin/env python import sys import os import numpy __author__ = "<NAME>" __copyright__ = "Copyright (c) 2014 <NAME>" __email__ = "<EMAIL>" def main(): if len(sys.argv) != 2 or sys.argv[1] == '-h': print("Usage: %s OutputFileName" % sys.argv[0]) print("Statistics (.result file) for each wor...
wejdeneHaouari/blockbench-sawtooth
benchmark/sawtooth_v1_2/block_server_api/main.py
import argparse import asyncio import logging import sys import threading from aiohttp import web from block_server_api.route_handler import RouteHandler from zmq.asyncio import ZMQEventLoop from block_server_api.databaseImp import DatabaseImp LOGGER = logging.getLogger(__name__) def parse_args(args): parser =...
wejdeneHaouari/blockbench-sawtooth
benchmark/sawtooth_v1_2/block_server_subscriber/subscriber.py
<filename>benchmark/sawtooth_v1_2/block_server_subscriber/subscriber.py import asyncio import logging from sawtooth_sdk.protobuf.client_event_pb2 import ClientEventsSubscribeRequest, ClientEventsSubscribeResponse from sawtooth_sdk.protobuf.events_pb2 import EventSubscription, EventList LOGGER = logging.getLogger(__na...
wejdeneHaouari/blockbench-sawtooth
benchmark/sawtooth_v1_2/block_server_subscriber/event_handling.py
<reponame>wejdeneHaouari/blockbench-sawtooth import logging import requests import yaml from block_server_subscriber.databaseImp import DatabaseImp import time LOGGER = logging.getLogger(__name__) class EventHandler(object): def __init__(self, rest_api_url): self._url = rest_api_url self.retry ...
wejdeneHaouari/blockbench-sawtooth
src/macro/kvstore/saturation.py
<gh_stars>1-10 #!/bin/python import os import time import sys # running experiments EXPS = [(1, 5), (1, 10), (1,30)] SC = "ycsb" WAIT_TIME = 20 IS_INT = 0 OUTPUT_FILE = "output.txt" WORKLOAD = "workloada.spec" def run_exp(): cmd = './driver -db {} -threads {} -P workloads/{} -txrate {} -endpoint {} -wl {} -wt {}...
wejdeneHaouari/blockbench-sawtooth
benchmark/sawtooth_v1_2/block_server_subscriber/databaseImp.py
import pymongo import logging LOGGER = logging.getLogger(__name__) class DatabaseImp(object): #URI = "mongodb://root:password@bb:27017/" DATABASE = None @staticmethod def initialize(uri): try: client = pymongo.MongoClient(uri) DatabaseImp.DATABASE = client['blocks'] ...
wejdeneHaouari/blockbench-sawtooth
benchmark/sawtooth_v1_2/rest_api/route_handler.py
import os import getpass from json import JSONDecodeError import time import yaml import logging from aiohttp.web_response import json_response from sawtooth_sdk.processor.context import Context from rest_api.errors import ApiBadRequest DEFAULT_URL = 'http://127.0.0.1:8008' LOGGER = logging.getLogger(__file__) clas...
wejdeneHaouari/blockbench-sawtooth
benchmark/sawtooth_v1_2/block_server_api/databaseImp.py
<filename>benchmark/sawtooth_v1_2/block_server_api/databaseImp.py import pymongo import logging LOGGER = logging.getLogger(__name__) class DatabaseImp(object): DATABASE = None @staticmethod def initialize(uri): try: client = pymongo.MongoClient(uri) DatabaseImp.DATABASE =...
wejdeneHaouari/blockbench-sawtooth
scripts/fabric-cpu.py
<gh_stars>1-10 import os import sys import getopt import re import time from datetime import datetime use_cpu_utilization = True url = "http://localhost:8086/status" min_containers = 1 max_containers = 6 peer = "peer" order = "order" check_interval = 5 up_threshold = 85 if use_cpu_utilization else 20 down_threshold =...
wejdeneHaouari/blockbench-sawtooth
benchmark/sawtooth_v1_2/block_server_api/route_handler.py
from json import JSONDecodeError import logging from aiohttp.web_response import json_response from block_server_api.databaseImp import DatabaseImp from block_server_api.errors import ApiBadRequest LOGGER = logging.getLogger(__name__) class RouteHandler(object): def __init__(self): pass def get_hei...
wejdeneHaouari/blockbench-sawtooth
src/macro/kvstore/exprience.py
#!/bin/python import os import subprocess import time import sys from threading import Event import signal # running experiments EXPS = [(1, 5, 60), (1, 5, 60), (1, 10, 60)] SC = "ycsb" WAIT_TIME = 20 IS_INT = 0 WORKLOAD = "workloada.spec" # Event object used to send signals from one thread to another stop_event = E...
christopher-chandler/Pythonpourlescurieux
sandbox/basicProgram.py
import simple_functions res = simple_functions.add(2, 4) print(res)
christopher-chandler/Pythonpourlescurieux
sandbox/HelloWorld.py
<reponame>christopher-chandler/Pythonpourlescurieux def add(a, b): ''' add adds two numbers together. ''' res = a - b return a+b def minus(a, b): res = a - b return res a = 2 b = 4 res = minus(a, b) resTwo = add(res, 4) # == # True # False # == equal # != not equal # < less than # > ...
christopher-chandler/Pythonpourlescurieux
sandbox/simple_functions.py
def add(a, b): return a + b def minus(a, b): return a - b def multiply(a, b): return a * b def divide(a, b): return a / b
yperbasis/linear-vs-binary-search
collectdata.py
import re, os, glob def CollectData(N, mem): for fn in glob.glob("search_tmp.*"): os.remove(fn) with open("search.cpp", "rt") as f: src = f.read() ints = mem / 8 src = re.sub(r"const int SIZE = (\d*);", r"const int SIZE = %d;" % N, src) src = re.sub(r"const int ARR_SAMPLE...
yperbasis/linear-vs-binary-search
makeplots.py
<reponame>yperbasis/linear-vs-binary-search import matplotlib.pyplot as plt import matplotlib.ticker as ticker import sys, os, glob, re, math results = {} def AddRes(name, mem, N, eltime): global results results.setdefault(mem, {}).setdefault(name, {})[N] = eltime def ReadRes(fn): with open(...
sterben25/Savior
Utils/InferenceHelpers/TritonHelper.py
<filename>Utils/InferenceHelpers/TritonHelper.py<gh_stars>100-1000 from abc import ABC import numpy as np import tritonclient.grpc as grpcclient from Utils.Exceptions import TritonServerCannotConnectException, TritonServerNotReadyException, \ InferenceTensorCheckFailException from Utils.InferenceHelpers.BaseInfer...
sterben25/Savior
Deployment/ConsumerServices/GeneralService.py
from Deployment.ConsumerWorker import celery_worker_app from Deployment.server_config import IS_TEST from Operators.ExampleDownloadOperator import ImageDownloadOperator from Operators.ExampleImageStringParseOperator import ImageParseFromBase64 from Utils.ServiceUtils import ServiceTask from Utils.Storage import get_oss...
sterben25/Savior
Operators/ExampleTextRecognizeOperator/CaptchaRecognizeOperator.py
import os import cv2 import numpy as np from scipy.special import softmax from Operators.DummyAlgorithmWithModel import DummyAlgorithmWithModel from Utils.GeometryUtils import force_convert_image_to_bgr, resize_with_height, pad_image_with_specific_base from Utils.InferenceHelpers import TritonInferenceHelper class C...
sterben25/Savior
Operators/ExampleTextRecognizeOperator/__init__.py
from Operators.ExampleTextRecognizeOperator.TextRecognizeOperator import GeneralCRNN from Operators.ExampleTextRecognizeOperator.CaptchaRecognizeOperator import Captcha1RecognizeWithMaster
sterben25/Savior
Utils/ServiceUtils.py
<reponame>sterben25/Savior import asyncio import time from collections import OrderedDict from celery import exceptions as celery_exceptions from Deployment.server_config import SUBTASK_EXECUTE_TIME_LIMIT_SECONDS, TASK_QUEUE from Utils.DAG import DAG from Utils.Exceptions import CustomException, \ RetryExceedLimi...
sterben25/Savior
Deployment/DispatchInterfaces/RecaptchaInterface.py
from typing import Optional from fastapi import APIRouter, Form from Deployment.ConsumerServices.GeneralService import DownloadImageFromURLServiceTask, ParseImageFromBase64ServiceTask from Deployment.ConsumerServices.RecaptchaService import Captcha1RecognizeServiceTask from Deployment.server_config import IS_MOCK fro...
sterben25/Savior
Operators/ExampleImageStringParseOperator/ImageParseFromBase64.py
<gh_stars>100-1000 import base64 import os import re import traceback as tb from io import BytesIO from PIL import Image from Operators.DummyOperator import DummyOperator from Utils.Exceptions import CustomException, ConsumerAlgorithmUncatchException from Utils.Storage import CloudObjectStorage from Utils.misc import...
sterben25/Savior
Operators/ExampleImageStringParseOperator/__init__.py
from Operators.ExampleImageStringParseOperator.ImageParseFromBase64 import ImageParseFromBase64
sterben25/Savior
Deployment/ConsumerServices/RecaptchaService.py
<gh_stars>100-1000 from Deployment.ConsumerWorker import celery_worker_app from Operators.ExampleImageStringParseOperator import ImageParseFromBase64 from Operators.ExampleTextRecognizeOperator import Captcha1RecognizeWithMaster from Deployment.server_config import RECAPTCHA_TRITON_URL, RECAPTCHA_TRITON_PORT, IS_TEST f...
smobarry/VideoGame_326Project
oldfiles/project_salahmethod.py
<gh_stars>0 def user_information(): """ (Salah)Prompts user for inforamtions and passes it to the recommendation method Returns: A dictionary of users information Side effects: appends the games a user has (of the same genre) into a list ...
smobarry/VideoGame_326Project
oldfiles/videogamestest.py
""" Names: <NAME> <NAME> <NAME> <NAME> Assignment: Final Project Check In 1 INST 326 """ import csv import string import random import pandas as pd def inputdata(): """ (Scott) I created three csv files for the past game store data that will be used to tailor game recommendations. This will be used to rec...
smobarry/VideoGame_326Project
test_videogamessales.py
# <NAME> # INST 326 """ This is how you run these tests: python -m pylint videogamessales.py """ import pytest import pandas from videogamessales import make_games_clean, videogames_more_like_this, videogames_filtering, videogames_sampling, suggest_games def startup(): """ A common set of values for these t...
smobarry/VideoGame_326Project
videogame_generator_GUI_beta.py
import argparse import os import sys import tkinter as tk from tkinter import * from tkinter import messagebox from tkinter import ttk import csv import pandas import videogamessales class game_Generator: def __init__(self): """The super contructor class containing the window frame for the GUI, ...
smobarry/VideoGame_326Project
videogamessales.py
<gh_stars>0 #<NAME> #<NAME> #Directory ID: smobarry #INST 326 """ In this module the video game sales data is used to provide a suggestion for video games that a user might want to buy. We downloaded a pre-scraped csv file from: https://www.kaggle.com/rush4ratio/video-game-sales-with-ratings Documentation for how to...
smobarry/VideoGame_326Project
oldfiles/tests.py
#Happy path #inputs and expected outputs are "normal" #Edge cases ("unhappy path") #inputs are unusual or special values #may trigger exceptions test age_limit by giving it edge def funcname(self, parameter_list): """ docstring """ raise NotImplementedError
ChreSyr/countdown
countdown.py
from baopig import * import pygame # pyapp.set_inapp_debugging() class TimesUpScene(Scene): def __init__(self): Scene.__init__(self, app) Text( parent=self, text="The end !", pos=(0, -100), sticky="center", height=500, fon...
Kvr0/ProgramCore
helper/programdata/CreateProgramData.py
import argparse parser = argparse.ArgumentParser() parser.add_argument('--d',help='Specify Target Path',type=str) parser.add_argument('--f',help='Output file path',type=str) target_path = '' args = parser.parse_args() if args.d: target_path = args.d else: target_path = input('TargetPath: ') with open(targe...
luke5sky/skill-playback-control
__init__.py
# Copyright 2018 Mycroft AI Inc. # # 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 # # Unless required by applicable law or agreed to in writin...
EricMountain/weather_risk_metrics
bin/vigilance-server.py
<filename>bin/vigilance-server.py #!/usr/bin/python3 from prometheus_client import start_http_server, Gauge import urllib.request import random from datetime import datetime import re import time test = False risks = ["vent violent", "pluie-inondation", "orages", "inondation", "neige-verglas", "canicule", "grand-froi...
saskeuday/sasoke
userbot/plugins/fpost.py
# This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. """ Command: .fpost word credit: @pureindialover""" import string from uniborg.util import admin_cmd msg_cache = {} ...
saskeuday/sasoke
userbot/plugins/pmpermit_menu.py
# Copyright 2019 - 2020 DarkPrinc3 # 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 # Unless required by applicable law or agreed ...
saskeuday/sasoke
userbot/plugins/labstack.py
# Copyright 2019 - 2020 DarkPrinc3 # 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 import json # Unless required by applicable l...
saskeuday/sasoke
userbot/plugins/news.py
# Copyright (C) By StarkGang [@STARKXD] # Don't edit credits # Works On Bases Of Cyberboysumanjay's Inshorts News Api # Test import requests from userbot.utils import admin_cmd, edit_or_reply, sudo_cmd from var import Var newslog = Var.NEWS_CHANNEL_ID @borg.on(admin_cmd("news (.*)")) @borg.on(sudo_cmd("news (.*)",...
saskeuday/sasoke
userbot/plugins/assistant/translater.py
<filename>userbot/plugins/assistant/translater.py # Copyright (C) <NAME> # # Please Don't Kang Without Credits # A Plugin For Assistant Bot # x0x from telethon import events, custom, Button from telethon.tl.types import ( Channel, Chat, User ) import emoji from googletrans import Translator from userbo...
saskeuday/sasoke
userbot/plugins/assistant/ping.py
<reponame>saskeuday/sasoke # Copyright (C) <NAME> # # Please Don't Kang Without Credits # A Plugin For Assistant Bot # x0x from telethon import events, custom, Button from telethon.tl.types import ( Channel, Chat, User ) import emoji from googletrans import Translator from userbot.utils import admin_cm...
saskeuday/sasoke
userbot/plugins/inline_fun.py
from userbot.utils import admin_cmd, sudo_cmd, edit_or_reply from var import Var @borg.on(admin_cmd(pattern="stat$")) async def stats(event): if event.fwd_from: return botusername = Var.TG_BOT_USER_NAME_BF_HER noob = "stats" if event.reply_to_msg_id: reply_to_id = await event.get_re...
saskeuday/sasoke
userbot/plugins/autoname.py
<filename>userbot/plugins/autoname.py """Auto Profile Updation Commands .autoname""" import asyncio import time from telethon.errors import FloodWaitError from telethon.tl import functions from uniborg.util import admin_cmd, edit_or_reply, sudo_cmd from userbot import ALIVE_NAME DEL_TIME_OUT = 60 DEFAULTUSER = str(...
saskeuday/sasoke
userbot/plugins/assistant/start.py
<gh_stars>0 # Copyright (C) <NAME> # # Please Don't Kang Without Credits # A Plugin For Assistant Bot # x0x from telethon import events, custom, Button from telethon.tl.types import ( Channel, Chat, User ) import emoji from googletrans import Translator from userbot.utils import admin_cmd, edit_or_repl...
saskeuday/sasoke
userbot/_core.py
<filename>userbot/_core.py from userbot.utils import admin_cmd, sudo_cmd, load_module, remove_plugin import asyncio import os from datetime import datetime from pathlib import Path # Copyright (C) By @StarkGang # FridayUserbot 🇮🇳
saskeuday/sasoke
userbot/plugins/list.py
""" List Files plugin for userbot //Simple Module for people who dont wanna use shell executor for listing files. cmd: .ls // will return files from current working directory .ls path // will return output according to path By:- @Zero_cool7870 """ import os from uniborg.util import admin_cmd, edit_or_reply @b...
saskeuday/sasoke
userbot/function/__init__.py
# Copyright (C) Is Distributed Between @StarkGang And @ZeltraxRockz # Please Ask At @FridayOT Before Copying Any Module # FridayUserbot (2020-21)
saskeuday/sasoke
userbot/plugins/bye.py
# For @UniBorg # Courtesy @yasirsiddiqui """ .bye """ import time from telethon.tl.functions.channels import LeaveChannelRequest from userbot.utils import admin_cmd, edit_or_reply, sudo_cmd @borg.on(admin_cmd("bye", outgoing=True)) @borg.on(sudo_cmd("bye", allow_sudo=True)) async def leave(e): starkgang = awai...
saskeuday/sasoke
userbot/plugins/cbutton.py
"""Create Button Posts """ import re from telethon import custom from uniborg.util import admin_cmd # regex obtained from: https://github.com/PaulSonOfLars/tgbot/blob/master/tg_bot/modules/helper_funcs/string_handling.py#L23 BTN_URL_REGEX = re.compile(r"(\{([^\[]+?)\}\<buttonurl:(?:/{0,2})(.+?)(:same)?\>)") @borg....
saskeuday/sasoke
userbot/plugins/thumbnail.py
"""Thumbnail Utilities, © @AnyDLBot Available Commands: .savethumbnail .clearthumbnail .getthumbnail""" import os import subprocess from hachoir.metadata import extractMetadata from hachoir.parser import createParser from PIL import Image from uniborg.util import admin_cmd thumb_image_path = Config.TMP_DOWNLOAD_DIRE...
airspot-dev/krules-dispatcher-cloudevents
setup.py
import os import setuptools from setuptools import setup, find_packages def read(fname): return open(os.path.join(os.path.dirname(__file__), fname)).read() setup( name='krules-dispatcher-cloudevents', version="0.8.5.2", author="<NAME>", author_email="<EMAIL>", description="KRules cloudevents...
airspot-dev/krules-dispatcher-cloudevents
krules_cloudevents/route/dispatcher.py
# Copyright 2019 The KRules Authors # 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 # Unless required by applicable law or agreed to in writing,...
airspot-dev/krules-dispatcher-cloudevents
krules_cloudevents/test_dispatcher.py
<reponame>airspot-dev/krules-dispatcher-cloudevents # Copyright 2019 The KRules Authors # 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 # Unless...
vicelikedust/Ingress_max_recharge_distance
main.py
<gh_stars>1-10 from os import system, name leveldist = [0,250,500,750,1000,1250,1500,1750,2000,2250,2500,2750,3000,3250,3500,3750,4000] def clear(): # for windows if name == 'nt': _ = system('cls') # for mac and linux else: _ = system('clear') def calc(): try: l...
MadhuriKadam9/caravel_avsdopamp_3v3_sky130_v2
caravel/scripts/set_user_id.py
#!/usr/bin/env python3 # SPDX-FileCopyrightText: 2020 Efabless Corporation # # 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 # # Unless requi...
MadhuriKadam9/caravel_avsdopamp_3v3_sky130_v2
caravel/scripts/generate_fill.py
<filename>caravel/scripts/generate_fill.py #!/usr/bin/env python3 # SPDX-FileCopyrightText: 2020 Efabless Corporation # # 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.apach...
bermeom/quadruped-robot
tensorblock/layers/layer_conv1d.py
<reponame>bermeom/quadruped-robot import numpy as np import tensorflow as tf import tensorblock as tb class layer_conv1d: ####### Data def name(): return 'Conv1D' def shapeMult(): return 1 def dims(): return 1 def allowPooling(): return True ####### Function def function( x , W , b , recipe , ...
bermeom/quadruped-robot
learning/execute.py
<filename>learning/execute.py<gh_stars>1-10 import argparse import importlib import numpy as np # Parse args parser = argparse.ArgumentParser( description = 'Input Arguments' ) parser.add_argument( 'type' , nargs = 1 ) # reinforcement or imitation parser.add_argument( 'inputs' , nargs = 2 ) # player and source parse...
bermeom/quadruped-robot
tensorblock/recipe/recipe_init.py
import tensorflow as tf import tensorblock as tb class recipe_init: ####### Initialize Variables def initVariables( self ): self.labels = {} self.cnt = 0 self.curr_input = None self.blocks , self.order = [] , [] self.layers , self.extras = [] , [] self.inputs ,...
bermeom/quadruped-robot
learning/sources/pygames/pygame_catch.py
<reponame>bermeom/quadruped-robot<filename>learning/sources/pygames/pygame_catch.py import pygame import pygame.surfarray as surfarray import random class pygame_catch: ### START SIMULATION def reset( self ): pygame.init() self.black = [ 0 , 0 , 0 ] self.white = [ 255 , 255 , ...
bermeom/quadruped-robot
tensorblock/recipe/recipe_summary.py
import tensorflow as tf import tensorblock as tb class recipe_summary: ####### Add Summary Base def addSummaryBase( self , inputs , name , function ): inputs = tb.aux.parse_pairs( inputs ) name = self.add_label( self.summaries , 'Summary' , name , add_order = False ) li...
bermeom/quadruped-robot
tensorblock/recipe/recipe_save.py
import os import tensorflow as tf class recipe_save: ####### Add Saver def addSaver( self , name = None , input = None , dir = 'models' , pref = 'model' ): name = self.add_label( self.savers , 'Saver' , name , add_order = False ) if input is None : input = self.folde...
bermeom/quadruped-robot
learning/players_reinforcement/player_dql_bayesian_1A.py
from players_reinforcement.player_dql_bayesian_1 import * # PLAYER DQL BAYESIAN class player_dql_bayesian_1A( player_dql_bayesian_1 ): NUM_FRAMES = 3 BATCH_SIZE = 50 LEARNING_RATE = 1e-4 REWARD_DISCOUNT = 0.99 START_RANDOM_PROB = 1.0 FINAL_RANDOM_PROB = 0.05 NUM_EXPLORAT...
bermeom/quadruped-robot
learning/players_reinforcement/player_reinforce_2A.py
from players_reinforcement.player_reinforce_2 import * # PLAYER REINFORCE class player_reinforce_2A( player_reinforce_2 ): NUM_FRAMES = 3 LEARNING_RATE = 1e-4 REWARD_DISCOUNT = 0.99 ### __INIT__ def __init__( self ): player_reinforce_2.__init__( self ) # PROCESS OBSERVATION ...
bermeom/quadruped-robot
tensorblock/recipe/recipe_input.py
<filename>tensorblock/recipe/recipe_input.py<gh_stars>1-10 import tensorflow as tf import tensorblock as tb import numpy as np class recipe_input: ####### Add Input def addInput( self , **args ): pars = { **self.defs_input , **args } pars['name'] = self.add_label( self.inputs , '...
bermeom/quadruped-robot
learning/players_reinforcement/player_DDPG_1A.py
<reponame>bermeom/quadruped-robot from players_reinforcement.player_DDPG_1 import * import tensorflow as tf import numpy as np # PLAYER DDPG class player_DDPG_1A( player_DDPG_1 ): EXPERIENCES_LEN = 1e6 BATCH_SIZE = 128 STEPS_BEFORE_TRAIN = 5000 NUM_FRAMES = 1 C_LEARNING_RATE ...
bermeom/quadruped-robot
tensorblock/layers/layer_deconv2d.py
import numpy as np import tensorflow as tf import tensorblock as tb class layer_deconv2d: ####### Data def name(): return 'Deconv2D' def shapeMult(): return 1 def dims(): return 2 def allowPooling(): return False ####### Function def function( x , W , b , recipe , pars ): if tb.aux.tf...
bermeom/quadruped-robot
tensorblock/aux/aux_reshape.py
import math import numpy as np ### Flat Dimension def flat_dim( shape ): return np.prod( shape[1:] ) ### Flatten def flatten( x ): return x.reshape( [ -1 , flat_dim( x ) ] ) ### 2D Side Dimension def side2D( x , d = 1 ): if isinstance( x , list ) : x = x[1] return int( round( math.pow( x / d , 1....
bermeom/quadruped-robot
learning/players_imitation/player_GAIL_1A.py
from players_imitation.player_GAIL_1 import * ##### PLAYER GAIL class player_GAIL_1A( player_GAIL_1 ): A_LEARNING_RATE = 1e-6 C_LEARNING_RATE = 1e-3 D_LEARNING_RATE = 1e-4 NUM_FRAMES = 1 UPDATE_SIZE = 5 BATCH_SIZE = 128 EPSILON = 0.10 GAMMA = 0.995 LAM = 0.97 B_CLON...
bermeom/quadruped-robot
learning/sources/vrep/vrepper/utils.py
import functools import warnings import subprocess as sp import os import psutil from vrepper.lib.vrepConst import simx_opmode_oneshot, simx_opmode_blocking, simx_return_ok list_of_instances = [] import atexit def cleanup(): # kill all spawned subprocesses on exit for i in list_of_instances: i.end() ...
bermeom/quadruped-robot
envs/quadruped.py
<gh_stars>0 import numpy as np from gym import utils from os import path from gym.envs.mujoco import mujoco_env import math import os def mass_center(model, sim): mass = np.expand_dims(model.body_mass, 1) xpos = sim.data.xipos return (np.sum(mass * xpos, 0) / np.sum(mass))[0] class QuadrupedEnv(mujoco_env...
bermeom/quadruped-robot
learning/sources/source_unity_3dball.py
<reponame>bermeom/quadruped-robot from sources.source_unity import source_unity import numpy as np ##### SOURCE UNITY 3D BALL class source_unity_3dball( source_unity ): ### __INIT__ def __init__( self ): source_unity.__init__( self , "3dball" ) self.range_act = 2 ### INFORMATION def...
bermeom/quadruped-robot
tensorblock/recipe/recipe.py
import tensorflow as tf import tensorblock as tb class recipe( tb.recipe.base , tb.recipe.block , tb.recipe.init , tb.recipe.input , tb.recipe.layer , tb.recipe.operation , tb.recipe.plot , tb.recipe.print , tb.recipe.save , tb.recipe.summary , tb.recipe.train ): ####### Ini...
bermeom/quadruped-robot
learning/sources/source_vrep.py
<reponame>bermeom/quadruped-robot from sources.vrep.vrepper.core import vrepper from sources.source import source import sys, os, time, signal import numpy as np ##### SOURCE VREP class source_vrep( source ): ### __INIT__ def __init__( self, scene ): source.__init__( self ) self.env = vrepp...
bermeom/quadruped-robot
tensorblock/layers/layer_rnn.py
import numpy as np import tensorflow as tf import tensorflow.contrib.rnn as rnn import tensorblock as tb class layer_rnn: ####### Data def name(): return 'RNN' def shapeMult(): return 1 def dims(): return 1 def allowPooling(): return False ####### Function def function( x , W , b , recipe , p...
bermeom/quadruped-robot
tensorblock/aux/aux_tf_reshape.py
#import os #os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' import tensorflow as tf from tensorblock.aux.aux_reshape import * ### Get Shape def tf_shape( x ): if x is None: return None return x.get_shape().as_list() ### Get Length def tf_length( x ): return len( tf_shape( x ) ) ### Flat Dimension def tf_flat...
bermeom/quadruped-robot
envs/__init__.py
from envs.quadruped import QuadrupedEnv
bermeom/quadruped-robot
tensorblock/functions/func_extras.py
<gh_stars>1-10 import tensorflow as tf import tensorblock as tb ### 2D Max Pooling def maxpool2d( x , pars ): if not pars['pooling_ksize' ]: pars['pooling_ksize'] = pars['pooling'] if not pars['pooling_strides']: pars['pooling_strides'] = pars['pooling'] if not pars['pooling_padding']: pars['pooling_p...
bermeom/quadruped-robot
learning/sources/vrep/vrepper/core.py
# V-REP as tethered robotics simulation environment # Python Wrapper # <NAME> 20170410 # import the vrep library from vrepper.lib import vrep from vrepper.lib.vrepConst import sim_handle_all, simx_headeroffset_server_state, \ sim_scripttype_childscript from inspect import getargspec import types import numpy as n...
bermeom/quadruped-robot
tensorblock/recipe/recipe_operation.py
<reponame>bermeom/quadruped-robot import tensorflow as tf class recipe_operation: ####### Add Operation def addOperation( self , **args ): pars = { **self.defs_operation , **args } pars['name'] = self.add_label( self.operations , 'Operation' , pars['name'] , add_order = True ) ...
bermeom/quadruped-robot
learning/sources/pygames/pygame_chase.py
<reponame>bermeom/quadruped-robot import pygame import pygame.surfarray as surfarray import random import time import numpy as np class pygame_chase: ### START SIMULATION def reset( self ): pygame.init() self.black = [ 0 , 0 , 0 ] self.white = [ 255 , 255 , 255 ] self...
bermeom/quadruped-robot
learning/sources/source_carla.py
<reponame>bermeom/quadruped-robot from sources.source import source from sources.carla.control import * import signal import sys import cv2 import numpy as np import time import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt ##### SOURCE CARLA class source_carla( source ): # Discrete actions: ...
bermeom/quadruped-robot
learning/sources/source_gym_hopper.py
from sources.source_gym import source_gym import numpy as np ##### SOURCE GYM HOPPER class source_gym_hopper( source_gym ): ### __INIT__ def __init__( self ): source_gym.__init__( self , 'Hopper-v2' ) ### INFORMATION def num_actions( self ): return self.env.action_space.shape[0] def ran...
bermeom/quadruped-robot
tensorblock/layers/layer_variational.py
import numpy as np import tensorflow as tf import tensorblock as tb class layer_variational: ####### Data def name(): return 'Variational' def shapeMult(): return 2 def dims(): return 1 def allowPooling(): return False ####### Function def function( x , W , b , recipe , pars ): if tb....
bermeom/quadruped-robot
learning/players_reinforcement/player_dql_rnn_egreedy_1A.py
from players_reinforcement.player_dql_rnn_egreedy import * ##### PLAYER DQL RNN EGREEDY 1A class player_dql_rnn_egreedy_1A( player_dql_rnn_egreedy ): NUM_FRAMES = 3 BATCH_SIZE = 50 LEARNING_RATE = 1e-4 REWARD_DISCOUNT = 0.99 START_RANDOM_PROB = 1.00 FINAL_RANDOM_PROB = 0.05 NUM_EXPLORATI...
bermeom/quadruped-robot
tensorblock/recipe/recipe_train.py
<filename>tensorblock/recipe/recipe_train.py import numpy as np import tensorblock as tb class recipe_train: ####### Train def train( self , **args ): pars = { **self.defs_train , **args } if pars['train_length'] is not None: if pars['train_data'] is not None: pars['train_data'] = p...
bermeom/quadruped-robot
learning/sources/source_gym.py
<reponame>bermeom/quadruped-robot import signal import sys import gym from sources.source import source from gym import wrappers ##### SOURCE GYM class source_gym( source ): render = True ### __INIT__ def __init__( self , game ): source.__init__( self ) self.env = gym.make( game ) ...
bermeom/quadruped-robot
learning/players_reinforcement/player_PPO_1.py
<gh_stars>1-10 from players_reinforcement.player import player from auxiliar.aux_plot import * import sys sys.path.append('..') import tensorblock as tb import numpy as np # PLAYER PPO class player_PPO_1(player): # __INIT__ def __init__(self): player.__init__(self) self.experiences = [] ...
bermeom/quadruped-robot
learning/sources/source_pygame_chase.py
from sources.source_pygame import source_pygame ##### SOURCE PYGAME CHASE class source_pygame_chase( source_pygame ): ### __INIT__ def __init__( self ): source_pygame.__init__( self , 'pygame_chase' ) ### INFORMATION def num_actions( self ): return 5 ### MAP KEYS def map_keys( self...
bermeom/quadruped-robot
tensorblock/functions/func_variables.py
<reponame>bermeom/quadruped-robot<gh_stars>1-10 import tensorflow as tf ### Placeholder def placeholder( shape = None , name = None , dtype = tf.float32 ): if shape is None: return tf.placeholder( dtype , name = name ) return tf.placeholder( dtype , shape , name = name ) ### Numpy def numpy( tensor , pars ,...
bermeom/quadruped-robot
tensorblock/aux/aux_load.py
<filename>tensorblock/aux/aux_load.py import pickle import numpy as np import tensorflow as tf import tensorblock as tb import cv2 ### Create Dataset def create_dataset( tensors, extras, pars ): s_dataset = tf.data.Dataset.list_files(pars['data_path']) def _s_parse_function(filename): image_string = ...
bermeom/quadruped-robot
learning/sources/vrep/vrepper/vrep_object.py
<filename>learning/sources/vrep/vrepper/vrep_object.py from vrepper.lib.vrepConst import sim_jointfloatparam_velocity, simx_opmode_buffer, simx_opmode_streaming from vrepper.utils import check_ret, blocking import numpy as np class vrepobject(): def __init__(self, env, handle, is_joint=True): self.env = en...
bermeom/quadruped-robot
tensorblock/layers/layer_conv2d.py
import numpy as np import tensorflow as tf import tensorblock as tb class layer_conv2d: ####### Data def name(): return 'Conv2D' def shapeMult(): return 1 def dims(): return 2 def allowPooling(): return True ####### Function def function( x , W , b , recipe , pars ): if tb.aux.tf_leng...
bermeom/quadruped-robot
tensorblock/__init__.py
<reponame>bermeom/quadruped-robot<filename>tensorblock/__init__.py import tensorblock.aux import tensorblock.layers import tensorblock.functions.func_variables as vars import tensorblock.functions.func_activations as activs import tensorblock.functions.func_operations as ops import tensorblock.functions.func_optimize...
bermeom/quadruped-robot
learning/players_reinforcement/player_DDPG_1.py
<filename>learning/players_reinforcement/player_DDPG_1.py from players_reinforcement.player import player from auxiliar.aux_plot import * import tensorflow as tf import random from collections import deque import sys sys.path.append('..') import tensorblock as tb import numpy as np # PLAYER DDPG class player_DDPG_1...
bermeom/quadruped-robot
tensorblock/recipe/recipe_plot.py
import tensorflow as tf class recipe_plot: ####### Add Plotter def addPlotter( self , **args ): pars = { **self.defs_plotter , **args } pars['name'] = self.add_label( self.plotters , 'Plotter' , pars['name'] , add_order = False ) self.plotters.append( [ pars['function'] ...
bermeom/quadruped-robot
learning/players_reinforcement/player_reinforce_1A.py
<reponame>bermeom/quadruped-robot from players_reinforcement.player_reinforce_1 import * # PLAYER REINFORCE class player_reinforce_1A( player_reinforce_1 ): NUM_FRAMES = 1 LEARNING_RATE = 1e-4 REWARD_DISCOUNT = 0.99 ### __INIT__ def __init__( self ): player_reinforce_1.__init__( ...
bermeom/quadruped-robot
tensorblock/functions/func_plotters.py
import os import matplotlib.pyplot as plt from matplotlib.pyplot import clf , plot , draw , show import tensorblock as tb ### Plot Initialize def initialize( shape ): plt.figure( figsize = ( 12 , 9 ) ) ### Plot Reconstruction def reconst( x1 , x2 , epoch = 0 , dir = 'figures' , shape = None ): ...