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 |
|---|---|---|---|---|---|---|
OpenFWI | OpenFWI-main/test.py | # © 2022. Triad National Security, LLC. All rights reserved.
# This program was produced under U.S. Government contract 89233218CNA000001 for Los Alamos
# National Laboratory (LANL), which is operated by Triad National Security, LLC for the U.S.
# Department of Energy/National Nuclear Security Administration. All ri... | 10,383 | 42.814346 | 156 | py |
OpenFWI | OpenFWI-main/gan_train.py | # © 2022. Triad National Security, LLC. All rights reserved.
# This program was produced under U.S. Government contract 89233218CNA000001 for Los Alamos
# National Laboratory (LANL), which is operated by Triad National Security, LLC for the U.S.
# Department of Energy/National Nuclear Security Administration. All ri... | 16,662 | 43.553476 | 128 | py |
OpenFWI | OpenFWI-main/network.py | # © 2022. Triad National Security, LLC. All rights reserved.
# This program was produced under U.S. Government contract 89233218CNA000001 for Los Alamos
# National Laboratory (LANL), which is operated by Triad National Security, LLC for the U.S.
# Department of Energy/National Nuclear Security Administration. All ri... | 14,861 | 45.15528 | 167 | py |
OpenFWI | OpenFWI-main/vis.py | import os
import torch
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import numpy as np
from matplotlib.colors import ListedColormap
# Load colormap for velocity map visualization
rainbow_cmap = ListedColormap(np.load('rainbow256.npy'))
def plot_velocity(output, target, path, vmin=None, vmax... | 4,324 | 38.318182 | 89 | py |
OpenFWI | OpenFWI-main/utils.py | # © 2022. Triad National Security, LLC. All rights reserved.
# This program was produced under U.S. Government contract 89233218CNA000001 for Los Alamos
# National Laboratory (LANL), which is operated by Triad National Security, LLC for the U.S.
# Department of Energy/National Nuclear Security Administration. All ri... | 17,006 | 34.804211 | 105 | py |
OpenFWI | OpenFWI-main/dataset.py | # © 2022. Triad National Security, LLC. All rights reserved.
# This program was produced under U.S. Government contract 89233218CNA000001 for Los Alamos
# National Laboratory (LANL), which is operated by Triad National Security, LLC for the U.S.
# Department of Energy/National Nuclear Security Administration. All ri... | 3,920 | 37.441176 | 129 | py |
OpenFWI | OpenFWI-main/scheduler.py | # © 2022. Triad National Security, LLC. All rights reserved.
# This program was produced under U.S. Government contract 89233218CNA000001 for Los Alamos
# National Laboratory (LANL), which is operated by Triad National Security, LLC for the U.S.
# Department of Energy/National Nuclear Security Administration. All ri... | 2,380 | 35.075758 | 105 | py |
OpenFWI | OpenFWI-main/train.py | # © 2022. Triad National Security, LLC. All rights reserved.
# This program was produced under U.S. Government contract 89233218CNA000001 for Los Alamos
# National Laboratory (LANL), which is operated by Triad National Security, LLC for the U.S.
# Department of Energy/National Nuclear Security Administration. All ri... | 14,469 | 41.558824 | 122 | py |
OpenFWI | OpenFWI-main/transforms.py | # © 2022. Triad National Security, LLC. All rights reserved.
# This program was produced under U.S. Government contract 89233218CNA000001 for Los Alamos
# National Laboratory (LANL), which is operated by Triad National Security, LLC for the U.S.
# Department of Energy/National Nuclear Security Administration. All ri... | 8,236 | 29.394834 | 105 | py |
active_grasp-devel | active_grasp-devel/setup.py | # ! DO NOT MANUALLY INVOKE THIS setup.py, USE CATKIN INSTEAD!
from distutils.core import setup
from catkin_pkg.python_setup import generate_distutils_setup
# Fetch values from package.xml.
setup_args = generate_distutils_setup(
packages=["active_grasp"],
package_dir={"": "src"},
)
setup(**setup_args)
| 314 | 21.5 | 61 | py |
active_grasp-devel | active_grasp-devel/src/active_grasp/baselines.py | import numpy as np
from .policy import SingleViewPolicy, MultiViewPolicy, compute_error
class InitialView(SingleViewPolicy):
def update(self, img, x, q):
self.x_d = x
super().update(img, x, q)
class TopView(SingleViewPolicy):
def activate(self, bbox, view_sphere):
super().activate(b... | 1,058 | 26.868421 | 75 | py |
active_grasp-devel | active_grasp-devel/src/active_grasp/timer.py | import time
class Timer:
timers = dict()
def __init__(self, name):
self.name = name
self.timers.setdefault(name, 0)
def __enter__(self):
self.start()
return self
def __exit__(self, *exc_info):
self.stop()
@classmethod
def reset(cls):
cls.time... | 609 | 19.333333 | 53 | py |
active_grasp-devel | active_grasp-devel/src/active_grasp/policy.py | import numpy as np
from sensor_msgs.msg import CameraInfo
from pathlib import Path
import rospy
from trac_ik_python.trac_ik import IK
from robot_helpers.ros import tf
from robot_helpers.ros.conversions import *
from vgn.detection import *
from vgn.perception import UniformTSDFVolume
from .timer import Timer
from .rvi... | 6,580 | 31.579208 | 88 | py |
active_grasp-devel | active_grasp-devel/src/active_grasp/bbox.py | import itertools
import numpy as np
import active_grasp.msg
from robot_helpers.ros.conversions import to_point_msg, from_point_msg
class AABBox:
def __init__(self, bbox_min, bbox_max):
self.min = np.asarray(bbox_min)
self.max = np.asarray(bbox_max)
self.center = 0.5 * (self.min + self.max... | 857 | 24.235294 | 74 | py |
active_grasp-devel | active_grasp-devel/src/active_grasp/rviz.py | import numpy as np
from robot_helpers.ros.rviz import *
from robot_helpers.spatial import Transform
import vgn.rviz
from vgn.utils import *
cm = lambda s: tuple([float(1 - s), float(s), float(0)])
red = [1.0, 0.0, 0.0]
blue = [0, 0.6, 1.0]
grey = [0.9, 0.9, 0.9]
class Visualizer(vgn.rviz.Visualizer):
def clear... | 4,228 | 26.822368 | 88 | py |
active_grasp-devel | active_grasp-devel/src/active_grasp/simulation.py | from pathlib import Path
import pybullet as p
import pybullet_data
import rospkg
from active_grasp.bbox import AABBox
from robot_helpers.bullet import *
from robot_helpers.io import load_yaml
from robot_helpers.model import KDLModel
from robot_helpers.spatial import Rotation
from vgn.perception import UniformTSDFVolum... | 8,353 | 35.008621 | 88 | py |
active_grasp-devel | active_grasp-devel/src/active_grasp/controller.py | from controller_manager_msgs.srv import *
import copy
import cv_bridge
from geometry_msgs.msg import Twist
import numpy as np
import rospy
from sensor_msgs.msg import Image
import trimesh
from .bbox import from_bbox_msg
from .timer import Timer
from active_grasp.srv import Reset, ResetRequest
from robot_helpers.ros im... | 9,186 | 38.770563 | 88 | py |
active_grasp-devel | active_grasp-devel/src/active_grasp/__init__.py | from .policy import register
from .baselines import *
from .nbv import NextBestView
register("initial-view", InitialView)
register("top-view", TopView)
register("top-trajectory", TopTrajectory)
register("fixed-trajectory", FixedTrajectory)
register("nbv", NextBestView)
| 271 | 26.2 | 45 | py |
active_grasp-devel | active_grasp-devel/src/active_grasp/nbv.py | import itertools
from numba import jit
import numpy as np
import rospy
from .policy import MultiViewPolicy
from .timer import Timer
@jit(nopython=True)
def get_voxel_at(voxel_size, p):
index = (p / voxel_size).astype(np.int64)
return index if (index >= 0).all() and (index < 40).all() else None
# Note that ... | 5,897 | 30.881081 | 86 | py |
active_grasp-devel | active_grasp-devel/test/test_sim_scene.py | from active_grasp.simulation import Simulation
def main():
gui = True
scene_id = "random"
vgn_path = "../vgn/assets/models/vgn_conv.pth"
sim = Simulation(gui, scene_id, vgn_path)
while True:
sim.reset()
if __name__ == "__main__":
main()
| 273 | 17.266667 | 50 | py |
active_grasp-devel | active_grasp-devel/test/test_clustering.py | import matplotlib.pyplot as plt
import numpy as np
import open3d as o3d
def main():
cloud_file = "1636465097.pcd"
# eps, min_points = 0.02, 10
eps, min_points = 0.01, 8
cloud = o3d.io.read_point_cloud(cloud_file)
labels = np.array(cloud.cluster_dbscan(eps=eps, min_points=min_points))
max_la... | 650 | 25.04 | 80 | py |
active_grasp-devel | active_grasp-devel/scripts/calibrate_roi.py | #!/usr/bin/env python3
import numpy as np
import rospy
from robot_helpers.ros import tf
def main():
rospy.init_node("calibrate_roi")
tf.init()
T_base_roi = tf.lookup("panda_link0", "tag_0")
np.savetxt("cfg/hw/T_base_tag.txt", T_base_roi.as_matrix())
if __name__ == "__main__":
main()
| 310 | 16.277778 | 63 | py |
active_grasp-devel | active_grasp-devel/scripts/hw_node.py | #!/usr/bin/env python3
from controller_manager_msgs.srv import *
import geometry_msgs.msg
import numpy as np
import rospy
from active_grasp.bbox import AABBox, to_bbox_msg
from active_grasp.rviz import Visualizer
from active_grasp.srv import *
from robot_helpers.io import load_yaml
from robot_helpers.ros.conversions ... | 3,038 | 30.989474 | 87 | py |
active_grasp-devel | active_grasp-devel/scripts/run.py | #!/usr/bin/env python3
import argparse
from datetime import datetime
import pandas as pd
from pathlib import Path
import rospy
from tqdm import tqdm
from active_grasp.controller import *
from active_grasp.policy import make, registry
from active_grasp.srv import Seed
from robot_helpers.ros import tf
def main():
... | 2,090 | 26.513158 | 82 | py |
active_grasp-devel | active_grasp-devel/scripts/bt_sim_node.py | #!/usr/bin/env python3
from actionlib import SimpleActionServer
import control_msgs.msg as control_msgs
from controller_manager_msgs.srv import *
import cv_bridge
from franka_msgs.msg import FrankaState, ErrorRecoveryAction
from franka_gripper.msg import *
from geometry_msgs.msg import Twist
import numpy as np
import ... | 11,903 | 30.326316 | 84 | py |
hurricast | hurricast-master/utils/data_processing.py | from __future__ import print_function
import pandas as pd
import math
import torch
import numpy as np
import warnings
warnings.filterwarnings('ignore')
dtype = torch.float
device = torch.device("cpu")
#allows to keep only specific columns
def select_data(data):
return data[['SID', 'NUMBER', 'ISO_TIME', 'LAT',... | 12,412 | 30.585242 | 190 | py |
hurricast | hurricast-master/utils/__init__.py | from . import data_processing
from . import utils_vision_data
| 62 | 20 | 31 | py |
hurricast | hurricast-master/utils/utils_vision_data.py | import cdsapi
import numpy as np
import netCDF4
import matplotlib.pyplot as plt
from datetime import datetime
from utils.data_processing import *
import os
import warnings; warnings.simplefilter('ignore')
#All the following functions are used for processing vision data from ERA5
def process_netcdf(filepath, param)... | 5,841 | 37.183007 | 176 | py |
hurricast | hurricast-master/sophie_code/ModuleReanalysisData.py | from ftplib import FTP
from netCDF4 import Dataset
from netCDF4 import num2date, date2num
from datetime import datetime, timedelta
import numpy as np
import matplotlib.pyplot as plt
import math
import csv
import calendar
from ecmwfapi import ECMWFDataServer
#from Sophie_modules import ModuleStormReader as Msr
#from So... | 26,288 | 39.074695 | 149 | py |
hurricast | hurricast-master/sophie_code/ModuleStormReader.py | ## Module to read and process data from
## https://ghrc.nsstc.nasa.gov/services/storms website
import requests
from xml.etree import ElementTree
import re
import pickle
from http.client import RemoteDisconnected
import csv
import os
import pandas as pd
import numpy as np
from netCDF4 import num2date, date2num
from date... | 23,847 | 38.353135 | 152 | py |
news-tls | news-tls-master/setup.py | from setuptools import setup
setup(
name='news_tls',
packages=['news_tls'],
)
| 88 | 10.125 | 28 | py |
news-tls | news-tls-master/experiments/evaluate.py | import argparse
from pathlib import Path
from tilse.data.timelines import Timeline as TilseTimeline
from tilse.data.timelines import GroundTruth as TilseGroundTruth
from tilse.evaluation import rouge
from news_tls import utils, data, datewise, clust, summarizers
from pprint import pprint
def get_scores(metric_desc, p... | 6,868 | 33.00495 | 92 | py |
news-tls | news-tls-master/experiments/run_without_eval.py | import argparse
from pathlib import Path
from news_tls import utils, data, datewise, clust, summarizers
from pprint import pprint
def run(tls_model, dataset, outpath):
n_topics = len(dataset.collections)
outputs = []
for i, collection in enumerate(dataset.collections):
topic = collection.name
... | 2,798 | 30.1 | 72 | py |
news-tls | news-tls-master/preprocessing/preprocess_heideltime.py | import os
import argparse
import arrow
import pathlib
import subprocess
import collections
import shutil
from news_tls import utils
def write_input_articles(articles, out_dir):
utils.force_mkdir(out_dir)
date_to_articles = collections.defaultdict(list)
for a in articles:
date = arrow.get(a['time']... | 2,542 | 30.012195 | 91 | py |
news-tls | news-tls-master/preprocessing/preprocess_tokenize.py | import os
import argparse
import pathlib
import spacy
from news_tls import utils
def tokenize_dataset(root, spacy_model):
nlp = spacy.load(spacy_model)
for topic in sorted(os.listdir(root)):
print('TOPIC:', topic)
if os.path.exists(root / topic / 'articles.jsonl.gz'):
articles = l... | 1,818 | 31.482143 | 84 | py |
news-tls | news-tls-master/preprocessing/preprocess_spacy.py | import os
import pathlib
import argparse
import arrow
import spacy
import datetime
import collections
import codecs
from xml.etree import ElementTree
from news_tls import utils
from news_tls.data import Token, Sentence, Article
from pprint import pprint
def extract_time_tag_value(time_tag):
value = [(None, None)]... | 6,135 | 27.539535 | 77 | py |
news-tls | news-tls-master/news_tls/datewise.py | import random
import datetime
import collections
import numpy as np
from scipy import sparse
from sklearn.preprocessing import normalize
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.metrics.pairwise import cosine_similarity
from news_tls import data, utils, summarizers
random.seed(42)
cl... | 14,342 | 36.351563 | 91 | py |
news-tls | news-tls-master/news_tls/explore_dataset.py | import os
import argparse
import collections
from news_tls import utils
from news_tls.data import (Dataset,
truncate_timelines,
get_input_time_span,
get_average_summary_length)
from tilse.data.timelines import Timeline as TilseTimeline
fro... | 2,056 | 33.283333 | 79 | py |
news-tls | news-tls-master/news_tls/utils.py | import pickle
import json
import numpy as np
import gzip
import io
import datetime
import codecs
import tarfile
import pandas
import shutil
import os
import collections
import matplotlib.pyplot as plt
from sklearn.preprocessing import StandardScaler, MinMaxScaler, RobustScaler
def force_mkdir(path):
if os.path.ex... | 4,944 | 22.660287 | 77 | py |
news-tls | news-tls-master/news_tls/data.py | import os
import pathlib
import arrow
import datetime
import string
from spacy.lang.en.stop_words import STOP_WORDS
from collections import defaultdict
from tilse.data.timelines import Timeline as TilseTimeline
from news_tls import utils
from pprint import pprint
PUNCT_SET = set(string.punctuation)
def load_dataset(... | 12,124 | 27.462441 | 84 | py |
news-tls | news-tls-master/news_tls/clust.py | import numpy as np
import datetime
import itertools
import random
import collections
import markov_clustering as mc
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.metrics.pairwise import cosine_similarity
from scipy import sparse
from typing import List
from news_tls import utils, data
class... | 11,459 | 31.464589 | 81 | py |
news-tls | news-tls-master/news_tls/summarizers.py | import networkx as nx
from scipy import sparse
from sklearn.metrics.pairwise import cosine_similarity
from sklearn.preprocessing import normalize
from sklearn.cluster import MiniBatchKMeans
class Summarizer:
def summarize(self, sents, k, vectorizer, filters=None):
raise NotImplementedError
class TextRa... | 9,357 | 32.184397 | 81 | py |
client | client-master/setup.py | from setuptools import setup
from setuptools import find_packages
setup(
name='bugswarm-client',
version='0.1.8',
url='https://github.com/BugSwarm/client',
author='BugSwarm',
author_email='[email protected]',
description='The official command line client for the BugSwarm artifact dataset'... | 879 | 24.882353 | 90 | py |
client | client-master/bugswarm/__init__.py | __import__('pkg_resources').declare_namespace(__name__)
| 56 | 27.5 | 55 | py |
client | client-master/bugswarm/client/bugswarm.py | import json
import logging
import os
import click
from bugswarm.common import log
from bugswarm.common.rest_api.database_api import DatabaseAPI
from . import docker
from .command import MyCommand
@click.group()
@click.version_option(message='The BugSwarm Client, version %(version)s')
def cli():
"""A command li... | 2,524 | 39.079365 | 120 | py |
client | client-master/bugswarm/client/docker.py | import os
import subprocess
import sys
from bugswarm.common import log
from bugswarm.common.shell_wrapper import ShellWrapper
import bugswarm.common.credentials as credentials
SCRIPT_DEFAULT = '/bin/bash'
HOST_SANDBOX_DEFAULT = '~/bugswarm-sandbox'
CONTAINER_SANDBOX_DEFAULT = '/bugswarm-sandbox'
if hasattr(credentia... | 6,471 | 43.634483 | 118 | py |
client | client-master/bugswarm/client/command.py | from bugswarm.common import outdated
from click import Command
class MyCommand(Command):
"""
A subclass of Click's Command class that checks if the client is outdated after invoking the command.
"""
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
def invoke(self, ct... | 541 | 29.111111 | 105 | py |
client | client-master/bugswarm/client/__init__.py | 0 | 0 | 0 | py | |
DialogID | DialogID-main/atc_adt_train.py | import sys
sys.path.append('src/auto_text_classifier')
import os
from atc.models.aml import AML
# 3、选择数据
train_path = "data/train.csv"
dev_path = "data/dev.csv"
test_path = "data/test.csv"
# 4、训练模型
config = dict()
config['num_labels'] = 9
config['epochs'] = 100
config['batch_size'] = 64
config['max_len'] = 128
conf... | 788 | 25.3 | 84 | py |
DialogID | DialogID-main/atc_train.py | import sys
sys.path.append('src/auto_text_classifier')
import os
from atc.models.aml import AML
train_path = "data/train.csv"
dev_path = "data/dev.csv"
test_path = "data/test.csv"
config = dict()
config['num_labels'] = 9
config['epochs'] = 100
config['batch_size'] = 64
config['max_len'] = 128
model_list = ['electr... | 658 | 24.346154 | 117 | py |
DialogID | DialogID-main/src/auto_text_classifier/atc/__init__.py | from __future__ import absolute_import
__version__ = '0.0.1' | 66 | 7.375 | 38 | py |
DialogID | DialogID-main/src/auto_text_classifier/atc/models/hf_base.py |
import torch
import torch.nn.functional as F
import torch.nn as nn
import os
import copy
import numpy as np
import pandas as pd
import random
import datetime
from tqdm import tqdm, trange
from transformers import BertConfig
from torch.utils.data import TensorDataset, DataLoader, RandomSampler, SequentialSampler
from t... | 25,472 | 38.493023 | 131 | py |
DialogID | DialogID-main/src/auto_text_classifier/atc/models/base_model.py | import numpy as np
from atc.utils.data_utils import init_dir, load_df, DataGet
from atc.utils.metrics_utils import get_model_metrics, get_multi_class_report,refit_map
import torch
import random
import os
import pandas as pd
import traceback
from tqdm import tqdm
import time
class BaseModel():
def __init__(self, ... | 6,316 | 32.247368 | 87 | py |
DialogID | DialogID-main/src/auto_text_classifier/atc/models/__init__.py | from atc.models.bert.bert import BERT
from atc.models.electra.electra import ELECTRA
from atc.models.roberta.roberta import ROBERTA
from atc.models.xlnet.xlnet import XLNet
from atc.models.macbert.macbert import MacBERT
| 220 | 35.833333 | 46 | py |
DialogID | DialogID-main/src/auto_text_classifier/atc/models/aml.py | import os
import copy
import time
import pandas as pd
import numpy as np
from tqdm import tqdm
from keras.layers import Lambda, Dense
from atc.utils.data_utils import init_dir
from atc.models.base_model import BaseModel
from atc.utils.metrics_utils import get_model_metrics,get_multi_class_report
from atc.utils.data_uti... | 7,288 | 38.61413 | 98 | py |
DialogID | DialogID-main/src/auto_text_classifier/atc/models/xlnet/xlnet.py | from atc.models.hf_base import HFBase
from transformers import BertForSequenceClassification, BertModel, BertTokenizer,AutoTokenizer,AutoModelForSequenceClassification
from transformers import AdamW
class XLNet(HFBase):
def __init__(self,config):
super().__init__(config)
self.model_name = 'xlnet'
... | 439 | 35.666667 | 129 | py |
DialogID | DialogID-main/src/auto_text_classifier/atc/models/macbert/macbert.py | from atc.models.hf_base import HFBase
from transformers import BertForSequenceClassification, BertModel, BertTokenizer,AutoTokenizer,AutoModelForSequenceClassification
from transformers import AdamW
from transformers import BertConfig
class MacBERT(HFBase):
def __init__(self,config):
super().__init__(confi... | 716 | 36.736842 | 129 | py |
DialogID | DialogID-main/src/auto_text_classifier/atc/models/automodel/automodel.py | from atc.models.hf_base import HFBase
from transformers import BertForSequenceClassification, BertModel, BertTokenizer,AutoTokenizer,AutoModelForSequenceClassification
from transformers import AdamW
from transformers import BertConfig
class AutoModel(HFBase):
def __init__(self,config):
super().__init__(con... | 974 | 38 | 129 | py |
DialogID | DialogID-main/src/auto_text_classifier/atc/models/electra/electra.py | from atc.models.hf_base import HFBase
from transformers import BertForSequenceClassification, BertModel, BertTokenizer,AutoTokenizer,AutoModelForSequenceClassification
from transformers import AdamW
class ELECTRA(HFBase):
def __init__(self,config):
super().__init__(config)
self.model_name = 'electr... | 443 | 36 | 129 | py |
DialogID | DialogID-main/src/auto_text_classifier/atc/models/roberta/roberta.py | from atc.models.hf_base import HFBase
from transformers import BertForSequenceClassification, BertModel, BertTokenizer,AutoTokenizer,AutoModelForSequenceClassification
from transformers import AdamW
from transformers import BertConfig
class ROBERTA(HFBase):
def __init__(self,config):
super().__init__(confi... | 1,124 | 34.15625 | 129 | py |
DialogID | DialogID-main/src/auto_text_classifier/atc/models/bert/bert.py | from atc.models.hf_base import HFBase
from transformers import BertForSequenceClassification, BertModel, BertTokenizer,AutoTokenizer,AutoModelForSequenceClassification
from transformers import AdamW
from transformers import BertConfig
class BERT(HFBase):
def __init__(self,config):
super().__init__(config)
... | 613 | 33.111111 | 129 | py |
DialogID | DialogID-main/src/auto_text_classifier/atc/configs/hf_config.py | import os
base_path = os.path.dirname(os.path.realpath(__file__))
from os.path import join
# chinese models
# xlnet base
xlnet_base_dir = join(base_path, '../data/hfl_chinese_xlnet_base')
xlnet_base_config = {"model_dir": xlnet_base_dir,
"save_dir": 'model/xlnet_base'}
# bert base
bert_base_dir =... | 1,233 | 34.257143 | 87 | py |
DialogID | DialogID-main/src/auto_text_classifier/atc/configs/aml_config.py | from atc.models import *
from atc.configs import *
model_dict = {
"macbert_base": {"model_class": MacBERT, "config": macbert_base_config},
"bert_base": {"model_class": BERT, "config": bert_base_config},
"roberta": {"model_class": ROBERTA, "config": chinese_roberta_wwm_ext_config},
"electra_base": {"mod... | 506 | 30.6875 | 88 | py |
DialogID | DialogID-main/src/auto_text_classifier/atc/configs/log_config.py | import os
import logging
import logging.handlers
S_LOG_FORMAT = "[%(asctime)s - %(filename)s:%(lineno)d - %(levelname)s] %(message)s"
S_LOG_SUFFIX = "%Y-%m-%d_%H-%M-%S.log"
def init_logger(s_log_local_path, b_log_debug=False, mode="day"):
s_log_name = os.path.basename(s_log_local_path)
# 一天一个日志
logge... | 869 | 33.8 | 116 | py |
DialogID | DialogID-main/src/auto_text_classifier/atc/configs/__init__.py | from atc.configs.hf_config import * | 35 | 35 | 35 | py |
DialogID | DialogID-main/src/auto_text_classifier/atc/utils/adt_utils.py | '''
对抗训练
参考实现
https://fyubang.com/2019/10/15/adversarial-train/
'''
import torch
import numpy as np
from torch.autograd import Variable
# from loguru import logger
class FGM():
def __init__(self, model):
self.model = model
self.backup = {}
def attack(self, epsilon=1., emb_name='emb.'):
... | 7,143 | 31.770642 | 89 | py |
DialogID | DialogID-main/src/auto_text_classifier/atc/utils/data_utils.py | import os
import numpy as np
import pandas as pd
from sklearn.model_selection import KFold
from sklearn.model_selection import train_test_split
from transformers.data.processors.utils import InputFeatures
from torch.utils.data import Dataset, DataLoader, RandomSampler, SequentialSampler
def init_dir(dir_path):
"""... | 7,870 | 28.927757 | 109 | py |
DialogID | DialogID-main/src/auto_text_classifier/atc/utils/metrics_utils.py | from sklearn.metrics import *
import pandas as pd
def get_model_metrics(y_true, y_pred, show=False, tradeoff = 0.5):
"""
Compute metrics to evaluate the model of a classification.
Parameters:
y_true: 1d array-like Ground truth (correct) labels.
y_pred: Predicted labels, as returned by a c... | 1,926 | 28.19697 | 94 | py |
DialogID | DialogID-main/src/auto_text_classifier/atc/utils/hf_train.py | import logging
import math
import os
import re
import shutil
import warnings
from contextlib import contextmanager
from pathlib import Path
from typing import Any, Callable, Dict, List, Optional, Tuple, Union
import random
import numpy as np
import torch
from packaging import version
from torch import nn
from torch.uti... | 43,013 | 41.170588 | 131 | py |
DialogID | DialogID-main/src/auto_text_classifier/atc/utils/__init__.py | 0 | 0 | 0 | py | |
DialogID | DialogID-main/src/auto_text_classifier/atc/utils/hf_training_args.py | import dataclasses
import json
import logging
import os
from dataclasses import dataclass, field
from typing import Any, Dict, Optional, Tuple
from transformers.file_utils import cached_property, is_torch_available, torch_required
def is_torch_tpu_available():
return False
if is_torch_available():
import t... | 15,395 | 44.821429 | 119 | py |
rosbag2 | rosbag2-master/rosbag2_storage_sqlite3/ros2bag_sqlite3_cli/__init__.py | # Copyright 2023 Foxglove Technologies 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 appl... | 819 | 38.047619 | 94 | py |
rosbag2 | rosbag2-master/rosbag2_storage_mcap/ros2bag_mcap_cli/__init__.py | # Copyright 2023 Foxglove Technologies 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 appl... | 957 | 40.652174 | 95 | py |
rosbag2 | rosbag2-master/rosbag2_performance/rosbag2_performance_benchmarking/launch/benchmark_launch.py | # Copyright 2021, Robotec.ai sp. z o.o.
#
# 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 i... | 20,673 | 36.795247 | 98 | py |
rosbag2 | rosbag2-master/rosbag2_performance/rosbag2_performance_benchmarking/scripts/report_gen.py | #!/usr/bin/env python3
# Copyright 2021, Robotec.ai sp. z o.o.
#
# 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 appli... | 9,694 | 41.336245 | 97 | py |
rosbag2 | rosbag2-master/rosbag2_test_common/rosbag2_test_common/__init__.py | # Copyright 2022 Foxglove Technologies, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed... | 633 | 38.625 | 74 | py |
rosbag2 | rosbag2-master/rosbag2_py/test/test_sequential_reader.py | # Copyright 2020 Open Source Robotics Foundation, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... | 4,644 | 30.385135 | 90 | py |
rosbag2 | rosbag2-master/rosbag2_py/test/test_sequential_writer.py | # Copyright 2020 Open Source Robotics Foundation, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... | 3,720 | 30.268908 | 92 | py |
rosbag2 | rosbag2-master/rosbag2_py/test/test_convert.py | # Copyright 2021 Amazon.com, Inc. or its affiliates. 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 require... | 2,685 | 34.342105 | 74 | py |
rosbag2 | rosbag2-master/rosbag2_py/test/test_sequential_reader_multiple_files.py | # Copyright 2020 Open Source Robotics Foundation, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... | 3,704 | 25.091549 | 92 | py |
rosbag2 | rosbag2-master/rosbag2_py/test/test_reindexer.py | # Copyright 2021 DCS 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 applicable law... | 1,628 | 30.326923 | 83 | py |
rosbag2 | rosbag2-master/rosbag2_py/test/test_storage.py | # Copyright 2022, Foxglove Technologies. 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... | 3,339 | 28.821429 | 74 | py |
rosbag2 | rosbag2-master/rosbag2_py/test/test_transport.py | # Copyright 2021 Amazon.com, Inc. or its affiliates. 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 require... | 2,995 | 32.662921 | 91 | py |
rosbag2 | rosbag2-master/rosbag2_py/test/common.py | # Copyright 2020 Open Source Robotics Foundation, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... | 1,877 | 33.145455 | 97 | py |
rosbag2 | rosbag2-master/rosbag2_py/rosbag2_py/__init__.py | # Copyright 2020 Open Source Robotics Foundation, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... | 2,413 | 26.431818 | 84 | py |
rosbag2 | rosbag2-master/ros2bag/setup.py | from setuptools import find_packages
from setuptools import setup
package_name = 'ros2bag'
setup(
name=package_name,
version='0.20.0',
packages=find_packages(exclude=['test']),
data_files=[
('share/' + package_name, ['package.xml']),
('share/ament_index/resource_index/packages',
... | 1,654 | 31.45098 | 77 | py |
rosbag2 | rosbag2-master/ros2bag/test/test_record.py | # Copyright 2020 Open Source Robotics Foundation, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... | 2,479 | 30 | 98 | py |
rosbag2 | rosbag2-master/ros2bag/test/test_api.py | # Copyright 2020 Amazon.com, Inc. or its affiliates. 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 require... | 4,120 | 44.285714 | 98 | py |
rosbag2 | rosbag2-master/ros2bag/test/test_cli_extension.py | # Copyright 2023 Open Source Robotics Foundation, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... | 1,988 | 32.711864 | 78 | py |
rosbag2 | rosbag2-master/ros2bag/test/test_record_qos_profiles.py | # Copyright 2020 Amazon.com, Inc. or its affiliates. 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 require... | 6,331 | 42.668966 | 98 | py |
rosbag2 | rosbag2-master/ros2bag/test/test_burst.py | # Copyright 2022 Open Source Robotics Foundation, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... | 2,481 | 33.957746 | 78 | py |
rosbag2 | rosbag2-master/ros2bag/test/test_info.py | # Copyright 2022 Open Source Robotics Foundation, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... | 2,422 | 33.614286 | 78 | py |
rosbag2 | rosbag2-master/ros2bag/test/test_copyright.py | # Copyright 2019 Open Source Robotics Foundation, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... | 790 | 31.958333 | 74 | py |
rosbag2 | rosbag2-master/ros2bag/test/test_play_qos_profiles.py | # Copyright 2020 Amazon.com, Inc. or its affiliates. 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 require... | 3,359 | 38.529412 | 85 | py |
rosbag2 | rosbag2-master/ros2bag/test/test_flake8.py | # Copyright 2019 Open Source Robotics Foundation, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... | 884 | 33.038462 | 74 | py |
rosbag2 | rosbag2-master/ros2bag/test/test_pep257.py | # Copyright 2019 Open Source Robotics Foundation, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... | 792 | 32.041667 | 74 | py |
rosbag2 | rosbag2-master/ros2bag/ros2bag/__init__.py | 0 | 0 | 0 | py | |
rosbag2 | rosbag2-master/ros2bag/ros2bag/api/__init__.py | # Copyright 2020 Amazon.com, Inc. or its affiliates. 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 require... | 8,130 | 39.054187 | 99 | py |
rosbag2 | rosbag2-master/ros2bag/ros2bag/command/bag.py | # Copyright 2018 Open Source Robotics Foundation, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... | 1,339 | 33.358974 | 74 | py |
rosbag2 | rosbag2-master/ros2bag/ros2bag/command/__init__.py | 0 | 0 | 0 | py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.