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
grpc
grpc-master/src/csharp/Grpc.Tools.Tests/scripts/fakeprotoc.py
#!/usr/bin/env python3 # Copyright 2022 The gRPC Authors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable l...
14,156
32.787589
93
py
grpc
grpc-master/src/benchmark/gen_build_yaml.py
#!/usr/bin/env python2.7 # Copyright 2015 gRPC authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable l...
1,138
26.119048
74
py
grpc
grpc-master/src/boringssl/gen_build_yaml.py
#!/usr/bin/env python2.7 # Copyright 2015 gRPC authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable la...
4,735
33.823529
100
py
grpc
grpc-master/src/zlib/gen_build_yaml.py
#!/usr/bin/env python2.7 # Copyright 2015 gRPC authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable l...
1,524
24.847458
76
py
grpc
grpc-master/bazel/_gevent_test_main.py
# Copyright 2021 The gRPC Authors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writ...
3,115
30.16
118
py
grpc
grpc-master/test/distrib/python/distribtest.py
# Copyright 2016 gRPC authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing...
782
34.590909
74
py
grpc
grpc-master/test/distrib/bazel/python/import_from_this_package.py
# Copyright 2021 the gRPC authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
747
38.368421
74
py
grpc
grpc-master/test/distrib/bazel/python/helloworld_moved.py
# Copyright 2019 the gRPC authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
2,703
31.97561
79
py
grpc
grpc-master/test/distrib/bazel/python/import_from_proto_library_package.py
# Copyright 2021 the gRPC authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
761
39.105263
74
py
grpc
grpc-master/test/distrib/bazel/python/transitive_proto_dep.py
# Copyright 2021 the gRPC authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
697
37.777778
75
py
grpc
grpc-master/test/distrib/bazel/python/helloworld.py
# Copyright 2019 the gRPC authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
2,591
32.230769
79
py
grpc
grpc-master/test/distrib/bazel/python/namespaced/upper/example/no_import_no_strip_test.py
# Copyright 2020 the gRPC authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
1,308
30.166667
80
py
grpc
grpc-master/test/distrib/bazel/python/namespaced/upper/example/import_strip_test.py
# Copyright 2020 the gRPC authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
1,224
31.236842
80
py
grpc
grpc-master/test/distrib/bazel/python/namespaced/upper/example/import_no_strip_test.py
# Copyright 2020 the gRPC authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
1,324
30.547619
82
py
grpc
grpc-master/test/distrib/bazel/python/namespaced/upper/example/no_import_strip_test.py
# Copyright 2020 the gRPC authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
1,208
30.815789
80
py
grpc
grpc-master/test/distrib/gcf/python/main.py
# Copyright 2022 gRPC authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing...
1,067
31.363636
74
py
grpc
grpc-master/test/core/end2end/fuzzers/generate_client_examples_of_bad_closing_streams.py
#!/usr/bin/env python2.7 # Copyright 2015 gRPC authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable la...
1,146
31.771429
74
py
grpc
grpc-master/test/core/http/test_server.py
#!/usr/bin/env python3 # Copyright 2015 gRPC authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law ...
2,316
28.705128
76
py
grpc
grpc-master/test/cpp/naming/manual_run_resolver_component_test.py
#!/usr/bin/env python # Copyright 2015 gRPC authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law o...
1,576
34.044444
74
py
grpc
grpc-master/test/cpp/naming/gen_build_yaml.py
#!/usr/bin/env python2.7 # Copyright 2015 gRPC authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable la...
3,410
32.116505
82
py
grpc
grpc-master/test/cpp/naming/resolver_component_tests_runner.py
#!/usr/bin/env python # Copyright 2015 gRPC authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law o...
31,352
47.235385
1,276
py
grpc
grpc-master/test/cpp/naming/utils/tcp_connect.py
#!/usr/bin/env python2.7 # Copyright 2015 gRPC authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable la...
1,496
25.263158
74
py
grpc
grpc-master/test/cpp/naming/utils/run_dns_server_for_lb_interop_tests.py
#!/usr/bin/env python2.7 # Copyright 2015 gRPC authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable la...
4,234
29.467626
74
py
grpc
grpc-master/test/cpp/naming/utils/dns_server.py
#!/usr/bin/env python2.7 # Copyright 2015 gRPC authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable la...
7,096
33.451456
80
py
grpc
grpc-master/test/cpp/naming/utils/dns_resolver.py
#!/usr/bin/env python2.7 # Copyright 2015 gRPC authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable la...
2,143
27.586667
80
py
grpc
grpc-master/test/cpp/qps/json_run_localhost_scenario_gen.py
#!/usr/bin/env python3 # Copyright 2018 gRPC authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law...
931
30.066667
74
py
grpc
grpc-master/test/cpp/qps/qps_json_driver_scenario_gen.py
#!/usr/bin/env python3 # Copyright 2018 gRPC authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law...
922
29.766667
74
py
grpc
grpc-master/test/cpp/qps/scenario_generator_helper.py
#!/usr/bin/env python3 # Copyright 2021 The gRPC Authors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable ...
4,455
36.133333
105
py
grpc
grpc-master/test/http2_test/http2_test_server.py
# Copyright 2016 gRPC authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing...
4,304
32.115385
79
py
grpc
grpc-master/test/http2_test/test_rst_during_data.py
# Copyright 2016 gRPC authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing...
1,900
37.02
76
py
grpc
grpc-master/test/http2_test/http2_server_health_check.py
# Copyright 2017 gRPC authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing...
1,320
35.694444
75
py
grpc
grpc-master/test/http2_test/test_rst_after_data.py
# Copyright 2016 gRPC authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing...
1,785
37
79
py
grpc
grpc-master/test/http2_test/http2_base_server.py
# Copyright 2016 gRPC authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing...
9,814
38.26
86
py
grpc
grpc-master/test/http2_test/test_goaway.py
# Copyright 2016 gRPC authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing...
2,772
38.056338
79
py
grpc
grpc-master/test/http2_test/test_ping.py
# Copyright 2016 gRPC authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing...
2,270
35.629032
79
py
grpc
grpc-master/test/http2_test/test_data_frame_padding.py
# Copyright 2016 gRPC authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing...
4,185
38.121495
88
py
grpc
grpc-master/test/http2_test/messages_pb2.py
# Generated by the protocol buffer compiler. DO NOT EDIT! # source: messages.proto import sys _b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1')) from google.protobuf.internal import enum_type_wrapper from google.protobuf import descriptor as _descriptor from google.protobuf import message as _...
24,548
36.083082
2,192
py
grpc
grpc-master/test/http2_test/test_rst_after_header.py
# Copyright 2016 gRPC authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing...
1,276
32.605263
76
py
grpc
grpc-master/test/http2_test/test_max_streams.py
# Copyright 2016 gRPC authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing...
2,065
35.892857
79
py
grpc
grpc-master/doc/python/sphinx/conf.py
# Copyright 2018 The gRPC Authors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writ...
3,633
31.738739
130
py
driver-gaze-yolov5
driver-gaze-yolov5-main/gaze_prediction_and_evaluation.py
""" The code for computing the saliency metrics is adapted from https://github.com/tarunsharma1/saliency_metrics/blob/master/salience_metrics.py """ import os import argparse import time import shutil import math import torch from torch.utils.data import DataLoader from torch import nn from torch.nn import functional...
22,026
36.717466
134
py
driver-gaze-yolov5
driver-gaze-yolov5-main/extract_features.py
""" The following code is adapted from the file detect.py of https://github.com/ultralytics/yolov5 (Release 5.0) """ import os import argparse import time from pathlib import Path import cv2 import torch import torch.backends.cudnn as cudnn from models.experimental import attempt_load from utils.datasets import Load...
10,476
45.358407
118
py
driver-gaze-yolov5
driver-gaze-yolov5-main/network.py
""" The convolutional LSTM is adapted from https://github.com/yaorong0921/Driver-Intention-Prediction/blob/master/models/convolution_lstm.py """ import torch.nn as nn import torch.nn.functional as F import torch from torch.autograd import Variable class Net(nn.Module): def __init__(self, gridwidth, gridheight):...
6,594
38.491018
119
py
driver-gaze-yolov5
driver-gaze-yolov5-main/compute_grid.py
import os from PIL import Image import numpy as np import math import argparse parser = argparse.ArgumentParser(description='Create ground-truth grid for gaze maps') parser.add_argument('--gazemaps', metavar='DIR', help='path to gaze map images folder') parser.add_argument('--grids', metavar='PATH', help='path to outp...
1,947
28.074627
97
py
driver-gaze-yolov5
driver-gaze-yolov5-main/bdda.py
import os import numpy as np import math import torch from torch.utils.data import Dataset import cv2 from utils.utils import * import torchvision from PIL import Image class VideoRecord(object): def __init__(self, row): self._data = row @property def img_id(self): return (self._data[0]) ...
5,490
31.684524
134
py
driver-gaze-yolov5
driver-gaze-yolov5-main/More files/evaluation_otherModel.py
import os import argparse import time import shutil import math import torch from torch.utils.data import DataLoader from torch import nn from torch.nn import functional as F import torchvision import numbers import network from bdda_otherModels import BDDA import numpy as np from PIL import Image from sklearn.met...
9,879
34.285714
138
py
driver-gaze-yolov5
driver-gaze-yolov5-main/More files/compute_BDDA_baseline.py
import os from PIL import Image import numpy as np import math import argparse import os import numpy as np import math import torch from torch.utils.data import Dataset import cv2 from utils.utils import * import torchvision from PIL import Image parser = argparse.ArgumentParser(description='Create average baseline...
1,331
22.368421
110
py
driver-gaze-yolov5
driver-gaze-yolov5-main/More files/flops_counter.py
''' Copyright (C) 2019 Sovrasov V. - All Rights Reserved * You may use, distribute and modify this code under the * terms of the MIT license. * You should have received a copy of the MIT license with * this file. If not visit https://opensource.org/licenses/MIT ''' # this script can be used to evaluate model compl...
14,874
33.512761
139
py
driver-gaze-yolov5
driver-gaze-yolov5-main/More files/evaluation_BDDA_baseline.py
import os import argparse import time import shutil import math import torch from torch.utils.data import DataLoader from torch import nn from torch.nn import functional as F import torchvision import numbers import network from bdda_otherModels import BDDA import numpy as np from sklearn.metrics import f1_score,...
8,598
34.097959
128
py
driver-gaze-yolov5
driver-gaze-yolov5-main/More files/roc_th.py
import matplotlib.pyplot as plt import numpy as np from sklearn.metrics import f1_score,precision_score,recall_score, roc_curve, roc_auc_score, auc """ For each model there has to be a txt file with the gt values gt_modelname.txt and one txt file with the hm_max_values hm_modelname.txt. (gt values and hm_max_values ar...
1,715
32.647059
135
py
driver-gaze-yolov5
driver-gaze-yolov5-main/More files/bdda_otherModels.py
import os import numpy as np import math import torch from torch.utils.data import Dataset import cv2 from utils.utils import * import torchvision from PIL import Image class VideoRecord(object): def __init__(self, row): self._data = row @property def img_id(self): return (self._data[0]) ...
1,891
24.226667
130
py
NMTGMinor
NMTGMinor-master/online.py
#!/usr/bin/env python import os from onmt.online_translator import TranslatorParameter, OnlineTranslator import sys filename="/model/model.conf" t = OnlineTranslator(filename) print("NMT initialized") sys.stdout.flush() while True: # sys.stderr.write("Waiting for data\n"); line = sys.stdin.readline(); # s...
454
22.947368
72
py
NMTGMinor
NMTGMinor-master/preprocess_classify.py
#!/usr/bin/env python import onmt import onmt.markdown import argparse import torch import subprocess import time, datetime from onmt.data.binarizer import Binarizer from onmt.data.binarizer import SpeechBinarizer from onmt.data.indexed_dataset import IndexedDatasetBuilder import h5py as h5 import numpy as np import ...
33,644
42.024297
118
py
NMTGMinor
NMTGMinor-master/setup.py
#!/usr/bin/env python from setuptools import setup, find_packages setup(name='NMTGMinor', version='0.1', author='quanpn90', author_email='ngoc.pham@kit.edu', url='https://github.com/quanpn90/NMTGMinor', license='MIT', scripts=[ 'flask_online.py', 'online.py', ...
532
25.65
60
py
NMTGMinor
NMTGMinor-master/classify.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import division import onmt import onmt.markdown import torch import argparse import math import numpy import sys import h5py as h5 import numpy as np from onmt.inference.predictor import Predictor parser = argparse.ArgumentParser(description='translate.py...
17,820
39.687215
119
py
NMTGMinor
NMTGMinor-master/eval_autoencoder.py
#!/usr/bin/env python from __future__ import division import onmt import onmt.markdown import torch import argparse import math import numpy import sys import h5py as h5 import numpy as np from ae.Evaluator import Evaluator parser = argparse.ArgumentParser(description='translate.py') onmt.markdown.add_md_help_argumen...
9,790
35.808271
102
py
NMTGMinor
NMTGMinor-master/translate.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import division import onmt import onmt.markdown import torch import argparse import math import numpy import sys import numpy as np from onmt.inference.fast_translator import FastTranslator from onmt.inference.stream_translator import StreamTranslator par...
35,674
43.04321
121
py
NMTGMinor
NMTGMinor-master/verify_wav2vec2_feat.py
#!/usr/bin/env python # from fairseq.checkpoint_utils import load_model_ensemble_and_task, load_checkpoint_to_cpu from __future__ import division import onmt import onmt.markdown import torch import argparse import math import numpy import sys import h5py as h5 import numpy as np from onmt.inference.fast_translator ...
8,036
32.348548
119
py
NMTGMinor
NMTGMinor-master/rematch_language_embedding.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import division import onmt import onmt.markdown import torch import argparse import math import numpy import sys import copy from onmt.model_factory import build_model, build_language_model, optimize_model from onmt.constants import add_tokenidx from optio...
2,213
26
81
py
NMTGMinor
NMTGMinor-master/extract_wav2vec2_codebook.py
#!/usr/bin/env python # from fairseq.checkpoint_utils import load_model_ensemble_and_task, load_checkpoint_to_cpu from __future__ import division import onmt import onmt.markdown import torch import argparse import math import numpy import sys import h5py as h5 import numpy as np from onmt.inference.fast_translator ...
7,425
32.151786
119
py
NMTGMinor
NMTGMinor-master/average_checkpoints_auto.py
#!/usr/bin/env python from __future__ import division import onmt import onmt.markdown import torch import argparse import math import numpy import os, sys from onmt.model_factory import build_model, build_language_model, build_classifier, optimize_model from copy import deepcopy from onmt.utils import checkpoint_path...
5,784
27.925
114
py
NMTGMinor
NMTGMinor-master/autoencoder.py
#!/usr/bin/env python from __future__ import division import onmt import onmt.markdown import onmt.modules import argparse import torch import torch.nn as nn from torch import cuda from torch.autograd import Variable import math import time, datetime from onmt.modules.loss import NMTLossFunc from onmt.model_factory im...
5,533
34.703226
115
py
NMTGMinor
NMTGMinor-master/sample_lm.py
#!/usr/bin/env python from __future__ import division import onmt import onmt.markdown import torch import argparse import math import numpy from onmt.model_factory import build_model parser = argparse.ArgumentParser(description='translate.py') onmt.markdown.add_md_help_argument(parser) parser.add_argument('-models...
3,478
26.393701
96
py
NMTGMinor
NMTGMinor-master/rescore.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import division import onmt import onmt.markdown import torch import argparse import math import numpy import sys import h5py as h5 import numpy as np import apex parser = argparse.ArgumentParser(description='rescore.py') onmt.markdown.add_md_help_argument...
13,352
38.979042
117
py
NMTGMinor
NMTGMinor-master/options.py
import argparse def make_parser(parser): # Data options parser.add_argument('-data', required=True, help='Path to the *-train.pt file from preprocess.py') parser.add_argument('-data_format', required=False, default='raw', help='Default data format: raw') ...
43,910
49.822917
149
py
NMTGMinor
NMTGMinor-master/extend_weight.py
#!/usr/bin/env python from __future__ import division import onmt import onmt.markdown import torch import argparse import math import numpy import os, sys from onmt.model_factory import build_model, build_language_model, build_classifier, optimize_model from copy import deepcopy from onmt.utils import checkpoint_path...
5,225
31.259259
144
py
NMTGMinor
NMTGMinor-master/preprocess_triangle.py
#!/usr/bin/env python import onmt import onmt.markdown import argparse import torch import subprocess import time, datetime from onmt.data.binarizer import Binarizer from onmt.data.binarizer import SpeechBinarizer from onmt.data.indexed_dataset import IndexedDatasetBuilder import numpy as np import warnings import os...
64,908
43.397401
119
py
NMTGMinor
NMTGMinor-master/extract_wav2vec2_tdnn.py
#!/usr/bin/env python # from fairseq.checkpoint_utils import load_model_ensemble_and_task, load_checkpoint_to_cpu from __future__ import division import onmt import onmt.markdown import torch import argparse import math import numpy import sys import h5py as h5 import numpy as np from onmt.inference.fast_translator ...
7,353
32.733945
119
py
NMTGMinor
NMTGMinor-master/translate_distributed.py
#!/usr/bin/env python import sys import os import tempfile from itertools import islice from time import time from multiprocessing import Pool from translate import main as translate_main from onmt.utils import safe_readline def find_offsets(filename, num_chunks): """ :param filename: string :param num_c...
4,512
28.116129
99
py
NMTGMinor
NMTGMinor-master/train_distributed.py
#!/usr/bin/env python from __future__ import division import pickle import types import onmt import onmt.markdown import onmt.modules import argparse import torch import time, datetime from onmt.data.mmap_indexed_dataset import MMapIndexedDataset from onmt.data.scp_dataset import SCPIndexDataset from onmt.data.wav_dat...
33,419
44.345997
117
py
NMTGMinor
NMTGMinor-master/train_language_model.py
#!/usr/bin/env python from __future__ import division import onmt import onmt.markdown import onmt.modules import argparse import torch import torch.nn as nn from torch import cuda from torch.autograd import Variable import math import time, datetime from onmt.train_utils.trainer import XETrainer from onmt.modules.los...
4,807
32.158621
105
py
NMTGMinor
NMTGMinor-master/train.py
#!/usr/bin/env python from train_distributed import main if __name__ == "__main__": main()
96
15.166667
34
py
NMTGMinor
NMTGMinor-master/preprocess.py
#!/usr/bin/env python import onmt import onmt.markdown import argparse import torch import subprocess import time, datetime from onmt.data.binarizer import Binarizer from onmt.data.binarizer import SpeechBinarizer from onmt.data.indexed_dataset import IndexedDatasetBuilder import numpy as np import warnings import os...
63,944
43.498956
119
py
NMTGMinor
NMTGMinor-master/flask_online.py
#!/usr/bin/env python from onmt.online_translator import RecognizerParameter, ASROnlineTranslator from flask import Flask, request import torch import numpy as np import math import sys import json import threading import queue import uuid import traceback import subprocess host = sys.argv[1] # 192.168.0.72 port = sy...
6,118
29.595
115
py
NMTGMinor
NMTGMinor-master/flask_mt.py
#!/usr/bin/env python # from onmt.online_translator import RecognizerParameter, ASROnlineTranslator from onmt.online_translator import TranslatorParameter, OnlineTranslator from flask import Flask, request import torch import numpy as np import math import sys import json import threading import queue import uuid impor...
6,523
27.867257
115
py
NMTGMinor
NMTGMinor-master/train_classify.py
#!/usr/bin/env python from __future__ import division import onmt import onmt.markdown import onmt.modules import argparse import torch import time, datetime from onmt.data.mmap_indexed_dataset import MMapIndexedDataset from onmt.data.scp_dataset import SCPIndexDataset from onmt.data.wav_dataset import WavDataset from...
20,484
44.220751
107
py
NMTGMinor
NMTGMinor-master/tools/create_s4_kernel.py
import json import sys config = dict() config["encoder_embed_dim"] = 1024 # or 1024? config["encoder_mssm_num_stacks"] = 1 # change this to stack more s4 config["encoder_mssm_hidden_dim"] = 512 config["encoder_mssm_num_heads"] = 8 config["encoder_mssm_activation"] = "gelu" config["encoder_mssm_scale"] = 0.5 config["e...
782
26
68
py
NMTGMinor
NMTGMinor-master/tools/grad_check.py
import torch.nn as nn import onmt import torch from onmt.reversible_models.transformers import ReversibleTransformerEncoderLayer, ReversibleEncoderFunction, \ ReversibleTransformerDecoderLayer, ReversibleDecoderFunction class TestEncoder(nn.Module): def __init__(self, layers): super().__init__() ...
2,992
28.93
111
py
NMTGMinor
NMTGMinor-master/tools/perplexity_score.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import division import onmt import onmt.markdown import torch import argparse import math import numpy import sys import h5py as h5 import numpy as np import apex parser = argparse.ArgumentParser(description='translate.py') onmt.markdown.add_md_help_argume...
14,590
39.30663
117
py
NMTGMinor
NMTGMinor-master/tools/test_amp.py
import torch from apex import amp from apex.normalization.fused_layer_norm import FusedLayerNorm torch.cuda.set_device(1) class NeuralNet(torch.nn.Module): def __init__(self, d_in, d_out): self.d_in = d_in self.d_out = d_out super().__init__() self.norm = torch.nn.LayerNorm(d_in) ...
1,464
28.3
67
py
NMTGMinor
NMTGMinor-master/tools/get_best.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import division import onmt import onmt.markdown import torch import argparse import math import numpy import sys import h5py as h5 import numpy as np import apex parser = argparse.ArgumentParser(description='rescore.py') onmt.markdown.add_md_help_argument...
2,055
24.382716
75
py
NMTGMinor
NMTGMinor-master/tools/average_checkpoints.py
from __future__ import division import onmt import onmt.markdown import torch import argparse import math import numpy from onmt.model_factory import build_model parser = argparse.ArgumentParser(description='translate.py') onmt.markdown.add_md_help_argument(parser) parser.add_argument('-models', required=True, ...
3,446
26.798387
96
py
NMTGMinor
NMTGMinor-master/tools/grad_check_reversible.py
import torch.nn as nn import onmt import torch # from onmt.reversible_models.transformers import ReversibleTransformerEncoderLayer, ReversibleEncoderFunction, \ # ReversibleTransformerDecoderLayer, ReversibleDecoderFunction from onmt.reversible_models.relative_transformers import ReversibleTransformerEncoderLayer,...
3,353
30.641509
120
py
NMTGMinor
NMTGMinor-master/test/test_cmatmul.py
import torch from time import time B = 16384 N_in = 1024 N_out = 4096 num_iters = 200 x = torch.randn(B, N_in, dtype=torch.cfloat, requires_grad=True) r = torch.randn(B, N_in, dtype=torch.float, requires_grad=True) i = torch.randn(B, N_in, dtype=torch.float, requires_grad=True) print(r.type()) r.data.copy_(x.real.d...
2,405
20.872727
91
py
NMTGMinor
NMTGMinor-master/test/test_factorize_linear.py
import torch import torch.nn.functional as F from time import time N_in = 1024 N_out = 4096 B = 16384 num_iters = 512 x = torch.randn(B, N_in, dtype=torch.float, requires_grad=True) W = torch.randn(N_out, N_in, dtype=torch.float, requires_grad=True) b = torch.randn(N_out, dtype=torch.float, requires_grad=True) x =...
3,043
24.579832
93
py
NMTGMinor
NMTGMinor-master/test/test_self_attention_blaslt.py
import torch import unittest from modules.self_multihead_attn import SelfMultiheadAttn from time import time class SelfMultiheadAttnTest(unittest.TestCase): def setUp(self, seed=1234): torch.manual_seed(seed) torch.cuda.manual_seed_all(seed) self.seq_length = 512 self.sequences ...
5,583
43.672
109
py
NMTGMinor
NMTGMinor-master/test/test_rotation.py
import torch import torch from torch import nn, einsum from einops import rearrange, repeat class SinusoidalEmbeddings(nn.Module): def __init__(self, dim): super().__init__() inv_freq = 1. / (10000 ** (torch.arange(0, dim, 2).float() / dim)) self.register_buffer('inv_freq', inv_freq) ...
3,312
25.293651
104
py
NMTGMinor
NMTGMinor-master/test/test_fmha.py
############################################################################### # Copyright (c) 2011-2021, NVIDIA CORPORATION. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # * Redistribution...
14,170
32.343529
104
py
NMTGMinor
NMTGMinor-master/test/test_flattened_weight.py
import torch import torch.nn.functional as F from time import time class ParameterRef(object): def __init__(self, weight_buf, offset, length, size): self.weight_buf = weight_buf self.offset = offset self.length = length self.size = size def __call__(self): return sel...
3,501
25.330827
86
py
NMTGMinor
NMTGMinor-master/test/test_multi_linear.py
import torch import torch.nn.functional as F import torch.nn as nn from torch.nn import Parameter len_q = 20 input_dim = 128 heads = 8 head_dim = input_dim // heads output_dim = input_dim k_proj = nn.Linear(input_dim, input_dim, bias=True) v_proj = nn.Linear(input_dim, input_dim, bias=True) q_proj = nn.Linear(input_d...
3,110
32.095745
133
py
NMTGMinor
NMTGMinor-master/test/test_self_attention.py
import torch import unittest from modules.self_multihead_attn import SelfMultiheadAttn from time import time class SelfMultiheadAttnTest(unittest.TestCase): def setUp(self, seed=1234): torch.manual_seed(seed) torch.cuda.manual_seed_all(seed) self.seq_length = 512 self.sequences ...
5,583
43.672
109
py
NMTGMinor
NMTGMinor-master/test/test_softmax.py
import torch import mask_softmax_dropout_cuda import copy BH = 1024 * 8 B = 1024 H = BH // B Q = 75 K = 56 x = torch.randn((BH, Q, K) , dtype=torch.float16, device=torch.device("cuda"), requires_grad=True) * 100 x_ref = x.clone().detach().requires_grad_(True) grado = torch.randn((BH, Q, K), dtype=torch.float16, devi...
1,510
24.610169
104
py
NMTGMinor
NMTGMinor-master/test/modules/fast_self_multihead_attn_func.py
import torch # import fast_self_multihead_attn # import fast_self_multihead_attn_bias # import fast_self_multihead_attn_bias_additive_mask import self_multihead_attn_cuda as fast_self_multihead_attn_bias_additive_mask class FastSelfAttnFunc(torch.autograd.Function): @staticmethod def forward(ctx, use_time_mas...
3,260
32.96875
108
py
NMTGMinor
NMTGMinor-master/test/modules/self_multihead_attn.py
import math import torch from torch import nn from torch.nn import Parameter import torch.nn.functional as F from .self_multihead_attn_func import self_attn_func from .fast_self_multihead_attn_func import fast_self_attn_func # from .fast_self_multihead_attn_norm_add_func import fast_self_attn_norm_add_func # from ape...
4,111
39.712871
118
py
NMTGMinor
NMTGMinor-master/test/modules/self_multihead_attn_func.py
""" Self-attention with multi-head attention. Code is taken from apex self-attention implementation https://github.com/NVIDIA/apex/tree/master/apex/contrib/csrc/multihead_attn """ import torch import torch.nn.functional as F from torch.cuda.amp import custom_fwd, custom_bwd try: import mask_softmax_dropout_cuda ...
24,368
44.464552
127
py
NMTGMinor
NMTGMinor-master/pretrain_module/modeling_m2m100.py
# coding=utf-8 # Copyright 2021 The Fairseq Authors and The HuggingFace Inc. team. 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/...
41,949
40.208251
120
py
NMTGMinor
NMTGMinor-master/pretrain_module/configuration_m2m100.py
# coding=utf-8 # Copyright 2021 The Fairseq Authors and The HuggingFace Inc. team. 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/...
3,133
35.44186
99
py
NMTGMinor
NMTGMinor-master/pretrain_module/configuration_utils.py
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team. # Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a cop...
21,508
56.819892
153
py
NMTGMinor
NMTGMinor-master/pretrain_module/positional_embeddings.py
from typing import Dict, Optional import torch import torch.nn as nn import torch.nn.functional as F from torch import Tensor import math def make_positions(tensor, padding_idx: int): """Replace non-padding symbols with their position numbers. Position numbers begin at padding_idx+1. Padding symbols are ignor...
5,604
37.655172
94
py
NMTGMinor
NMTGMinor-master/pretrain_module/modeling_outputs.py
from dataclasses import dataclass from typing import List, Optional, Tuple import torch from .file_utils import ModelOutput @dataclass class BaseModelOutput(ModelOutput): """ Base class for model's outputs, with potential hidden states and attentions. Args: last_hidden_state (:obj:`torch.FloatTe...
1,557
49.258065
168
py