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
rank-based-evaluation
rank-based-evaluation-main/src/kgm/training/matching.py
# coding=utf-8 """Training loops for KG matching models.""" import logging from abc import abstractmethod from typing import Any, Iterable, List, Mapping, Optional, Tuple, Type import torch from torch.optim import Optimizer from torch.utils import data from .base import BaseTrainer from ..data import KnowledgeGraphAl...
8,475
30.509294
114
py
rank-based-evaluation
rank-based-evaluation-main/src/kgm/training/__init__.py
# coding=utf-8 """Training Loops."""
37
11.666667
21
py
rank-based-evaluation
rank-based-evaluation-main/src/kgm/eval/matching.py
# coding=utf-8 """Entity Alignment evaluation methods.""" from typing import Collection, Dict, Mapping, Optional, Tuple, TypeVar, Union import torch from .common import aggregate_ranks, get_rank from ..data import MatchSideEnum, SIDES from ..models import KGMatchingModel from ..modules import Similarity from ..utils....
6,525
31.63
110
py
rank-based-evaluation
rank-based-evaluation-main/src/kgm/eval/common.py
"""Common utility methods for evaluation.""" import logging from typing import Collection, Mapping, Optional import torch logger = logging.getLogger(name=__name__) # Small constant for floating point comparison EPSILON = 1.0e-08 def get_rank(sim: torch.FloatTensor, true: torch.LongTensor) -> torch.FloatTensor: ...
4,478
36.957627
118
py
rank-based-evaluation
rank-based-evaluation-main/src/kgm/eval/__init__.py
# coding=utf-8 """Evaluation methods.""" from .common import compute_ranks from .matching import evaluate_alignment, evaluate_matching_model __all__ = [ 'compute_ranks', 'evaluate_alignment', 'evaluate_matching_model', ]
234
20.363636
65
py
rank-based-evaluation
rank-based-evaluation-main/src/kgm/models/__init__.py
# coding=utf-8 """Entity Alignment Models.""" from .matching import GCNAlign, GraphBasedKGMatchingModel, KGMatchingModel, PureEmbeddingModel, get_matching_model_by_name __all__ = [ 'GraphBasedKGMatchingModel', 'GCNAlign', 'KGMatchingModel', 'PureEmbeddingModel', 'get_matching_model_by_name', ]
316
25.416667
122
py
rank-based-evaluation
rank-based-evaluation-main/src/kgm/models/matching/base.py
# coding=utf-8 """API for models for knowledge graph matching.""" import logging from abc import ABC, abstractmethod from collections import defaultdict from typing import Any, Callable, Mapping, Optional, Type import torch from frozendict import frozendict from torch import nn from ...data import KnowledgeGraphAlign...
9,382
32.996377
130
py
rank-based-evaluation
rank-based-evaluation-main/src/kgm/models/matching/gcn_align.py
# coding=utf-8 """ Implementation of GCN-Align. The paper introducing the model can be found at https://www.aclweb.org/anthology/D18-1032.pdf. The authors' implementation can be found at https://github.com/1049451037/GCN-Align and they also refer to https://github.com/1049451037/HIN-Align for an improved implementati...
6,089
37.789809
137
py
rank-based-evaluation
rank-based-evaluation-main/src/kgm/models/matching/__init__.py
# coding=utf-8 """Models for (knowledge) graph matching.""" from .base import GraphBasedKGMatchingModel, KGMatchingModel, PureEmbeddingModel, get_matching_model_by_name from .gcn_align import GCNAlign __all__ = [ 'GraphBasedKGMatchingModel', 'GCNAlign', 'KGMatchingModel', 'PureEmbeddingModel', 'get...
348
25.846154
108
py
rank-based-evaluation
rank-based-evaluation-main/src/kgm/utils/mlflow_utils.py
# coding=utf-8 """Utility methods for MLFlow.""" import hashlib import itertools import logging import os import platform from typing import Any, Callable, Collection, Dict, List, Mapping, Optional, Tuple, Union import mlflow import mlflow.entities import pandas import tqdm from .common import to_dot logger = loggin...
9,803
31.463576
170
py
rank-based-evaluation
rank-based-evaluation-main/src/kgm/utils/data_utils.py
"""Utilities for retrieving and checking data files.""" import hashlib import logging import pathlib from typing import Optional import humanize import requests import tqdm logger = logging.getLogger(name=__name__) def resolve_google_drive_file_url( id_: str, session: requests.Session, ) -> requests.Respons...
5,600
29.606557
141
py
rank-based-evaluation
rank-based-evaluation-main/src/kgm/utils/types.py
"""Type annotation aliases.""" import torch #: A (n, 3) tensor of IDs. Triples = torch.LongTensor #: A (n,) tensor of IDs. EntityIDs = torch.LongTensor #: A (n,) tensor of IDs. RelationIDs = torch.LongTensor #: A (n,) tensor of IDs. NodeIDs = torch.LongTensor #: A (2, n) tensor of IDs. IDAlignment = torch.LongTens...
381
17.190476
30
py
rank-based-evaluation
rank-based-evaluation-main/src/kgm/utils/torch_utils.py
"""Utility methods using pytorch.""" import itertools import logging from abc import ABC from collections import defaultdict from operator import itemgetter from typing import Any, Callable, MutableMapping, Optional, Sequence, Tuple, Type, TypeVar, Union import numpy import torch from torch import nn, optim from .com...
21,537
32.86478
172
py
rank-based-evaluation
rank-based-evaluation-main/src/kgm/utils/common.py
"""General utility methods.""" import hashlib import inspect import logging import pickle import random import string from collections import deque from enum import Enum from typing import Any, Callable, Collection, Dict, Iterable, List, Mapping, Optional, Sequence, Set, Type, TypeVar, Union T = TypeVar('T') logger =...
9,553
29.234177
210
py
rank-based-evaluation
rank-based-evaluation-main/src/kgm/utils/__init__.py
# coding=utf-8 """A collection of utility methods."""
54
17.333333
38
py
rank-based-evaluation
rank-based-evaluation-main/src/kgm/data/reduction.py
"""Reduction strategies from Knowledge Graph to (weighted) uni-relational graphs.""" import enum import logging from typing import Callable, Optional import torch from .knowledge_graph import KnowledgeGraph from ..utils.torch_utils import ExtendedModule, SparseCOOMatrix logger = logging.getLogger(name=__name__) # ...
7,812
32.246809
155
py
rank-based-evaluation
rank-based-evaluation-main/src/kgm/data/loaders.py
"""Data loading for Entity Alignment datasets.""" import abc import io import json import logging import lzma import pathlib import tarfile import zipfile from typing import Collection, Generic, Mapping, Optional, Tuple, Type, TypeVar, Union import pandas import requests import torch from .knowledge_graph import Enti...
38,530
35.942474
184
py
rank-based-evaluation
rank-based-evaluation-main/src/kgm/data/knowledge_graph.py
# coding=utf-8 """Various knowledge graph related data structures.""" import enum import json import logging import lzma import pathlib from dataclasses import dataclass from typing import Mapping, Optional, Tuple, Union import torch from ..utils.torch_utils import split_tensor from ..utils.types import EntityIDs, ID...
25,646
33.287433
215
py
rank-based-evaluation
rank-based-evaluation-main/src/kgm/data/__init__.py
# coding=utf-8 """Data loading and representation.""" from .knowledge_graph import ( EntityAlignment, KnowledgeGraph, KnowledgeGraphAlignmentDataset, MatchSideEnum, SIDES, exact_self_alignment, get_erdos_renyi, get_other_side, get_synthetic_math_graph, sub_graph_alignment, va...
802
22.617647
88
py
rank-based-evaluation
rank-based-evaluation-main/executables/adjusted_ranking_experiments.py
# coding=utf-8 """Evaluation of different training and test sizes.""" import argparse import logging import random import mlflow import numpy import torch import tqdm from kgm.data import get_dataset_by_name from kgm.eval.matching import evaluate_matching_model from kgm.models import GCNAlign from kgm.modules import ...
4,618
30.855172
87
py
rank-based-evaluation
rank-based-evaluation-main/executables/summarize.py
"""Script to generate the plot #test alignments vs. #train alignments.""" import argparse import logging import mlflow import pandas import seaborn from matplotlib import pyplot as plt def main(): logging.basicConfig(level=logging.INFO) parser = argparse.ArgumentParser() parser.add_argument('--tracking_u...
2,006
26.875
95
py
rank-based-evaluation
rank-based-evaluation-main/executables/degree_investigation.py
"""Script to generate the evaluation for degree inductive bias.""" import numpy import torch from matplotlib import pyplot as plt from scipy.stats import pearsonr, spearmanr from kgm.data import SIDES, get_dataset_by_name from kgm.models import GCNAlign, PureEmbeddingModel def degree_vs_norm( dataset ): # ca...
2,854
27.55
96
py
pydot
pydot-master/setup.py
#!/usr/bin/env python """Installation script.""" try: from setuptools import setup except ImportError: from distutils.core import setup import ast import codecs import os import re CURRENT_DIR = os.path.dirname(__file__) def get_long_description(): readme_path = os.path.join(CURRENT_DIR, "README.md") ...
2,466
30.628205
78
py
pydot
pydot-master/src/pydot/core.py
"""An interface to GraphViz.""" import copy import io import errno import os import re import subprocess import sys import tempfile import warnings import pydot try: from pydot import dot_parser except Exception as e: warnings.warn( "`pydot` could not import `dot_parser`, " "so `pydot` will be...
54,064
28.837196
79
py
pydot
pydot-master/src/pydot/exceptions.py
"""Exception classes for pydot.""" class PydotException(Exception): """Base class for exceptions in Pydot. This base class will not be raised directly. Catch this base class to catch all derived exceptions, though be aware that pydot may raise Python built-in exceptions or pyparsing exceptions a...
516
21.478261
70
py
pydot
pydot-master/src/pydot/__init__.py
"""An interface to GraphViz.""" __author__ = "Ero Carrera" __version__ = "2.0.0.dev0" __license__ = "MIT" from pydot.exceptions import * from pydot.core import *
164
17.333333
31
py
pydot
pydot-master/src/pydot/dot_parser.py
"""Graphviz's dot language parser. The dotparser parses GraphViz files in dot and dot files and transforms them into a class representation defined by `pydot`. Author: Michael Krause <[email protected]> Fixes by: Ero Carrera <[email protected]> """ from pyparsing import ( nestedExpr, Literal, ...
15,074
25.871658
78
py
pydot
pydot-master/test/pydot_unittest.py
# coding=utf-8 """Unit testing of `pydot`.""" # TODO: # -test graph generation APIs (from adjacency, etc..) # -test del_node, del_edge methods # -test Common.set method import argparse from hashlib import sha256 import io import os import pickle import string import sys import warnings import chardet import pydot impo...
14,517
33.484561
79
py
OPM
OPM-master/napari_opm_pymmcoreplus.py
''' Initial work on napari interface to OPM using pymmcore-plus, magic-gui, and magic-class Relevant hardware: NI DAQ Hamamatsu Fusion-BT Coherent OBIS LaserBoxxx This will work with any setup that can setup the camera as master, lasers can driven ON/OFF during camera readout time using digital input, galvo can be m...
30,110
44.970992
192
py
OPM
OPM-master/napari-control/opm_iterative_control.py
#!/usr/bin/python ''' ---------------------------------------------------------------------------------------- ASU OPM with iterative fluidics control via Napari, magic-class, and magic-gui ---------------------------------------------------------------------------------------- Peter Brown Franky Djutanta Douglas Sheph...
2,756
37.291667
111
py
OPM
OPM-master/napari-control/opm_timelapse_reconstruction.py
import napari from src.OPMMirrorReconstruction import OPMMirrorReconstruction def main(): # setup OPM GUI and Napari viewer reconstruction_widget = OPMMirrorReconstruction() viewer = napari.Viewer() # these methods have to be private to not show using magic-class. Maybe a better solution is available...
634
27.863636
107
py
OPM
OPM-master/napari-control/opm_timelapse_control.py
#!/usr/bin/python ''' ---------------------------------------------------------------------------------------- ASU OPM timelapse via pymmcore-plus, napari, magic-class, and magic-gui ---------------------------------------------------------------------------------------- Peter Brown Franky Djutanta Douglas Shepherd 12/...
2,809
39.142857
107
py
OPM
OPM-master/napari-control/src/OPMMirrorReconstruction.py
''' Napari interface to process OPM timelapse data TO DO: - Change to OME-Zarr output - Add OME-tiff resave option - Add ability to load old data - Add option for number of iterations & TV setting for clij2-fft Last update: 12/2022; Update to use clij2-fft, remove flatfield (due to Powell lens), ...
12,061
37.292063
154
py
OPM
OPM-master/napari-control/src/OPM_main.py
#!/usr/bin/python from magicgui import magicgui from magicclass import magicclass, set_design from pathlib import Path @magicclass(labels=False) @set_design(text="Stage monitor") class OPMmain(): def __init__(self): self.path_to_fluidics_flush_program = Path('C:/Users/qi2lab/Documents/GitHub/common_fluid...
3,264
37.411765
138
py
OPM
OPM-master/napari-control/src/OPMMirrorScan.py
from pymmcore_plus import CMMCorePlus from magicclass import magicclass, MagicTemplate from magicgui import magicgui from magicgui.tqdm import trange from napari.qt.threading import thread_worker #from superqt.utils import ensure_main_thread from pathlib import Path import numpy as np import time import zarr from src...
37,618
42.540509
252
py
OPM
OPM-master/napari-control/src/OPMStageMonitor.py
# napari imports from magicclass import magicclass, set_design from magicgui import magicgui, widgets #general python imports from pymmcore_plus import RemoteMMCore # Stage monitor class @magicclass(labels=False) class OPMStageMonitor: def __init__(self): pass x_stage_pos = widgets.LineEdit(label='x...
1,018
29.878788
81
py
OPM
OPM-master/napari-control/src/OPMStageScan.py
# napari imports from re import T from magicclass import magicclass, set_design from magicgui import magicgui from magicgui.tqdm import trange from napari.qt.threading import thread_worker #general python imports from pathlib import Path import numpy as np from datetime import datetime import time # data i/o imports ...
56,334
45.21411
192
py
OPM
OPM-master/napari-control/src/OPMIterative.py
# napari imports from magicclass import magicclass, set_design, MagicTemplate from magicgui import magicgui, widgets from napari.qt.threading import thread_worker #general python imports from pathlib import Path from pymmcore_plus import RemoteMMCore import numpy as np from distutils.util import strtobool # ASU OPM i...
20,141
51.181347
141
py
OPM
OPM-master/napari-control/src/hardware/PicardShutter.py
#!/usr/bin/python # ---------------------------------------------------------------------------------------- # The basic I/O class for Picard USB Shutter # ---------------------------------------------------------------------------------------- # Doug Shepherd # 11/2022 # [email protected] # --------------------...
3,585
38.844444
108
py
OPM
OPM-master/napari-control/src/hardware/HamiltonMVP.py
#!/usr/bin/python # ---------------------------------------------------------------------------------------- # A basic class for serial interface with a series of daisy chained Hamilton MVP devices # ---------------------------------------------------------------------------------------- # Jeff Moffitt # 12/17/13 # jef...
21,387
45.495652
125
py
OPM
OPM-master/napari-control/src/hardware/AbstractValve.py
#!/usr/bin/python ''' Abstract class for controlling a hardware valve. Function names were derived from original valveChain and hamilton classes. George Emanuel 2/16/2018 ''' from abc import ABC, abstractmethod class AbstractValve(ABC): @abstractmethod def changePort(self, valve_ID, port_ID, direction = 0):...
820
18.093023
123
py
OPM
OPM-master/napari-control/src/hardware/ASI.py
#!/usr/bin/python ''' ---------------------------------------------------------------------------------------- OPM ASI Tiger functions ---------------------------------------------------------------------------------------- Douglas Shepherd 12/11/2021 [email protected] ------------------------------------------...
5,987
30.851064
90
py
OPM
OPM-master/napari-control/src/hardware/APump.py
#!/usr/bin/python # ---------------------------------------------------------------------------------------- # The basic I/O class for a Gibson peristaltic pump # ---------------------------------------------------------------------------------------- # George Emanuel with modifications by Jeff Moffitt # 11/16/15 # jef...
5,237
33.460526
90
py
OPM
OPM-master/napari-control/src/hardware/OPMNIDAQ.py
#!/usr/bin/python ''' ---------------------------------------------------------------------------------------- Basic class to run NIDAQ with camera as master for OPM using PyDAQMx ---------------------------------------------------------------------------------------- Peter Brown Franky Djutanta Douglas Shepherd 12/1...
8,624
43.921875
164
py
OPM
OPM-master/napari-control/src/utils/autofocus_remote_unit.py
#!/usr/bin/env python ''' Optimize O2-O3 coupling by capturing images of collimated 532 alignment laser injected into system using the back of pentaband dichroic with O3 at different positions along the (tilted) optical axis. Shepherd 11/2022 ''' import numpy as np from scipy import ndimage from pymmcore_plus import...
7,440
37.35567
239
py
OPM
OPM-master/napari-control/src/utils/opm_psf.py
import psfmodels as psfm import numpy as np import matplotlib.pyplot as plt from scipy.interpolate import interp2d # ROI tools def get_skewed_roi_size(sizes, theta, dc, dstep, ensure_odd=True): """ Get ROI size in OPM matrix that includes sufficient xy and z points :param sizes: [z-size, y-size, x-size] in...
5,177
32.623377
105
py
OPM
OPM-master/napari-control/src/utils/image_post_processing.py
''' QI2lab OPM suite Reconstruction tools Image processing tools for OPM reconstruction Last updated: Shepherd 01/22 - changes to include map_blocks based dexp deconvolution and recent other changes. ''' #!/usr/bin/env python import sys import numpy as np from pathlib import Path #from tifffile import tifffile from ...
9,889
32.299663
133
py
OPM
OPM-master/napari-control/src/utils/data_io.py
#!/usr/bin/python ''' ---------------------------------------------------------------------------------------- OPM I/O functions ---------------------------------------------------------------------------------------- Peter Brown Douglas Shepherd 12/11/2021 [email protected] ------------------------------------...
5,574
27.88601
125
py
OPM
OPM-master/napari-control/src/utils/flat_field.py
#!/usr/bin/env python ''' Python and cupy implementation of BaSiC flat-field correction (doi: 10.1038/ncomms14836) Adapted from code found at: https://github.com/peng-lab/PyBasicCellprofilerPlugin TO DO: Tons of otpimization opportunities with cupy, numba, and cucim. Maybe need to write our own DCT operator for use o...
14,832
34.570743
155
py
OPM
OPM-master/napari-control/src/utils/fluidics_control.py
#!/usr/bin/python ''' ---------------------------------------------------------------------------------------- OPM fluidics controller functions ---------------------------------------------------------------------------------------- Douglas Shepherd 12/11/2021 [email protected] --------------------------------...
5,342
39.78626
143
py
OPM
OPM-master/control/run_opm_iterative_stagescan_GUI.py
#!/usr/bin/env python ''' OPM stage control with iterative fluidics. Shepherd 08/21 - refactor for easier reading, O2-O3 autofocus, and managing file transfer in seperate Python process Shepherd 07/21 - switch to interleaved excitation during stage scan and initial work on O2-O3 autofocusing Shepherd 06/21 - clean up...
37,175
49.648501
196
py
OPM
OPM-master/reconstruction/recon_opm_stagescan.py
#!/usr/bin/env python ''' Stage scanning OPM post-processing using numpy, numba, skimage, pyimagej, and npy2bdv. Places all tiles in actual stage positions and places iterative rounds into the time axis of BDV H5 for alignment Orthgonal interpolation method adapted from Vincent Maioli (http://doi.org/10.25560/68022) ...
14,548
47.016502
167
py
OPM
OPM-master/reconstruction/run_opm_stagescan.py
#!/usr/bin/env python ''' OPM stage control without fluidics. Shepherd 04/21 - large-scale changes for new metadata and on-the-fly uploading to server for simultaneous reconstruction ''' # imports from pycromanager import Bridge, Acquisition from pathlib import Path import numpy as np import time import sys import m...
26,737
44.318644
177
py
OPM
OPM-master/reconstruction/run_opm_galvoscan.py
#!/usr/bin/env python ''' OPM galvo scan using Pycromanager. D. Shepherd 09/21 - bring metadata in line with new reconstruction code. Attempt timelapse with pause using event structure. D. Shepherd 04/21 - streamline code for fast acquisition and immediate upload to server P. Brown 03/21 - multiline digital and analo...
15,693
42.715877
144
py
OPM
OPM-master/reconstruction/image_post_processing.py
''' QI2lab OPM suite Reconstruction tools Image processing tools for OPM reconstruction Last updated: Shepherd 01/22 - changes to include dexp deconvolution and recent other changes. ''' #!/usr/bin/env python import sys import numpy as np from pathlib import Path from tifffile import tifffile from numba import njit,...
10,957
32.716923
190
py
OPM
OPM-master/reconstruction/data_io.py
#!/usr/bin/env python ''' QI2lab OPM suite Reconstruction tools Read and write metadata; read raw data; read pre-generated OPM psfs ''' import re from npy2bdv.npy2bdv import BdvEditor import pandas as pd import numpy as np from pathlib import Path from tifffile import tifffile def read_metadata(fname): """ R...
5,989
27.388626
125
py
OPM
OPM-master/reconstruction/flat_field.py
#!/usr/bin/env python ''' Python and cupy implementation of BaSiC flat-field correction (doi: 10.1038/ncomms14836) Adapted from code found at: https://github.com/peng-lab/PyBasicCellprofilerPlugin TO DO: Tons of otpimization opportunities with cupy, numba, and cucim. Maybe need to write our own DCT operator for use o...
14,796
34.569712
155
py
OPM
OPM-master/reconstruction/recon_opm_galvoscan.py
#!/usr/bin/env python ''' Galvo scanning OPM post-processing using numpy, numba, skimage, pyimagej, and npy2bdv. Orthgonal interpolation method adapted from original description by Vincent Maioli (http://doi.org/10.25560/68022) Last updated: Shepherd 06/21 ''' # imports import numpy as np from pathlib import Path fr...
13,051
44.006897
151
py
OPM
OPM-master/reconstruction/localize_gui.py
""" Localize skewed data with GUI for setting different parameters """ import os import time import numpy as np import localize import localize_skewed import image_post_processing as ipp import pycromanager import napari from napari.qt.threading import thread_worker from magicgui import magicgui root_dir = r"C:\Users\...
17,910
42.055288
142
py
OPM
OPM-master/reconstruction/localize_skewed.py
""" Code for localization in native OPM frame This file stores tools specific to the OPM skewed geometry. Most localization functions are found in localize.py """ import os import numpy as np import matplotlib.pyplot as plt from matplotlib.path import Path import warnings import time import joblib import fit_psf impo...
51,449
38.668466
152
py
OPM
OPM-master/pycromanager-control/run_opm_stagescan.py
#!/usr/bin/env python ''' OPM stage control without fluidics. Shepherd 04/21 - large-scale changes for new metadata and on-the-fly uploading to server for simultaneous reconstruction ''' # imports from pycromanager import Bridge, Acquisition from pathlib import Path import numpy as np import time import sys import m...
26,737
44.318644
177
py
OPM
OPM-master/pycromanager-control/run_opm_galvoscan.py
#!/usr/bin/env python ''' OPM galvo scan using Pycromanager. D. Shepherd 09/21 - bring metadata in line with new reconstruction code. Attempt timelapse with pause using event structure. D. Shepherd 04/21 - streamline code for fast acquisition and immediate upload to server P. Brown 03/21 - multiline digital and analo...
15,693
42.715877
144
py
OPM
OPM-master/pycromanager-control/data_io.py
#!/usr/bin/env python import re from npy2bdv import BdvEditor import pandas as pd import numpy as np def read_metadata(fname): """ Read data from csv file consisting of one line giving titles, and the other giving values. Return as dictionary :param fname: :return metadata: """ scan_data_raw_...
4,729
29.915033
125
py
Max-value-Entropy-Search
Max-value-Entropy-Search-master/test_functions/python_related/generate_simudata3.py
#!/usr/bin/env python # Copyright (c) 2017 Zi Wang from push_world import * import sys if __name__ == '__main__': rx = float(sys.argv[1]) ry = float(sys.argv[2]) gx = float(sys.argv[4]) gy = float(sys.argv[5]) simu_steps = int(float(sys.argv[3]) * 10) # set it to False if no gui needed ...
839
35.521739
128
py
Max-value-Entropy-Search
Max-value-Entropy-Search-master/test_functions/python_related/generate_simudata4.py
#!/usr/bin/env python # Copyright (c) 2017 Zi Wang from push_world import * import sys # difference to generate_simudata is an input that control angle of push if __name__ == '__main__': rx = float(sys.argv[1]) ry = float(sys.argv[2]) gx = float(sys.argv[4]) gy = float(sys.argv[5]) init_angle = flo...
1,054
39.576923
128
py
Max-value-Entropy-Search
Max-value-Entropy-Search-master/test_functions/python_related/generate_simudata_2robot2thing.py
#!/usr/bin/env python # Copyright (c) 2017 Zi Wang from push_world import * import sys # difference to generate_simudata is an input that control angle of push if __name__ == '__main__': rx = float(sys.argv[1]) ry = float(sys.argv[2]) xvel = float(sys.argv[3]) yvel = float(sys.argv[4]) simu_steps =...
1,823
42.428571
148
py
Max-value-Entropy-Search
Max-value-Entropy-Search-master/test_functions/python_related/push_world.py
#!/usr/bin/env python # Author: Ari Anders and Zi Wang from Box2D import * from Box2D.b2 import * import numpy as np import pygame import scipy.io from numpy import linalg as LA # this just makes pygame show what's going on class guiWorld: def __init__(self, fps): self.SCREEN_WIDTH, self.SCREEN_HEIGHT ...
10,238
36.097826
146
py
CIF-HieraDist
CIF-HieraDist-main/setup.py
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import os import subprocess import sys from setuptools import setup, find_packages, Extension from setuptools import E...
8,435
28.291667
92
py
CIF-HieraDist
CIF-HieraDist-main/hubconf.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """isort:skip_file""" import functools import importlib dependencies = [ "dataclasses", "hydra", "numpy", "omegaconf", "...
2,099
27.378378
82
py
CIF-HieraDist
CIF-HieraDist-main/train.py
#!/usr/bin/env python3 -u # Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """ Legacy entry point. Use fairseq_cli/train.py or fairseq-train instead. """ from fairseq_cli.train import cli_mai...
366
23.466667
70
py
CIF-HieraDist
CIF-HieraDist-main/examples/__init__.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from fairseq.version import __version__ # noqa
226
31.428571
65
py
CIF-HieraDist
CIF-HieraDist-main/examples/speech_to_text/prep_covost_data.py
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import argparse import logging from pathlib import Path import shutil from tempfile import NamedTemporaryFile from typi...
8,898
30.782143
86
py
CIF-HieraDist
CIF-HieraDist-main/examples/speech_to_text/prep_mtedx_data.py
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import argparse import logging import os from pathlib import Path import shutil from itertools import groupby from temp...
10,404
34.03367
87
py
CIF-HieraDist
CIF-HieraDist-main/examples/speech_to_text/prep_aishell2_data.py
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import os import argparse import logging from pathlib import Path import shutil from tempfile import NamedTemporaryFile...
9,428
31.513793
95
py
CIF-HieraDist
CIF-HieraDist-main/examples/speech_to_text/prep_librispeech_data.py
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import argparse import logging from pathlib import Path import shutil from tempfile import NamedTemporaryFile import p...
3,811
29.253968
87
py
CIF-HieraDist
CIF-HieraDist-main/examples/speech_to_text/data_utils.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import csv from pathlib import Path import zipfile from functools import reduce from multiprocessing import cpu_count from typing import Any, ...
12,224
30.670984
88
py
CIF-HieraDist
CIF-HieraDist-main/examples/speech_to_text/prep_mustc_data.py
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import argparse import logging import os from pathlib import Path import shutil from itertools import groupby from temp...
11,015
36.726027
87
py
CIF-HieraDist
CIF-HieraDist-main/examples/speech_to_text/prep_aishell1_data.py
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import os import argparse import logging from pathlib import Path import shutil from tempfile import NamedTemporaryFile...
11,501
31.038997
98
py
CIF-HieraDist
CIF-HieraDist-main/examples/speech_to_text/prep_ljspeech_data.py
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import argparse import logging from pathlib import Path import shutil from tempfile import NamedTemporaryFile import p...
3,352
26.483607
77
py
CIF-HieraDist
CIF-HieraDist-main/examples/speech_to_text/seg_mustc_data.py
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import argparse import logging from pathlib import Path import soundfile as sf from examples.speech_to_text.prep_mustc_...
1,622
30.823529
81
py
CIF-HieraDist
CIF-HieraDist-main/examples/speech_to_text/gen_librispeech_vocab.py
# @Time : 2022/3/2 # @Author : Minglun Han # @File : gen_vocab.py import argparse import logging from pathlib import Path import shutil from tempfile import NamedTemporaryFile import pandas as pd from examples.speech_to_text.data_utils import ( create_zip, extract_fbank_features, gen_config_yaml, ...
1,514
24.25
88
py
CIF-HieraDist
CIF-HieraDist-main/examples/speech_to_text/gen_vocab.py
# @Time : 2022/3/2 # @Author : Minglun Han # @File : gen_vocab.py import argparse import logging from pathlib import Path import shutil from tempfile import NamedTemporaryFile import pandas as pd from examples.speech_to_text.data_utils import ( create_zip, extract_fbank_features, gen_config_yaml, ...
1,515
24.266667
63
py
CIF-HieraDist
CIF-HieraDist-main/examples/speech_to_text/bert_feat_extract/extract_bert_feats.py
# @Time : 2022/8/15 # @Author : Minglun Han # @File : extract_bert_feats.py import os import sys import argparse import random import string import json import numpy as np import torch from transformers import BertTokenizer, BertModel """ Description: This program is used to extract the features from pret...
6,843
32.54902
129
py
CIF-HieraDist
CIF-HieraDist-main/examples/speech_to_text/simultaneous_translation/agents/fairseq_simul_st_agent.py
import math import os import json import numpy as np import torch import torchaudio.compliance.kaldi as kaldi import yaml from fairseq import checkpoint_utils, tasks from fairseq.file_io import PathManager try: from simuleval import READ_ACTION, WRITE_ACTION, DEFAULT_EOS from simuleval.agents import SpeechAgen...
12,271
32.347826
105
py
CIF-HieraDist
CIF-HieraDist-main/examples/speech_recognition/ctc_decoder.py
# @Time : 2021/7/26 # @Author : Minglun Han # @File : ctc_decoder.py import os import sys import torch import random import logging import torch.nn.functional as F import numpy as np import itertools as it # Control print options torch.set_printoptions(profile="full") torch.set_printoptions(profile="default") ...
5,750
35.169811
88
py
CIF-HieraDist
CIF-HieraDist-main/examples/speech_recognition/__init__.py
from . import criterions, models, tasks # noqa
48
23.5
47
py
CIF-HieraDist
CIF-HieraDist-main/examples/speech_recognition/infer.py
#!/usr/bin/env python3 -u # Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """ Run inference for pre-processed data with a trained model. """ import ast import logging import math import os ...
18,560
32.203936
115
py
CIF-HieraDist
CIF-HieraDist-main/examples/speech_recognition/w2l_decoder.py
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """ Flashlight decoders. """ import gc import itertools as it import os.path as osp from typing import List import wa...
17,561
34.336016
171
py
CIF-HieraDist
CIF-HieraDist-main/examples/speech_recognition/cif_decoder.py
# @Time : 2021/7/14 # @Author : Minglun Han # @File : cif_decoder.py """"" Update: By 2022/06/19 1. support LM decoding with language model by shallow fusion; """ "" import os import sys import torch import logging import numpy as np import itertools as it from torch import Tensor import torch....
40,532
43.057609
116
py
CIF-HieraDist
CIF-HieraDist-main/examples/speech_recognition/criterions/cross_entropy_acc.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from __future__ import absolute_import, division, print_function, unicode_literals import logging import math import torch import torch.nn.f...
5,372
40.015267
85
py
CIF-HieraDist
CIF-HieraDist-main/examples/speech_recognition/criterions/ASG_loss.py
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import torch from examples.speech_recognition.data.replabels import pack_replabels from fairseq import utils from fair...
5,870
33.333333
85
py
CIF-HieraDist
CIF-HieraDist-main/examples/speech_recognition/criterions/__init__.py
import importlib import os # ASG loss requires flashlight bindings files_to_skip = set() try: import flashlight.lib.sequence.criterion except ImportError: files_to_skip.add("ASG_loss.py") for file in sorted(os.listdir(os.path.dirname(__file__))): if file.endswith(".py") and not file.startswith("_") and f...
510
27.388889
87
py
CIF-HieraDist
CIF-HieraDist-main/examples/speech_recognition/models/vggtransformer.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import argparse import math from collections.abc import Iterable import torch import torch.nn as nn from examples.speech_recognition.data.dat...
37,258
35.564279
88
py
CIF-HieraDist
CIF-HieraDist-main/examples/speech_recognition/models/w2l_conv_glu_enc.py
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import math import torch import torch.nn as nn import torch.nn.functional as F from fairseq.models import ( Fairs...
6,077
33.338983
87
py
CIF-HieraDist
CIF-HieraDist-main/examples/speech_recognition/models/__init__.py
import importlib import os for file in sorted(os.listdir(os.path.dirname(__file__))): if file.endswith(".py") and not file.startswith("_"): model_name = file[: file.find(".py")] importlib.import_module("examples.speech_recognition.models." + model_name)
276
29.777778
83
py
CIF-HieraDist
CIF-HieraDist-main/examples/speech_recognition/datasets/asr_prep_json.py
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from __future__ import absolute_import, division, print_function, unicode_literals import argparse import concurrent.f...
3,775
28.968254
84
py
CIF-HieraDist
CIF-HieraDist-main/examples/speech_recognition/new/__init__.py
0
0
0
py
CIF-HieraDist
CIF-HieraDist-main/examples/speech_recognition/new/infer.py
#!/usr/bin/env python -u # Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import ast import hashlib import logging import os import shutil import sys from dataclasses import dataclass, field,...
16,498
33.955508
103
py
CIF-HieraDist
CIF-HieraDist-main/examples/speech_recognition/new/decoders/decoder_config.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import math from dataclasses import dataclass, field from typing import Optional from fairseq.dataclass.configs import FairseqDataclass from ...
2,004
27.239437
69
py
CIF-HieraDist
CIF-HieraDist-main/examples/speech_recognition/new/decoders/decoder.py
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from typing import Union from fairseq.data.dictionary import Dictionary from .decoder_config import DecoderConfig, F...
943
28.5
76
py