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
Multi2WOZ
Multi2WOZ-main/downstream/utils/utils_domain.py
import torch import torch.utils.data as data import random import math from .dataloader_dst import * from .dataloader_nlg import * from .dataloader_nlu import * from .dataloader_dm import * from .dataloader_usdl import * def get_loader(args, mode, tokenizer, datasets, unified_meta, shuffle=False): task = args["ta...
3,348
39.349398
122
py
Multi2WOZ
Multi2WOZ-main/downstream/utils/utils_camrest676.py
import json import ast import collections import os from .utils_function import get_input_example def read_langs_turn(args, file_name, max_line = None): print(("Reading from {} for read_langs_turn".format(file_name))) data = [] with open(file_name) as f: dials = json.load(f) ...
2,180
28.472973
93
py
Multi2WOZ
Multi2WOZ-main/downstream/utils/utils_universal_act.py
import json import ast import os from .utils_function import get_input_example def read_langs_turn(file_name, max_line = None): print(("Reading from {} for read_langs_turn".format(file_name))) data = [] domain_counter = {} with open(file_name) as f: dials = json.load(f) ...
4,855
43.550459
103
py
Multi2WOZ
Multi2WOZ-main/downstream/utils/multiwoz/nlp.py
import math import re from collections import Counter from nltk.util import ngrams timepat = re.compile("\d{1,2}[:]\d{1,2}") pricepat = re.compile("\d{1,3}[.]\d{1,2}") fin = open('utils/multiwoz/mapping.pair', 'r') replacements = [] for line in fin.readlines(): tok_from, tok_to = line.replace('\n', '').split('\...
7,781
30.763265
124
py
Multi2WOZ
Multi2WOZ-main/downstream/utils/multiwoz/delexicalize.py
import re import simplejson as json from .nlp import normalize digitpat = re.compile('\d+') timepat = re.compile("\d{1,2}[:]\d{1,2}") pricepat2 = re.compile("\d{1,3}[.]\d{1,2}") # FORMAT # domain_value # restaurant_postcode # restaurant_address # taxi_car8 # taxi_number # train_id etc.. def prepareSlotValuesIndep...
6,421
42.391892
100
py
Multi2WOZ
Multi2WOZ-main/downstream/utils/multiwoz/dbPointer.py
import sqlite3 import numpy as np from .nlp import normalize # loading databases domains = ['restaurant', 'hotel', 'attraction', 'train', 'taxi', 'hospital']#, 'police'] dbs = {} for domain in domains: db = 'data/multi-woz/db/{}-dbase.db'.format(domain) conn = sqlite3.connect(db) c = conn.cursor() ...
6,600
37.377907
137
py
Multi2WOZ
Multi2WOZ-main/downstream/utils/multiwoz/fix_label.py
def fix_general_label_error(labels, type, slots, ontology_version=""): label_dict = dict([ (l[0], l[1]) for l in labels]) if type else dict([ (l["slots"][0][0], l["slots"][0][1]) for l in labels]) GENERAL_TYPO = { # type "guesthouse":"guest house","guesthouses":"guest house","guest":"guest ho...
24,598
59.439803
167
py
Multi2WOZ
Multi2WOZ-main/downstream/utils/metrics/measures.py
from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import numpy import os import re import subprocess import tempfile import numpy as np from six.moves import urllib def word_error_rate(r, h): """ This is a func...
4,190
35.12931
99
py
Multi2WOZ
Multi2WOZ-main/downstream/utils/loss_function/masked_cross_entropy.py
import torch from torch.nn import functional from torch.autograd import Variable from utils.config import * import torch.nn as nn import numpy as np def sequence_mask(sequence_length, max_len=None): if max_len is None: max_len = sequence_length.data.max() batch_size = sequence_length.size(0) seq_ra...
6,501
36.802326
92
py
custom-diffusion
custom-diffusion-main/sample.py
# This code is built from the Stable Diffusion repository: https://github.com/CompVis/stable-diffusion. # Copyright (c) 2022 Robin Rombach and Patrick Esser and contributors. # CreativeML Open RAIL-M # # ========================================================================================== # # Adobe’s modifications...
27,272
62.131944
1,097
py
custom-diffusion
custom-diffusion-main/train.py
# This code is built from the Stable Diffusion repository: https://github.com/CompVis/stable-diffusion. # Copyright (c) 2022 Robin Rombach and Patrick Esser and contributors. # CreativeML Open RAIL-M # # ========================================================================================== # # Adobe’s modifications...
48,845
48.389282
1,097
py
custom-diffusion
custom-diffusion-main/src/diffusers_model_pipeline.py
# This code is built from the Huggingface repository: https://github.com/huggingface/diffusers/blob/main/examples/dreambooth/train_dreambooth.py, and # https://github.com/huggingface/diffusers/blob/main/examples/textual_inversion/textual_inversion.py # Copyright 2022- The Hugging Face team. All rights reserved. # ...
25,547
50.198397
149
py
custom-diffusion
custom-diffusion-main/src/diffusers_training.py
# This code is built from the Huggingface repository: https://github.com/huggingface/diffusers/blob/main/examples/dreambooth/train_dreambooth.py, and # https://github.com/huggingface/diffusers/blob/main/examples/textual_inversion/textual_inversion.py # Copyright 2022- The Hugging Face team. All rights reserved. # ...
51,778
45.816456
253
py
custom-diffusion
custom-diffusion-main/src/compress.py
# Copyright 2022 Adobe Research. All rights reserved. # To view a copy of the license, visit LICENSE.md. import torch import argparse def compress(delta_ckpt, ckpt, diffuser=False, compression_ratio=0.6, device='cuda'): st = torch.load(f'{delta_ckpt}') if not diffuser: compressed_key = 'state_dict' ...
2,479
34.428571
107
py
custom-diffusion
custom-diffusion-main/src/diffusers_data_pipeline.py
# This code is built from the Huggingface repository: https://github.com/huggingface/diffusers/blob/main/examples/dreambooth/train_dreambooth.py, and # https://github.com/huggingface/diffusers/blob/main/examples/textual_inversion/textual_inversion.py # Copyright 2022- The Hugging Face team. All rights reserved. # ...
20,730
50.061576
161
py
custom-diffusion
custom-diffusion-main/src/diffusers_composenW.py
# Copyright 2022 Adobe Research. All rights reserved. # To view a copy of the license, visit LICENSE.md. import sys import os import argparse import torch from scipy.linalg import lu_factor, lu_solve sys.path.append('./') from diffusers import StableDiffusionPipeline from src import diffusers_sample def gdupdateWe...
7,508
37.706186
172
py
custom-diffusion
custom-diffusion-main/src/model.py
# This code is built from the Stable Diffusion repository: https://github.com/CompVis/stable-diffusion. # Copyright (c) 2022 Robin Rombach and Patrick Esser and contributors. # CreativeML Open RAIL-M # # ========================================================================================== # # Adobe’s modifications...
29,720
70.102871
1,097
py
custom-diffusion
custom-diffusion-main/src/custom_modules.py
# This code is built from the Huggingface repository: https://github.com/huggingface/transformers/tree/main/src/transformers/models/clip. # Copyright 2018- The Hugging Face team. All rights reserved. # Apache License # Version 2.0, January 2004 # ...
16,723
50.937888
137
py
custom-diffusion
custom-diffusion-main/src/finetune_data.py
# This code is built from the Stable Diffusion repository: https://github.com/CompVis/stable-diffusion. # Copyright (c) 2022 Robin Rombach and Patrick Esser and contributors. # CreativeML Open RAIL-M # # ========================================================================================== # # Adobe’s modifications...
22,159
81.686567
1,097
py
custom-diffusion
custom-diffusion-main/src/retrieve.py
# Copyright 2022 Adobe Research. All rights reserved. # To view a copy of the license, visit LICENSE.md. import argparse import os import tqdm from pathlib import Path import requests from PIL import Image from io import BytesIO from clip_retrieval.clip_client import ClipClient def retrieve(target_name, outpath, num...
2,989
31.150538
143
py
custom-diffusion
custom-diffusion-main/src/get_deltas.py
# Copyright 2022 Adobe Research. All rights reserved. # To view a copy of the license, visit LICENSE.md. import os import argparse import glob import torch def main(path, newtoken=0): layers = [] for files in glob.glob(f'{path}/checkpoints/*'): if ('=' in files or '_' in files) and 'delta' not in file...
2,047
36.925926
149
py
custom-diffusion
custom-diffusion-main/src/composenW.py
# Copyright 2022 Adobe Research. All rights reserved. # To view a copy of the license, visit LICENSE.md. import sys import os import argparse import random import torch import torchvision import numpy as np from tqdm import tqdm from scipy.linalg import lu_factor, lu_solve sys.path.append('stable-diffusion') sys.pa...
11,722
38.738983
130
py
custom-diffusion
custom-diffusion-main/src/convert.py
# Copyright 2022 Adobe Research. All rights reserved. # To view a copy of the license, visit LICENSE.md. import os, sys import argparse import torch from omegaconf import OmegaConf from ldm.util import instantiate_from_config sys.path.append('stable-diffusion') sys.path.append('./') from src.diffusers_model_pipeline i...
7,914
47.858025
161
py
custom-diffusion
custom-diffusion-main/src/__init__.py
0
0
0
py
custom-diffusion
custom-diffusion-main/src/diffusers_sample.py
# ========================================================================================== # # MIT License. To view a copy of the license, visit MIT_LICENSE.md. # # ========================================================================================== import argparse import sys import os import numpy as np impor...
3,037
39.506667
122
py
custom-diffusion
custom-diffusion-main/customconcept101/evaluate.py
import argparse import glob import json import os import warnings from pathlib import Path import clip import numpy as np import pandas as pd import sklearn.preprocessing import torch from packaging import version from PIL import Image from torchvision.transforms import CenterCrop, Compose, Normalize, Resize, ToTensor...
10,450
33.953177
122
py
BioSimulator.jl
BioSimulator.jl-master/benchmarks/stochpy_bench.py
import stochpy import statistics as stats from statsmodels import robust import argparse import random import sys def benchmark(fdir, method, tfinal, nsaves, nreal, seed, n_sample): # initialize smod = stochpy.SSA() times = [] smod.Model(model_file='stochpy.psc', dir=fdir) random.seed(seed) for i in ran...
1,358
22.033898
79
py
globus-automate-client
globus-automate-client-main/examples/sdk_scripts/flow_deploy_and_run.py
#!/usr/bin/env python import json import sys from globus_automate_client import create_flows_client def main(): flow_file = sys.argv[1] with open(flow_file, "r") as ff: flow_dict = json.load(ff) flow_input = sys.argv[2] with open(flow_input, "r") as fi: flow_input_data = json.load(fi)...
773
24.8
70
py
globus-automate-client
globus-automate-client-main/tests/conftest.py
import pytest import responses @pytest.fixture(autouse=True) def mocked_responses(): """Mock responses to requests.""" with responses.RequestsMock() as request_mock: yield request_mock
204
17.636364
50
py
globus-automate-client
globus-automate-client-main/tests/test_flows_client.py
import json import os import pathlib import urllib.parse from typing import Any, Dict, Union, cast from unittest.mock import Mock import pytest import yaml from globus_automate_client import flows_client VALID_FLOW_DEFINITION = { "StartAt": "perfect", "States": { "perfect": { "Type": "Pas...
36,535
35.609218
87
py
globus-automate-client
globus-automate-client-main/tests/test_init.py
import inspect import globus_automate_client def test_all_exports(): """Validate that all imported names are listed in __all__.""" imported = set( name for name in dir(globus_automate_client) if ( not name.startswith("__") and not inspect.ismodule(getattr(glob...
490
24.842105
75
py
globus-automate-client
globus-automate-client-main/tests/test_sdk_v3.py
from typing import Iterable import pytest import globus_automate_client from globus_automate_client.cli.constants import ( ActionRole, ActionRoleAllNames, ActionRoleDeprecated, FlowRole, FlowRoleAllNames, FlowRoleDeprecated, ) def test_import(): assert bool(globus_automate_client) @pyt...
898
22.051282
64
py
globus-automate-client
globus-automate-client-main/tests/test_action_client.py
import json import urllib.parse import uuid import pytest import responses from globus_automate_client import action_client @pytest.fixture def ac(): yield action_client.ActionClient() @pytest.mark.parametrize( "data, expected", ( ({"globus_auth_scope": "success"}, "success"), ({}, "")...
5,532
33.798742
86
py
globus-automate-client
globus-automate-client-main/tests/test_helpers.py
import pytest from globus_automate_client import helpers @pytest.mark.parametrize( "args, expected, message", ( # Null ((None, {}), None, "If nothing is specified, None must be returned"), # # List with no dict keys (([], {}), set(), "empty list identity not maintained...
4,584
35.102362
88
py
globus-automate-client
globus-automate-client-main/docs/source/conf.py
# Configuration file for the Sphinx documentation builder. # # This file only contains a selection of the most common options. For a full # list see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html # -- Path setup -------------------------------------------------------------- # If ex...
1,983
28.61194
79
py
globus-automate-client
globus-automate-client-main/docs/source/code_snippets/premade_authorizers.py
import os from globus_sdk import AccessTokenAuthorizer from globus_automate_client import FlowsClient from globus_automate_client.cli.auth import CLIENT_ID from globus_automate_client.flows_client import AllowedAuthorizersType def authorizer_retriever( flow_url: str, flow_scope: str, client_id: str ) -> Allowed...
2,037
34.137931
78
py
globus-automate-client
globus-automate-client-main/docs/source/code_snippets/runner.py
import logging import os import pathlib import queue import sys # The flow to run. FLOW_ID = "your-flow-id-here" # The flow will be run X seconds after the most recent filesystem event is received. # If no filesystem events are ever received, the flow will not be run. COOL_OFF_TIME_S = 60 logging.basicConfig( l...
3,029
27.857143
88
py
globus-automate-client
globus-automate-client-main/globus_automate_client/graphviz_rendering.py
import json from typing import Any, Dict, List, Mapping, Optional from graphviz import Digraph _SHAPE_TYPES = { "Choice": {"shape": "diamond"}, "Action": {"shape": "box"}, "Succeed": {"shape": "box", "style": "rounded"}, } _COLOR_PRECEDENCE = ["", "yellow", "orange", "green", "red"] def json_to_label_t...
3,145
36.903614
86
py
globus-automate-client
globus-automate-client-main/globus_automate_client/client_helpers.py
import typing as t from globus_sdk.authorizers import GlobusAuthorizer from globus_automate_client.action_client import ActionClient from globus_automate_client.cli.auth import CLIENT_ID, get_cli_authorizer from globus_automate_client.flows_client import ( MANAGE_FLOWS_SCOPE, PROD_FLOWS_BASE_URL, FlowsCli...
5,518
40.810606
91
py
globus-automate-client
globus-automate-client-main/globus_automate_client/__init__.py
from .action_client import ActionClient from .cli.auth import get_authorizer_for_scope from .client_helpers import create_action_client, create_flows_client from .flows_client import FlowsClient, validate_flow_definition from .graphviz_rendering import graphviz_format, state_colors_for_log from .queues_client import Qu...
625
30.3
69
py
globus-automate-client
globus-automate-client-main/globus_automate_client/action_client.py
import os import uuid from typing import Any, Dict, Iterable, List, Mapping, Optional, Type, TypeVar, Union from urllib.parse import quote, urlparse from globus_sdk import BaseClient, GlobusHTTPResponse from globus_sdk.authorizers import GlobusAuthorizer from .helpers import merge_keywords _ActionClient = TypeVar("_...
9,799
37.582677
91
py
globus-automate-client
globus-automate-client-main/globus_automate_client/flows_client.py
import contextlib import json import os import warnings from pathlib import Path from typing import ( Any, Callable, Dict, Iterable, List, Mapping, Optional, Sequence, Set, Tuple, Type, TypeVar, Union, ) from urllib.parse import quote, urljoin, urlparse from globus_s...
51,219
37.80303
88
py
globus-automate-client
globus-automate-client-main/globus_automate_client/helpers.py
from typing import Any, Dict, Iterable, List, Optional, Set, Tuple, Union def merge_keywords( base: Optional[Iterable[str]], kwargs: Dict[str, Union[str, Iterable[str]]], *keywords: str, ) -> Optional[List[str]]: """Merge all given keyword parameter aliases and deduplicate the values. .. warning...
3,903
32.655172
88
py
globus-automate-client
globus-automate-client-main/globus_automate_client/queues_client.py
import uuid from typing import Any, Dict, List, Optional from globus_sdk import ( AccessTokenAuthorizer, BaseClient, ClientCredentialsAuthorizer, GlobusHTTPResponse, RefreshTokenAuthorizer, ) from globus_automate_client.cli.auth import get_authorizer_for_scope _prod_queues_base_url = "https://que...
5,346
32.41875
88
py
globus-automate-client
globus-automate-client-main/globus_automate_client/cli/auth.py
import copy import json import os import pathlib import platform import sys from json import JSONDecodeError from typing import Any, Callable, Dict, List, NamedTuple, Optional, Set, Union, cast import click import typer from globus_sdk import ( AuthAPIError, AuthClient, GlobusAPIError, NativeAppAuthCli...
14,482
33.898795
87
py
globus-automate-client
globus-automate-client-main/globus_automate_client/cli/main.py
try: from importlib.metadata import version as get_version # type: ignore except ImportError: # Python < 3.8 from importlib_metadata import version as get_version import typer import yaml from globus_automate_client.cli import actions, flows, queues, session from globus_automate_client.cli.auth import DE...
1,330
22.350877
78
py
globus-automate-client
globus-automate-client-main/globus_automate_client/cli/callbacks.py
import json import os import pathlib import re from errno import ENAMETOOLONG from typing import AbstractSet, Callable, List, Optional, cast from urllib.parse import urlparse import typer import yaml from globus_sdk import AuthClient from .auth import get_authorizer_for_scope _uuid_regex = ( "([a-fA-F0-9]{8}-[a-...
5,537
32.161677
83
py
globus-automate-client
globus-automate-client-main/globus_automate_client/cli/rich_rendering.py
from rich.console import Group from rich.live import Live class Content: """ This class represents a per CLI invocation "canvas" which will hold the data that gets displayed on the CLI. All content updates happen by updating the value of the instance's RenderGroup """ rg: Group = Group() ...
455
21.8
80
py
globus-automate-client
globus-automate-client-main/globus_automate_client/cli/constants.py
import enum import typer from globus_sdk import GlobusHTTPResponse from globus_automate_client.graphviz_rendering import ( graphviz_format, state_colors_for_log, ) class FlowRole(str, enum.Enum): flow_viewer = "flow_viewer" flow_starter = "flow_starter" flow_administrator = "flow_administrator" ...
4,445
26.614907
88
py
globus-automate-client
globus-automate-client-main/globus_automate_client/cli/rich_helpers.py
import abc import collections import functools import json from time import sleep from typing import Any, Callable, Dict, List, Optional, Set, Type, Union, cast import arrow import typer import yaml from globus_sdk import AuthClient, BaseClient, GlobusAPIError, GlobusHTTPResponse from requests import Response from ric...
13,647
29.600897
86
py
globus-automate-client
globus-automate-client-main/globus_automate_client/cli/actions.py
import functools from typing import List import typer from globus_automate_client.cli.callbacks import ( input_validator, principal_validator, url_validator_callback, ) from globus_automate_client.cli.constants import OutputFormat from globus_automate_client.cli.helpers import ( output_format_option, ...
9,011
29.969072
88
py
globus-automate-client
globus-automate-client-main/globus_automate_client/cli/session.py
import json import typer from globus_automate_client.cli.auth import get_current_user, logout, revoke_login from globus_automate_client.cli.helpers import verbosity_option app = typer.Typer(short_help="Manage your session with the Automate Command Line") @app.command("whoami") def session_whoami(verbose: bool = ve...
1,256
27.568182
82
py
globus-automate-client
globus-automate-client-main/globus_automate_client/cli/queues.py
import functools from enum import Enum from typing import List import typer from globus_automate_client.cli.auth import CLIENT_ID from globus_automate_client.cli.callbacks import input_validator, principal_validator from globus_automate_client.cli.constants import OutputFormat from globus_automate_client.cli.helpers ...
8,256
30.880309
88
py
globus-automate-client
globus-automate-client-main/globus_automate_client/cli/helpers.py
import json from typing import Any, Callable, Dict, List, Mapping, Optional, Union import requests import typer import yaml from globus_sdk import GlobusAPIError, GlobusHTTPResponse from globus_automate_client.cli.callbacks import flows_endpoint_envvar_callback from globus_automate_client.cli.constants import ( A...
3,446
28.715517
86
py
globus-automate-client
globus-automate-client-main/globus_automate_client/cli/flows.py
import functools import textwrap import uuid import warnings from typing import Any, List, Optional, Tuple import typer from globus_automate_client.cli.auth import CLIENT_ID from globus_automate_client.cli.callbacks import ( custom_principal_validator, flow_input_validator, input_validator, principal_...
50,154
32.237243
88
py
simanneal
simanneal-master/setup.py
#!/usr/bin/env/python try: from setuptools import setup except ImportError: from distutils.core import setup LONG_DESCRIPTION = """`simanneal` is a python implementation of the [simulated annealing optimization](http://en.wikipedia.org/wiki/Simulated_annealing) technique. Simulated annealing is used to find a...
1,231
33.222222
96
py
simanneal
simanneal-master/examples/salesman.py
# -*- coding: utf-8 -*- from __future__ import print_function import math import random from collections import defaultdict from simanneal import Annealer def distance(a, b): """Calculates distance between two latitude-longitude coordinates.""" R = 3963 # radius of Earth (miles) lat1, lon1 = math.radians...
3,152
31.84375
81
py
simanneal
simanneal-master/examples/watershed/shapefile.py
""" shapefile.py Provides read and write support for ESRI Shapefiles. author: jlawhead<at>geospatialpython.com date: 20110927 version: 1.1.4 Compatible with Python versions 2.4-3.x """ from struct import pack, unpack, calcsize, error import os import sys import time import array # # Constants for shape types NULL = 0 ...
38,106
36.993021
136
py
simanneal
simanneal-master/examples/watershed/watershed_condition.py
import math import sys import os sys.path.append(os.path.abspath('../')) from anneal import Annealer import shapefile import random #-----------------------------------------------# #-------------- Configuration ------------------# #-----------------------------------------------# shp = './data/huc6_4326.shp' specie...
5,505
27.677083
105
py
simanneal
simanneal-master/tests/test_anneal.py
import random import sys import time from helper import distance, cities, distance_matrix from simanneal import Annealer if sys.version_info.major >= 3: # pragma: no cover from io import StringIO else: from StringIO import StringIO class TravellingSalesmanProblem(Annealer): """Test annealer with a trav...
4,323
32.007634
98
py
simanneal
simanneal-master/tests/helper.py
import math def distance(a, b): """Calculates distance between two latitude-longitude coordinates.""" R = 3963 # radius of Earth (miles) lat1, lon1 = math.radians(a[0]), math.radians(a[1]) lat2, lon2 = math.radians(b[0]), math.radians(b[1]) return math.acos(math.sin(lat1) * math.sin(lat2) + ...
1,354
29.111111
81
py
simanneal
simanneal-master/simanneal/__init__.py
from __future__ import absolute_import from .anneal import Annealer __all__ = ['Annealer'] __version__ = "0.5.0"
114
18.166667
38
py
simanneal
simanneal-master/simanneal/anneal.py
from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import abc import copy import datetime import math import pickle import random import signal import sys import time def round_figures(x, n): """Returns x rounded to ...
11,213
34.6
111
py
EASIER
EASIER-master/easier-dataAnalyst/src/myfunction.py
#myfunction.py import numpy as np from math import pow, sqrt from operator import itemgetter def norm2perfq(min_perfq, max_perfq, value, min, max): return min_perfq + (max_perfq - min_perfq) * (value - min) / (max - min) def getpoint(data, index): try: return data[np.where(data[:, 0] == index)[0][0...
1,787
30.928571
101
py
EASIER
EASIER-master/easier-dataAnalyst/src/easier-lengths.py
# 0 - solution number, # 1 - PA, # 2 - PerfQ, # 3 - Dist import numpy as np import myfunction import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D base_dir = '../data/' # Near-Pareto frontier from a chromosome long 4 pareto_folder_l4 = base_dir + 'FTA/length_4/pareto/' file_l4 = pareto_fol...
4,969
38.444444
122
py
EASIER
EASIER-master/easier-dataAnalyst/src/easier_population.py
#easier_long import numpy as np import myfunction import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D base_dir = '../data/' # Near-Pareto frontier pareto_folder_64_E1280 = base_dir + 'FTA/64/lenght_4/pareto/P_64_E_1280_X_0.8_M_0.2__18.10.03.11.03.58__/' file_64_E1280 = pareto_folder_64_E1280 + 'P...
4,750
42.990741
141
py
EASIER
EASIER-master/easier-dataAnalyst/src/easier_long.py
#easier_long import numpy as np import myfunction import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D base_dir = '../data/' # Near-Pareto frontier from a chromosome long 4 pareto_folder_64_l4 = base_dir + 'FTA/64/lenght_4/pareto/P_64_E_1280_X_0.8_M_0.2__18.10.03.11.03.58__/' file_64_l4 = pareto_f...
3,488
37.340659
123
py
EASIER
EASIER-master/easier-dataAnalyst/src/easier_evolution.py
#easier_long import numpy as np import myfunction import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D base_dir = '../data/' # Near-Pareto frontier from a chromosome long 4 pareto_folder_64_E1280 = base_dir + 'FTA/64/lenght_4/pareto/P_64_E_1280_X_0.8_M_0.2__18.10.03.11.03.58__/' file_64_E1280 = pa...
4,659
41.363636
141
py
AnalyzeParameterEfficientFinetune
AnalyzeParameterEfficientFinetune-main/src/zlog.py
import os import time import torch import traceback from contextlib import contextmanager from tensorboardX import SummaryWriter # maple import jiant.utils.python.io as py_io import jiant.utils.python.filesystem as filesystem class BaseZLogger: def log_context(self): raise NotImplementedError() def...
7,042
27.864754
112
py
AnalyzeParameterEfficientFinetune
AnalyzeParameterEfficientFinetune-main/src/runscript.py
import os import torch from transformers import AutoConfig import jiant.proj.main.write_task_configs as write_task_configs import jiant.proj.main.export_model as export_model #import jiant.proj.main.tokenize_and_cache as tokenize_and_cache import tokenize_and_cache # maple import jiant.proj.main.scripts.configurator...
13,469
43.163934
201
py
AnalyzeParameterEfficientFinetune
AnalyzeParameterEfficientFinetune-main/src/evaluate.py
import json import os import torch import jiant.utils.python.io as py_io import jiant.proj.main.components.task_sampler as jiant_task_sampler from jiant.proj.main.components.evaluate import * def write_val_results(val_results_dict, metrics_aggregator, output_dir, verbose=True, result_file = "val_metrics.json"): ...
1,180
38.366667
120
py
AnalyzeParameterEfficientFinetune
AnalyzeParameterEfficientFinetune-main/src/metarunner.py
import jiant.proj.main.metarunner as jiant_metarunner from jiant.utils.zlog import BaseZLogger, PRINT_LOGGER import jiant.proj.main.runner as jiant_runner class JiantMetarunner(jiant_metarunner.JiantMetarunner): def __init__( self, runner: jiant_runner.JiantRunner, save_every_steps, ...
1,294
32.205128
134
py
AnalyzeParameterEfficientFinetune
AnalyzeParameterEfficientFinetune-main/src/container_setup.py
import warnings from dataclasses import dataclass from typing import Dict, List, Optional import jiant.proj.main.components.task_sampler as jiant_task_sampler import jiant.shared.caching as caching from jiant.tasks.core import Task from jiant.tasks.retrieval import create_task_from_config_path import jiant.utils.pytho...
5,589
47.189655
100
py
AnalyzeParameterEfficientFinetune
AnalyzeParameterEfficientFinetune-main/src/runner.py
from http.client import NotConnected from typing import Dict from dataclasses import dataclass import torch import math import numpy as np import copy #from functorch import * from torch.autograd.functional import * import jiant.tasks.evaluate as evaluate import jiant.utils.torch_utils as torch_utils #from jiant.pro...
45,479
47.177966
202
py
AnalyzeParameterEfficientFinetune
AnalyzeParameterEfficientFinetune-main/src/model_setup.py
import transformers import torch from jiant.ext.radam import RAdam class OptimizerScheduler: def __init__(self, optimizer, scheduler): super().__init__() self.optimizer = optimizer self.scheduler = scheduler def step(self): self.optimizer.step() self.scheduler.step() ...
6,050
30.515625
112
py
AnalyzeParameterEfficientFinetune
AnalyzeParameterEfficientFinetune-main/src/main_runscript.py
import os import torch import datetime import jiant.proj.main.modeling.model_setup as jiant_model_setup import runner as jiant_runner #import jiant.proj.main.components.container_setup as container_setup #import jiant.proj.main.metarunner as jiant_metarunner import metarunner as jiant_metarunner #import jiant.proj.ma...
15,719
41.95082
200
py
AnalyzeParameterEfficientFinetune
AnalyzeParameterEfficientFinetune-main/src/tokenize_and_cache.py
import os from transformers import AutoConfig from transformers import AutoTokenizer import jiant.proj.main.preprocessing as preprocessing import jiant.shared.caching as shared_caching import jiant.tasks.evaluate as evaluate import jiant.utils.python.io as py_io import jiant.utils.zconf as zconf from jiant.proj.main...
4,884
36.290076
100
py
pdbfixer
pdbfixer-master/setup.py
"""pdbfixer: Fixes problems in PDB files Protein Data Bank (PDB) files often have a number of problems that must be fixed before they can be used in a molecular dynamics simulation. The details vary depending on how the file was generated. Here are some of the most common ones: - If the structure was generated by X-r...
3,004
36.5625
81
py
pdbfixer
pdbfixer-master/devtools/createSoftForcefield.py
""" createSoftForceField.py: Creates a force field XML file that is suitable for removing clashes in very badly strained systems. This is part of the OpenMM molecular simulation toolkit originating from Simbios, the NIH National Center for Physics-Based Simulation of Biological Structures at Stanford, funded under the...
6,801
40.987654
145
py
pdbfixer
pdbfixer-master/devtools/travis-ci/push-docs-to-s3.py
#!/usr/bin/env python """ Must have the vollowing environment variables defined: * BUCKET_NAME : AWS bucket name * PREFIX : 'latest' or other version number """ import os import pip import tempfile import subprocess import thermopyl.version BUCKET_NAME = 'thermopyl.org' if not thermopyl.version.release: PREFIX...
1,410
27.795918
81
py
pdbfixer
pdbfixer-master/pdbfixer/ui.py
from __future__ import absolute_import import webbrowser import os.path import time import sys from math import sqrt import openmm.app as app import openmm.unit as unit from openmm.vec3 import Vec3 from .pdbfixer import PDBFixer, proteinResidues, dnaResidues, rnaResidues, _guessFileFormat from . import uiserver if ...
12,126
41.85159
223
py
pdbfixer
pdbfixer-master/pdbfixer/uiserver.py
from threading import Thread import cgi import sys try: from socketserver import ThreadingMixIn from http.server import HTTPServer, BaseHTTPRequestHandler from urllib.parse import parse_qs except: from SocketServer import ThreadingMixIn from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler ...
2,717
31.746988
154
py
pdbfixer
pdbfixer-master/pdbfixer/pdbfixer.py
""" pdbfixer.py: Fixes problems in PDB files This is part of the OpenMM molecular simulation toolkit originating from Simbios, the NIH National Center for Physics-Based Simulation of Biological Structures at Stanford, funded under the NIH Roadmap for Medical Research, grant U54 GM072970. See https://simtk.org. Portio...
60,255
45.350769
228
py
pdbfixer
pdbfixer-master/pdbfixer/__init__.py
from __future__ import absolute_import from .pdbfixer import PDBFixer
71
17
38
py
pdbfixer
pdbfixer-master/pdbfixer/tests/test_mutate.py
import openmm.app as app import pdbfixer import tempfile from pytest import raises def test_mutate_1(): fixer = pdbfixer.PDBFixer(pdbid='1VII') fixer.applyMutations(["ALA-57-GLY"], "A") fixer.findMissingResidues() fixer.findMissingAtoms() fixer.addMissingAtoms() fixer.addMissingHyd...
2,999
41.253521
156
py
pdbfixer
pdbfixer-master/pdbfixer/tests/test_cli.py
#!/usr/bin/python #============================================================================================= # MODULE DOCSTRING #============================================================================================= """ Test command-line interface. """ #===================================================...
1,855
31.561404
118
py
pdbfixer
pdbfixer-master/pdbfixer/tests/test_build_and_simulate.py
from __future__ import print_function import pdbfixer import openmm import os import os.path import sys import numpy import tempfile from threading import Timer #from a solution on stackoverflow class Watchdog(BaseException): def __init__(self, timeout, userHandler=None): # timeout in seconds self.time...
9,799
45.445498
2,624
py
pdbfixer
pdbfixer-master/pdbfixer/tests/__init__.py
0
0
0
py
pdbfixer
pdbfixer-master/pdbfixer/tests/test_removechains.py
import openmm.app as app import pdbfixer import tempfile import time from pathlib import Path from urllib.request import urlopen from io import StringIO import pytest @pytest.fixture(scope="module") def file_content(): return (Path(__file__).parent / "data" / "4JSV.pdb").read_text() def remove_chains_and_verify...
1,647
42.368421
91
py
SGA
SGA-main/setup.py
#!/usr/bin/env python # Supports: # - python setup.py install # # Does not support: # - python setup.py test # - python setup.py version import os, glob from setuptools import setup, find_packages def _get_version(): import subprocess version = subprocess.check_output('git describe', shell=True) version ...
1,244
20.842105
65
py
SGA
SGA-main/science/SGA2020/sga-bgspv-targets.py
#!/usr/bin/env python import os, pdb import numpy as np import fitsio from glob import glob from astropy.table import Table, vstack, join from desitarget.targetmask import desi_mask, bgs_mask, scnd_mask pvnames = ['PV_BRIGHT_HIGH', 'PV_BRIGHT_MEDIUM', 'PV_BRIGHT_LOW', 'PV_DARK_HIGH', 'PV_DARK_MEDIUM', 'PV_...
2,087
33.229508
120
py
SGA
SGA-main/py/SGA/galex.py
""" SGA.galex ========= Code to generate GALEX custom coadds / mosaics. """ import os, pdb import numpy as np from astrometry.util.util import Tan from astrometry.util.fits import fits_table import SGA.misc def _ra_ranges_overlap(ralo, rahi, ra1, ra2): import numpy as np x1 = np.cos(np.deg2rad(ralo)) y...
13,777
36.237838
105
py
SGA
SGA-main/py/SGA/html.py
""" SGA.html ======== Code to generate HTML output for the various stages of the SGA analysis. """ import os import numpy as np def get_layer(onegal): if onegal['DR'] == 'dr6': layer = 'mzls+bass-dr6' elif onegal['DR'] == 'dr7': layer = 'decals-dr5' else: print('Unrecognized data ...
9,966
33.607639
114
py
SGA
SGA-main/py/SGA/unwise.py
""" SGA.unwise ========== Code to generate unWISE custom coadds / mosaics. """ import os, pdb import numpy as np import SGA.misc def _unwise_to_rgb(imgs, bands=[1,2], mn=-1, mx=100, arcsinh=1.0): """Support routine to generate color unWISE images. Note that the input images need to be in *Vega* nanomaggies...
11,596
38.580205
105
py
SGA
SGA-main/py/SGA/qa.py
""" SGA.qa ====== Code to do produce various QA (quality assurance) plots. """ import os, pdb import warnings import time, subprocess import numpy as np import matplotlib.pyplot as plt import matplotlib.patches as patches import SGA.misc #import seaborn as sns #sns.set(style='ticks', font_scale=1.4, palette='Set2'...
26,737
40.198767
109
py
SGA
SGA-main/py/SGA/io.py
""" SGA.io ====== Code to read and write the various SGA files. """ import os, warnings import pickle, pdb import numpy as np import numpy.ma as ma from glob import glob import fitsio from astropy.table import Table, Column, hstack from astropy.io import fits def custom_brickname(ra, dec): brickname = '{:08d}{}...
14,765
35.369458
133
py
SGA
SGA-main/py/SGA/webapp/settings.py
#!/usr/bin/env python """Django settings for SGA project. Generated by 'django-admin startproject' using Django 2.0.6. For more information on this file, see https://docs.djangoproject.com/en/2.0/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/2.0/ref/settings/...
3,973
25.317881
102
py
SGA
SGA-main/py/SGA/webapp/wsgi.py
""" WSGI config for SGA webapp project. It exposes the WSGI callable as a module-level variable named ``application``. For more information on this file, see https://docs.djangoproject.com/en/2.0/howto/deployment/wsgi/ """ import os from django.core.wsgi import get_wsgi_application os.environ.setdefault("DJANGO_SE...
397
22.411765
78
py
SGA
SGA-main/py/SGA/webapp/load.py
#!/usr/bin/env python """Load the input sample into a database table. """ import os import numpy as np import fitsio import django from astropy.table import Table, hstack DATADIR = '/global/cfs/cdirs/cosmo/data/sga/2020' #DATADIR = '/global/cfs/cdirs/cosmo/work/legacysurvey/sga/2020' def main(): from astrometr...
2,737
32.390244
104
py
SGA
SGA-main/py/SGA/webapp/manage.py
#!/usr/bin/env python """ Used to run the server for this Django project """ import os, sys if __name__ == "__main__": os.environ.setdefault("DJANGO_SETTINGS_MODULE", "SGA.webapp.settings") try: from django.core.management import execute_from_command_line except ImportError as exc: raise ...
593
28.7
74
py