text stringlengths 3.07k 22.1k |
|---|
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Nov 7 15:18:40 2019
@author: davidazoulay
"""
###############
### Modules ###
###############
import pandas as pd
import numpy as np
import datetime as dt
from sklearn.preprocessing import LabelEncoder
from sklearn.linear_model import LogisticRegre... |
import numpy as np
import pytest
import nengo
from nengo.exceptions import ValidationError
from nengo.processes import WhiteSignal
from nengo.synapses import Alpha, LinearFilter, Lowpass, Synapse, SynapseParam, Triangle
from nengo.utils.filter_design import cont2discrete
from nengo.utils.testing import signals_allclos... |
from __future__ import print_function
from Tkinter import *
from PIL import Image, ImageTk
import numpy as np
import random
import sys
from sys import stdout
from time import sleep
from bitstring import BitArray
from ConfigParser import SafeConfigParser
import grequests
ABOUT_TEXT = """
... |
import json
from django.core.serializers.json import DjangoJSONEncoder
from django.db.models import Max, Min
import numpy as np
import os
import logging
from rest_framework import viewsets, status
from rest_framework.response import Response
from rest_framework.views import APIView
from rest_framework.decorators impor... |
# -*- coding: utf-8 -*-
__all__ = ('KOKORO_STRATEGY', )
from threading import current_thread
from sqlalchemy import util
from sqlalchemy.engine import Engine
from sqlalchemy.engine.strategies import DefaultEngineStrategy
from ...backend.utils import alchemy_incendiary
from ...backend.executor import ExecutorThread
... |
# ------------------------------------------------------------------------
# BEAUTY DETR
# Copyright (c) 2022 <NAME> & <NAME>
# Licensed under CC-BY-NC [see LICENSE for details]
# All Rights Reserved
# ------------------------------------------------------------------------
"""Encoder-decoder transformer layers for sel... |
from json import loads
from os import system,name
from time import sleep
#############
global R,B,C,G
R='\033[1;31m';B='\033[1;34m';C='\033[1;37m';G='\033[1;32m'
#############
# O código pode não estar limpo, mas tá rápido.
# Vou recodar em JavaScript ou em Ruby quando eu tiver tempo.
#############
try:
from requests ... |
# Copyright 2017 The TensorFlow Authors. 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/licenses/LICENSE-2.0
#
# Unless required by applica... |
#!/usr/bin/env python
# Copyright 2014-2019 The PySCF Developers. 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/licenses/LICENSE-2.0
#
# U... |
"""
Most codes from https://github.com/carpedm20/DCGAN-tensorflow
"""
from __future__ import division
import math
import random
import pprint
import scipy.misc
import numpy as np
from time import gmtime, strftime
from six.moves import xrange
import matplotlib.pyplot as plt
import os, gzip
import tensorflow as tf
impor... |
import logging
import os
import struct
import sys
import time
import importlib_resources
import kibra
import kibra.database as db
import kibra.network as NETWORK
from kibra.ktask import Ktask
from kibra.shell import bash
from kibra.thread import DEFS, TLV
from kibra.tlv import ThreadTLV
from kitools import kidfu, kifw... |
import argparse
import os
import numpy as np
import copy
import torch
import torch.optim as optim
from torch.utils.data import DataLoader, TensorDataset
from torchvision import transforms
from torchvision import datasets
from utils.lib import *
from utils.pgd_attack import *
from utils.rmc import *
from models.resnet ... |
# coding: utf-8
#
# Copyright 2020 The Oppia Authors. 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/licenses/LICENSE-2.0
#
# Unless requi... |
import os
from golem.core import session, file_manager, settings_manager, utils
def create_project(project_name):
project = Project(project_name)
file_manager.create_directory(path=project.path, add_init=True)
file_manager.create_directory(path=project.test_directory_path, add_init=True)
file_manager... |
# for localized messages
from . import _
from Plugins.Plugin import PluginDescriptor
from Screens.Screen import Screen
from Screens.InputBox import InputBox
from Screens.ChoiceBox import ChoiceBox
from Screens.MessageBox import MessageBox
from Components.config import config
from Components.ActionMap import ActionMap
... |
'''Discover object configuration from parameter lists.
.. This software is released under an MIT/X11 open source license.
Copyright 2014-2015 Diffeo, Inc.
.. autoclass:: AutoFactory
'''
from __future__ import absolute_import, division, print_function
import abc
import inspect
from six import iteritems, string_ty... |
# Lint as: python3
# Copyright 2020 Google LLC
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... |
import math
import struct
import tkinter as tk
import client
import widgets
def verify_numeric(v):
try:
float(v + '0')
return True
except ValueError:
return False
class MainWindow(tk.Frame):
def __init__(self, parent, conn):
tk.Frame.__init__(self, parent)
self.pa... |
import argparse
import functools
import logging
import re
import shlex
import sys
from typing import Any
from typing import Dict
from typing import Optional
from typing import Sequence
import cfgv
from identify.identify import ALL_TAGS
import reformat.constants as C
from reformat.color import add_color_option
from re... |
# Copyright 2017 <NAME>
#
# 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, soft... |
# -*- coding: utf-8 -*-
"""
inflection
~~~~~~~~~~~~
A port of Ruby on Rails' inflector to Python.
:copyright: (c) 2012-2015 by <NAME>
:license: MIT, see LICENSE for more details.
"""
import re
import unicodedata
__version__ = "0.3.1"
PLURALS = [
(r"(?i)(quiz)$", r"\1zes"),
(r"(?i)^(oxen... |
import numpy as np
import os
from os import listdir
from os.path import isdir, isfile, join
import math,sys
# requires scipy installation
import scipy.cluster.hierarchy as sch
import scipy.stats as stats
from scipy.spatial.distance import *
from scipy.cluster.hierarchy import *
SCRIPTPATH = os.environ['SCRIPTPATH']
... |
import json
import logging
import os
import re
import time
from collections import defaultdict
from datetime import datetime
from glob import glob
from typing import List, Optional, Union
import github
from urllib3.util.retry import Retry
import publish.github_action
from publish import hide_comments_modes, available... |
# pylint: skip-file
# type: ignore
# -*- coding: utf-8 -*-
#
# tests.models.failure_definition.failure_definition.unit_test.py is part of
# The RAMSTK Project
#
# All rights reserved.
# Copyright since 2007 Doyle "weibullguy" Rowland doyle.rowland <AT> reliaqual <DOT> com
"""Test class for testing failure d... |
import logging
import re
from .smirnoff import mol2_to_OEMol
from openeye.oechem import (
oemolistream, oemolostream, OEIFlavor_MOL2_Forcefield,
OEIFlavor_Generic_Default, OEIFlavor_PDB_Default, OEIFlavor_PDB_ALL,
OEFormat_MOL2, OEFormat_MOL2H, OEWriteMolecule, OETriposAtomNames, OEMol,
OEFormat_PDB, O... |
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
"""Test Spack's URL handling utility functions."""
import os
import os.path
import spack.paths
import spack.util.url as ur... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2013 Cloudbase Solutions SRL
# 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.ap... |
#!/usr/bin/env python
# coding: utf-8
# In[23]:
import json
import numpy as np
import os
from PIL import Image
from tqdm import tqdm
import copy
from shutil import copyfile
import pickle
import cv2
# [ymin, ymax, xmin, xmax] to [x, y, w, h]
def box_transform(box):
x = box[2]
y = box[0]
w = box[3] - box... |
# Copyright (c) ZenML GmbH 2021. 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:
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applic... |
#
# Copyright (c) 2021, 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 at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... |
"""
per-test stdout/stderr capturing mechanism.
"""
from __future__ import with_statement
import contextlib
import sys
import os
from tempfile import TemporaryFile
import py
import pytest
from py.io import TextIO
from io import UnsupportedOperation
unicode = py.builtin.text
patchsysdict = {0: 'stdin', 1: 'stdout',... |
from keras.models import Model
from keras.layers import Input, merge, ZeroPadding2D
from keras.layers.core import Dense, Dropout, Activation
from keras.layers.convolutional import Convolution2D
from keras.layers.pooling import AveragePooling2D, GlobalAveragePooling2D, MaxPooling2D
from keras.layers.normalization import... |
"""Pytest utility classes, functions and fixtures."""
import inspect
import os
import types
import numpy as np
import pytest
import geomstats.backend as gs
def autograd_backend():
"""Check if autograd is set as backend."""
return os.environ["GEOMSTATS_BACKEND"] == "autograd"
def np_backend():
"""Chec... |
import time
import math
import torch
import torch.optim as opt
from sklearn.base import BaseEstimator
from sklearn.base import RegressorMixin
from tcn import TemporalConvNet
from torch import nn
from utils import get_batch
from utils import save_model
class TCN(nn.Module):
def __init__(self, input_size, output_s... |
#
# Copyright 2019 The Eggroll Authors. 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/licenses/LICENSE-2.0
#
# Unless required by ap... |
import utils
from utils import Base
import networkx as nx
class Vertex(Base):
def __init__(self, name, attrs = {}):
self._name = name
self._attrs = attrs.copy()
def name(self):
return self._name
def attrs(self):
return self._attrs
def attr(self, na... |
import atexit
import sacred
import argparse
import time
import math
import subprocess
import shutil
import os
import json
import threading
import requests
import glob
from configs import fetch_model_params
import socket
import subprocess
import queue
import sys
import signal
parser = argparse.ArgumentParser()
parser.... |
# -*- coding: utf-8 -*-
# Copyright (c) 2015-2016 Tigera, Inc. All rights reserved.
# Copyright (c) 2018 Tigera, 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
#
# ... |
import os
import tensorflow as tf
import numpy as np
import keras
import matplotlib.pyplot as plt
class MapEvaluation(keras.callbacks.Callback):
""" Evaluate a given dataset using a given model.
code originally from https://github.com/fizyr/keras-retinanet
# Arguments
generator :... |
#!/usr/bin/env python
import json, os, sys
import unittest
try:
from unittest.mock import MagicMock
except ImportError:
from mock import MagicMock
try:
from wslink import schedule_callback, schedule_coroutine, register as exportRPC
except ImportError:
print("loading wslink directly from src/ directory... |
'''
Calculate the number of photons, number of background photons, and noise equivalent angle for a natural guide star
By <NAME> and <NAME>
Equations 65-68 from section 3B of
Clare, R. et al (2006). Adaptive optics sky coverage modelling for extremely large telescopes. Applied Optics 45, 35 (8964-8978)
'''
import num... |
# Copyright 2015 Google 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/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... |
"""This component updates the camera API and subscription."""
import logging
import os
import re
import datetime as dt
from typing import Optional
from urllib.parse import quote_plus
from dateutil.relativedelta import relativedelta
from homeassistant.const import (
CONF_HOST,
CONF_PASSWORD,
CONF_PORT,
... |
import io
import os
import json
import zipfile
import argparse
import urllib.request
import multiprocessing
from os.path import join as pjoin
import tqdm
import numpy as np
import spacy
import textworld
from textworld.logic import State, Rule, Proposition, Variable
from generic import preproc
from generic import pro... |
# -*- coding: utf-8 -*-
"""
Prompt-Base finetune.
"""
import re
from typing import Dict, List, Optional, Tuple, Union
import numpy as np
from langml.log import info
from langml.plm.bert import load_bert
from langml.plm.albert import load_albert
from langml import TF_KERAS, TF_VERSION
if TF_KERAS:
import tensorf... |
import logging
import struct
_LOGGER = logging.getLogger(__name__)
typical_types = {
0x11: {
"desc": "T11: ON/OFF Digital Output with Timer Option", "size": 1,
"name": "Switch Timer",
"state_desc": { 0x00: "off",
0x01: "on"}
},
... |
#!/usr/bin/python3.5
# -*- coding: utf-8 -*-
import sys
import os
import time
import feedparser
import telepot
import json
import requests
import atexit
import re
import random
import string
import urllib.request
from urllib import parse
from robobrowser import RoboBrowser
from apscheduler.schedulers.... |
import logging
import time
import typing
from collections import Counter
from pathlib import Path
import torch
import torch.distributed
from torch.cuda.amp import GradScaler, autocast
from torch.nn import functional as F
from torch.utils.data import DataLoader
from vits_train import setup_discriminator, setup_model
f... |
# Lint as: python3
# Copyright 2019 DeepMind Technologies Limited. 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/licenses/LICENSE-2.0
#
# ... |
"""Numpy based codec for binary data structures."""
import functools
import collections
from typing import NamedTuple, Optional
import numpy as np
import bpack
import bpack.utils
import bpack.codecs
from .enums import EBaseUnits
from .descriptors import (
field_descriptors, get_field_descriptor, BinFieldDescrip... |
from fileinput import filename
import json
from io import StringIO
import os
import sys
from os.path import exists
import requests
from urllib.parse import urlparse
import csv
def get5digitZip(rawZip):
if len(rawZip) == 3:
return '00' + rawZip
elif len(rawZip) == 4:
return '0' + rawZip
elif len(rawZip) ... |
import torch
import numpy as np
import scipy.io
# import h5py
import torch.nn as nn
import operator
from functools import reduce
from functools import partial
#################################################
#
# Utilities
#
#################################################
device = torch.device('cuda' if torch.cuda.... |
import getpass
from networkx.algorithms.shortest_paths.generic import shortest_path
import yaml
from aioconsole import ainput
import networkx as nx
import asyncio
import logging
from datetime import datetime
import slixmpp
import networkx as nx
import random
from getpass import getpass
import sys
if sys.plat... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2013, <NAME> <<EMAIL>>, <NAME> <<EMAIL>>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
... |
"""
us_tx_courts.py - Retrieve a list of Courts in Texas.
Copyright (c) 2019 by <NAME>, J.D. All Rights Reserved.
"""
from datetime import date
from lxml import html
import re
import requests
import json
# We can get import errors in the test environment when we're doing very
# simple unit tests in an environment whe... |
# Copyright (C) 2016 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
from datetime import datetime
import collections
import logging
from sqlalchemy.sql.expression import tuple_
from ggrc import db
from ggrc import models
from ggrc.automapper.rules import rules
from ggrc.log... |
import pandas as pd
from collections import defaultdict
from scipy.stats import pearsonr
from sklearn.cluster import KMeans
from collections import Counter
from sklearn.decomposition import PCA
from sklearn.metrics.pairwise import cosine_similarity
import numpy as np
import os
from minisom import MiniSom
def create... |
#
# Copyright 2018 <NAME>
#
# This file is part of Python Sudoku Sandbox.
#
# Python Sudoku Sandbox is free software developed for educational and
# experimental purposes. It is licensed under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with the
# License. You may o... |
#
# Copyright (c) 2015-2021 Canonical, Ltd.
#
# This file is part of Talisker
# (see http://github.com/canonical-ols/talisker).
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regardin... |
# -*- coding: utf-8 -*-
'''Chemical Engineering Design Library (ChEDL). Utilities for process modeling.
Copyright (C) 2016, <NAME> <<EMAIL>>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without... |
# Copyright (c) Lawrence Livermore National Security, LLC and other Conduit
# Project developers. See top-level LICENSE AND COPYRIGHT files for dates and
# other details. No copyright assignment is required to contribute to Conduit.
"""
file: conduit_relay_entangle.py
Python script that helps establish ssh tunneled co... |
# A module to expose various thread/process/job related structures and
# methods from kernel32.
#
# http://benjamin.smedbergs.us/blog/2006-12-11/killableprocesspy/
#
# The MIT License
#
# Copyright (c) 2006 the Mozilla Foundation <http://www.mozilla.org>
#
# Permission is hereby granted, free of charge, to any person o... |
"""
sphinx.ext.coverage
~~~~~~~~~~~~~~~~~~~
Check Python modules and C API for coverage. Mostly written by <NAME> for the Google Highly Open Participation contest.
:copyright: Copyright 2007-2020 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import glob
import insp... |
"""
# the wrapper of A-shares local tdx client
"""
__project__ = 'Puppet'
__author__ = "睿瞳深邃(https://github.com/Raytone-D"
__version__ = "Fools' Day"
import ctypes
from functools import reduce
import time
import pywinauto
WM_SETTEXT = 12
WM_GETTEXT = 13
WM_SETCHECK = 241
WM_CLICK = 245
WM_KEYDOWN = 256
WM_KEYUP = 257... |
import numpy as np
import matplotlib.pyplot as plt
from numpy.fft import fft2, ifft2, fftshift, ifftshift
import arrayfire as af
from IPython import display
import time
import pickle
from dftregistration import dftregistration
def image_upsampling(I_image, upsamp_factor = 1, bg = 0):
F = lambda x: ifftshift(ff... |
"""Django test runner that invokes nose.
You can use... ::
NOSE_ARGS = ['list', 'of', 'args']
in settings.py for arguments that you want always passed to nose.
"""
from __future__ import print_function
import os
import sys
from optparse import make_option
from types import MethodType
import django
from django.... |
#!/usr/bin/env python
import argparse
import cPickle
import gzip
import bz2
import logging
import os
import subprocess
import numpy
import tables
import h5py
from collections import Counter
from numpy.lib.stride_tricks import as_strided
from tqdm import tqdm
from scipy.sparse import lil_matrix, csr_matrix, save_npz
... |
from itertools import combinations, islice
from functools import reduce
from math import comb as C
import math
from typing import Generator, Iterator
from prompts import p_choice, p_int, p_bool
import operator
import os
import time
# Make a charset of A-Za-Z0-9
CHARSET = ''
for i in range(65, 91):
CHARSET += chr(i... |
# Copyright (c) 2017 <NAME>
# Copyright (c) 2018-2020, NVIDIA CORPORATION. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limita... |
'''
DLRM Facebookresearch K-Means++
author: sjoon-oh @ Github
source: -
'''
import torch
import torch.nn as nn
import numpy as np
from sklearn.cluster import KMeans
import os.path
import json
class ClusterManager():
def __init__(self,
n_clusters, # Given as integer
n_embeddings, # Given... |
# Licensed under the MIT License <http://opensource.org/MIT>
#
# Copyright (c) 2021 <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation ... |
# Load Packages and setup wandb
from params import params
from torch.utils import data
import gloveloader as loader
from gloveloader import SpellingDataset
import json, os, random
import string
import torch
import torch.nn as nn
import numpy as np
from transformers import AutoConfig, AutoModel
from sklearn.metrics i... |
import torch
from torch import nn
from torch.cuda import amp
from quickvision import utils
from tqdm import tqdm
import time
from collections import OrderedDict
from quickvision.models.detection.utils import _evaluate_iou, _evaluate_giou
__all__ = ["train_step", "val_step", "fit", "train_sanity_fit",
"val_s... |
import nvidia.dali.fn as fn
from nvidia.dali.pipeline import Pipeline
import nvidia.dali.types as types
import numpy as np
from test_utils import compare_pipelines
from test_utils import check_output_pattern
from nose.tools import assert_raises
def _test_fn_rotate(device):
pipe = Pipeline(batch_size = 1, num_threa... |
# -*- coding: utf-8 -*-
# ------------------------------------------------------------------------------
# Name: prebase.py
# Purpose: classes for anything in music21 to inherit from.
#
# Authors: <NAME>
#
# Copyright: Copyright © 2019 <NAME> and the music21 Project
# License: BSD, see license... |
# -*- coding: UTF-8 -*-
# Copyright (c) 2019 PaddlePaddle Authors. 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/licenses/LICENSE-2.0
#
... |
import tensorflow as tf
from model_aon import inference, get_train_op, get_init_op
from input_data import get_batch_data
from input_data import get_inputdata
import os
import numpy as np
import time
from datetime import datetime
os.environ["CUDA_VISIBLE_DEVICES"] = "5,7"
flags = tf.app.flags
flags.DEFINE_string('exp_... |
from click.testing import CliRunner
from healthkit_to_sqlite import cli, utils
import io
import pathlib
import pytest
import sqlite_utils
from sqlite_utils.db import ForeignKey
import pathlib
import zipfile
@pytest.fixture
def xml_path():
return pathlib.Path(__file__).parent / "export.xml"
@pytest.fixture
def x... |
# -*- coding: utf-8 -*-
'''
The backed for the mercurial based file server system.
After enabling this backend, branches, bookmarks, and tags in a remote
mercurial repository are exposed to salt as different environments. This
feature is managed by the fileserver_backend option in the salt master config.
This fileser... |
"""
:author:
<NAME> (<EMAIL>)
2021
:License:
This package is published under Simplified BSD License.
"""
"""
This script extracts and converts audio samples from Common Voice.
"""
import pandas as pd
import numpy as np
import os
import pydub
import argparse
from threading import Thread
import numpy as np
import sci... |
import unicodedata
from abc import ABCMeta
from copy import deepcopy
import numpy as np
from transformers import AutoTokenizer
class BaseTokenizer(object, metaclass=ABCMeta):
def __init__(self, vocab, max_seq_len):
self.vocab = vocab
self.max_seq_len = max_seq_len
def tokenize(self, text):
... |
"""
Class for calculating metrics for a proposed image and the original.
NOTE: all methods return per-image metrics, i.e. the number of returned values is equal to batch dimension.
"""
import lpips
import torch
import torch.nn.functional as F
import numpy as np
from pytorch_msssim import ssim, ms_ssim
from utils.loss... |
# -*- coding: utf-8 -*-
import re
import time
import random
import jieba
import torch
import logging
import torch.nn as nn
from torchnet import meter
from model import EncoderRNN, LuongAttnDecoderRNN
from utils.greedysearch import GreedySearchDecoder
from dataload import get_dataloader
from config import Co... |
#!/usr/bin/env python3
# eBNF compiler
# with a greedy LL parser: no left-recursion, no 'a'+ 'a' alike sequences
# greedy implies that rules "<X> ::= a | a b"
# must be replaced by "<X> ::= a b | a" (longest fule first)
#
# Syntax: terminals between "", assign with ::=, rules end at ;
# Operators: group (), optional {}... |
"""This module implements the POUNDERs algorithm."""
import functools
import numpy as np
from estimagic.config import IS_PETSC4PY_INSTALLED
from estimagic.optimization.algo_options import CONVERGENCE_ABSOLUTE_GRADIENT_TOLERANCE
from estimagic.optimization.algo_options import CONVERGENCE_RELATIVE_GRADIENT_TOLERANCE
fro... |
from base import BaseModel
import torch
import torch.nn as nn
import torch.nn.functional as F
from torchvision import models
from itertools import chain
from math import ceil
class SegNet(BaseModel):
def __init__(self, num_classes, in_channels=3, pretrained=True, freeze_bn=False, **_):
super(SegNet, self).... |
import datetime
import subprocess
import threading
import random
import queue
import atexit
import json
import time
import sys
import re
import os
class Remote:
def __init__(self, address=None, port=None, identity_file=None):
self.address = address
self.port = port or 22
self.ifile = ident... |
#! -*- coding: utf-8 -*-
# normalize module #
from JapaneseTokenizer.common.text_preprocess import normalize_text, denormalize_text
# datemodels #
from MeCab import Node
# typing #
from typing import List, Union, Any, Tuple, Dict, Callable
from future.utils import text_type, string_types
import sys
import six
__author_... |
# Author: <NAME>
# Date: 26/06/2018
# Project: clustering
from clustering.union_find import *
# Defines a class aimed at generating samples for clustering
class ClusterGenerator:
# Initialization
# structure refers to the type of data to generate
# n_samples refers to the amount of data to deal with... |
"""
meminfo - file ``/proc/meminfo``
================================
This suite of parsers deals with various parts of the contents of
``/proc/meminfo``. They store the data for many different groupings of
memory usage information as key-value pairs and attributes. Key strings are
converted to lower case, and all v... |
from . category import CategoryAdapter
from . tier import TierAdapter
from anthill.common.database import DatabaseError, DuplicateError
from anthill.common.model import Model
from anthill.common.validate import validate
import ujson
class StoreItemAdapter(object):
def __init__(self, record):
self.item_... |
from typing import Iterable
from asgiref.sync import async_to_sync
from django.conf import settings
from django.db import models, transaction
from django.utils.timezone import now
from jsonfield import JSONField
from openslides.utils.autoupdate import AutoupdateElement
from openslides.utils.cache import element_cache... |
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... |
#!/usr/bin/env python
"""
Watchdog completed job type execution with an expected periodicity.
"""
from __future__ import division
from __future__ import unicode_literals
from __future__ import print_function
from __future__ import absolute_import
from builtins import str
from future import standard_library
standard_l... |
# MODULE: Typerig / Proxy / Shape (Objects)
# -----------------------------------------------------------
# (C) <NAME>, 2018-2020 (http://www.kateliev.com)
# (C) Karandash Type Foundry (http://www.karandash.eu)
#------------------------------------------------------------
# www.typerig.com
# No warranties. By using... |
## @file
# This file is used to define each component of Target.txt file
#
# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
##
# Import Modules
#
from __future__ import print_function
from __future__ import absolute_import
from buildo... |
import boto3
from botocore.exceptions import ClientError
import logging
import re
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("--dryrun", help="do not modify, show what would be done", action='store_true')
parser.add_argument(
'-d', '--debug',
help="Print lots of debugging statements"... |
# Copyright 2015 Red Hat, 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/licenses/LICENSE-2.0
#
# Unless required by... |
import discord, pomice, io, textwrap, contextlib, traceback
from discord.ext import commands
from core.views import confirm
class Owner(commands.Cog, description="Only my Developer can use these!"):
def __init__(self, bot):
self.bot = bot
# Eval
@commands.command(name="eval", help="Evaluates the gi... |
"""Image Cascade Network"""
import torch
import torch.nn as nn
import torch.nn.functional as F
from model.resnetv1b import resnet50_v1s
class SegBaseModel(nn.Module):
r"""Base Model for Semantic Segmentation
Parameters
----------
backbone : string
Pre-trained dilated backbone netwo... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.