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 |
|---|---|---|---|---|---|---|
MINDER | MINDER-main/scripts/training/multiprocessing_bpe_encoder.py | #!/usr/bin/env python
# Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import argparse
import contextlib
import sys
from collections import Counter
from multiprocessing im... | 3,818 | 27.714286 | 81 | py |
MINDER | MINDER-main/scripts/training/make_supervised_kilt_dataset.py | # Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
from argparse import ArgumentParser
from collections import defaultdict
import json
import multiprocessing
from pathlib imp... | 10,245 | 29.861446 | 128 | py |
MINDER | MINDER-main/res/external/sdsl-lite/external/googletest/googletest/xcode/Scripts/versiongenerate.py | #!/usr/bin/env python
#
# Copyright 2008, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list... | 4,536 | 43.920792 | 80 | py |
MINDER | MINDER-main/res/external/sdsl-lite/external/googletest/googletest/test/gtest_list_tests_unittest.py | #!/usr/bin/env python
#
# Copyright 2006, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list... | 6,537 | 30.432692 | 79 | py |
MINDER | MINDER-main/res/external/sdsl-lite/external/googletest/googletest/test/gtest_throw_on_failure_test.py | #!/usr/bin/env python
#
# Copyright 2009, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list... | 5,767 | 32.534884 | 79 | py |
MINDER | MINDER-main/res/external/sdsl-lite/external/googletest/googletest/test/gtest_xml_outfiles_test.py | #!/usr/bin/env python
#
# Copyright 2008, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list... | 5,340 | 39.157895 | 140 | py |
MINDER | MINDER-main/res/external/sdsl-lite/external/googletest/googletest/test/gtest_filter_unittest.py | #!/usr/bin/env python
#
# Copyright 2005 Google Inc. All Rights Reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of... | 21,325 | 32.478807 | 80 | py |
MINDER | MINDER-main/res/external/sdsl-lite/external/googletest/googletest/test/gtest_xml_test_utils.py | #!/usr/bin/env python
#
# Copyright 2006, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list... | 8,872 | 44.502564 | 79 | py |
MINDER | MINDER-main/res/external/sdsl-lite/external/googletest/googletest/test/gtest_test_utils.py | #!/usr/bin/env python
#
# Copyright 2006, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list... | 10,823 | 32.719626 | 79 | py |
MINDER | MINDER-main/res/external/sdsl-lite/external/googletest/googletest/test/gtest_shuffle_test.py | #!/usr/bin/env python
#
# Copyright 2009 Google Inc. All Rights Reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of... | 12,549 | 37.496933 | 79 | py |
MINDER | MINDER-main/res/external/sdsl-lite/external/googletest/googletest/test/gtest_env_var_test.py | #!/usr/bin/env python
#
# Copyright 2008, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list... | 4,036 | 33.211864 | 79 | py |
MINDER | MINDER-main/res/external/sdsl-lite/external/googletest/googletest/test/gtest_help_test.py | #!/usr/bin/env python
#
# Copyright 2009, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list... | 5,856 | 32.855491 | 75 | py |
MINDER | MINDER-main/res/external/sdsl-lite/external/googletest/googletest/test/gtest_break_on_failure_unittest.py | #!/usr/bin/env python
#
# Copyright 2006, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list... | 7,339 | 33.460094 | 79 | py |
MINDER | MINDER-main/res/external/sdsl-lite/external/googletest/googletest/test/gtest_output_test.py | #!/usr/bin/env python
#
# Copyright 2008, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list... | 12,259 | 34.953079 | 79 | py |
MINDER | MINDER-main/res/external/sdsl-lite/external/googletest/googletest/test/gtest_catch_exceptions_test.py | #!/usr/bin/env python
#
# Copyright 2010 Google Inc. All Rights Reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list o... | 9,901 | 40.605042 | 78 | py |
MINDER | MINDER-main/res/external/sdsl-lite/external/googletest/googletest/test/gtest_uninitialized_test.py | #!/usr/bin/env python
#
# Copyright 2008, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list... | 2,482 | 33.971831 | 77 | py |
MINDER | MINDER-main/res/external/sdsl-lite/external/googletest/googletest/test/gtest_color_test.py | #!/usr/bin/env python
#
# Copyright 2008, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list... | 4,911 | 36.496183 | 76 | py |
MINDER | MINDER-main/res/external/sdsl-lite/external/googletest/googletest/test/gtest_xml_output_unittest.py | #!/usr/bin/env python
#
# Copyright 2006, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list... | 14,677 | 46.501618 | 225 | py |
MINDER | MINDER-main/res/external/sdsl-lite/external/googletest/googletest/scripts/fuse_gtest_files.py | #!/usr/bin/env python
#
# Copyright 2009, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list... | 8,884 | 33.980315 | 78 | py |
MINDER | MINDER-main/res/external/sdsl-lite/external/googletest/googletest/scripts/upload.py | #!/usr/bin/env python
#
# Copyright 2007 Google 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 o... | 51,024 | 35.761527 | 80 | py |
MINDER | MINDER-main/res/external/sdsl-lite/external/googletest/googletest/scripts/pump.py | #!/usr/bin/env python
#
# Copyright 2008, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list... | 23,673 | 26.656542 | 80 | py |
MINDER | MINDER-main/res/external/sdsl-lite/external/googletest/googletest/scripts/gen_gtest_pred_impl.py | #!/usr/bin/env python
#
# Copyright 2006, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list... | 21,986 | 29.077975 | 76 | py |
MINDER | MINDER-main/res/external/sdsl-lite/external/googletest/googletest/scripts/upload_gtest.py | #!/usr/bin/env python
#
# Copyright 2009, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list... | 2,851 | 35.101266 | 72 | py |
MINDER | MINDER-main/res/external/sdsl-lite/external/googletest/googletest/scripts/common.py | # Copyright 2013 Google Inc. All Rights Reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the foll... | 2,919 | 33.761905 | 78 | py |
MINDER | MINDER-main/res/external/sdsl-lite/external/googletest/googletest/scripts/release_docs.py | #!/usr/bin/env python
#
# Copyright 2013 Google Inc. All Rights Reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of... | 6,132 | 37.572327 | 80 | py |
MINDER | MINDER-main/res/external/sdsl-lite/external/googletest/googlemock/test/gmock_leak_test.py | #!/usr/bin/env python
#
# Copyright 2009, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list... | 4,384 | 39.229358 | 73 | py |
MINDER | MINDER-main/res/external/sdsl-lite/external/googletest/googlemock/test/gmock_test_utils.py | #!/usr/bin/env python
#
# Copyright 2006, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list... | 3,684 | 31.610619 | 79 | py |
MINDER | MINDER-main/res/external/sdsl-lite/external/googletest/googlemock/test/gmock_output_test.py | #!/usr/bin/env python
#
# Copyright 2008, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list... | 5,999 | 32.149171 | 80 | py |
MINDER | MINDER-main/res/external/sdsl-lite/external/googletest/googlemock/scripts/fuse_gmock_files.py | #!/usr/bin/env python
#
# Copyright 2009, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list... | 8,631 | 34.817427 | 79 | py |
MINDER | MINDER-main/res/external/sdsl-lite/external/googletest/googlemock/scripts/upload.py | #!/usr/bin/env python
#
# Copyright 2007 Google 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 o... | 51,024 | 35.761527 | 80 | py |
MINDER | MINDER-main/res/external/sdsl-lite/external/googletest/googlemock/scripts/upload_gmock.py | #!/usr/bin/env python
#
# Copyright 2009, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list... | 2,833 | 34.873418 | 72 | py |
MINDER | MINDER-main/res/external/sdsl-lite/external/googletest/googlemock/scripts/gmock_doctor.py | #!/usr/bin/env python
#
# Copyright 2008, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list... | 24,131 | 36.647426 | 80 | py |
MINDER | MINDER-main/res/external/sdsl-lite/external/googletest/googlemock/scripts/generator/gmock_gen.py | #!/usr/bin/env python
#
# Copyright 2008 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requir... | 1,091 | 33.125 | 79 | py |
MINDER | MINDER-main/res/external/sdsl-lite/external/googletest/googlemock/scripts/generator/cpp/gmock_class.py | #!/usr/bin/env python
#
# Copyright 2008 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requi... | 8,293 | 35.377193 | 79 | py |
MINDER | MINDER-main/res/external/sdsl-lite/external/googletest/googlemock/scripts/generator/cpp/keywords.py | #!/usr/bin/env python
#
# Copyright 2007 Neal Norwitz
# Portions Copyright 2007 Google 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... | 2,004 | 32.416667 | 97 | py |
MINDER | MINDER-main/res/external/sdsl-lite/external/googletest/googlemock/scripts/generator/cpp/gmock_class_test.py | #!/usr/bin/env python
#
# Copyright 2009 Neal Norwitz All Rights Reserved.
# Portions Copyright 2009 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# ... | 11,356 | 24.293987 | 78 | py |
MINDER | MINDER-main/res/external/sdsl-lite/external/googletest/googlemock/scripts/generator/cpp/utils.py | #!/usr/bin/env python
#
# Copyright 2007 Neal Norwitz
# Portions Copyright 2007 Google 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... | 1,153 | 26.47619 | 74 | py |
MINDER | MINDER-main/res/external/sdsl-lite/external/googletest/googlemock/scripts/generator/cpp/__init__.py | 0 | 0 | 0 | py | |
MINDER | MINDER-main/res/external/sdsl-lite/external/googletest/googlemock/scripts/generator/cpp/ast.py | #!/usr/bin/env python
#
# Copyright 2007 Neal Norwitz
# Portions Copyright 2007 Google 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... | 62,773 | 35.201845 | 82 | py |
MINDER | MINDER-main/res/external/sdsl-lite/external/googletest/googlemock/scripts/generator/cpp/tokenize.py | #!/usr/bin/env python
#
# Copyright 2007 Neal Norwitz
# Portions Copyright 2007 Google 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... | 9,752 | 32.864583 | 79 | py |
MINDER | MINDER-main/res/external/sdsl-lite/tutorial/document_listing/generate_collection.py | #!/usr/bin/python
import fnmatch
import sys
import os
import re
includes = ['*.cpp','*.hpp'] # sources only
includes = r'|'.join([fnmatch.translate(x) for x in includes])
collection_path = "collection.txt"
def main():
if len(sys.argv) == 1:
print "Usage ./", sys.argv[0], "directory"
sys.exit(0)... | 877 | 23.388889 | 62 | py |
MINDER | MINDER-main/seal/evaluate_output.py | import json
from tqdm import tqdm
import unicodedata
import json, string, re
from collections import Counter, defaultdict
from argparse import ArgumentParser
import unicodedata
import regex
import logging
import copy
logger = logging.getLogger(__name__)
class Tokenizer(object):
"""Base tokenizer class.
Tokeniz... | 7,721 | 29.76494 | 111 | py |
MINDER | MINDER-main/seal/keys.py | # Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import math
from collections import defaultdict
from heapq import heappop, heappush
from itertools import chain, islice, pr... | 18,977 | 34.079482 | 138 | py |
MINDER | MINDER-main/seal/utils.py | # Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import torch
from torch import nn
def _remove_ignore_keys_(state_dict):
ignore_keys = [
"encoder.version",
... | 2,021 | 35.107143 | 102 | py |
MINDER | MINDER-main/seal/data.py | # Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
from typing import Optional
import jsonlines
import csv
import ast
import pathlib
import json
from enum import unique, Enu... | 6,374 | 31.692308 | 106 | py |
MINDER | MINDER-main/seal/retrieval.py | # Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import os
import psutil
import logging
import sys
from typing import *
from dataclasses import dataclass
from itertools imp... | 38,931 | 38.807771 | 167 | py |
MINDER | MINDER-main/seal/beam_search.py | # Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
from collections import UserDict
from typing import *
import warnings
from more_itertools import chunked
import torch
from... | 31,228 | 40.090789 | 183 | py |
MINDER | MINDER-main/seal/search.py | # Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import random
from more_itertools import chunked
from seal.retrieval import SEALSearcher
from seal.data import TopicsForm... | 3,852 | 37.148515 | 113 | py |
MINDER | MINDER-main/seal/evaluate_output_msmarco.py | """
This module computes evaluation metrics for MSMARCO dataset on the ranking task.
Command line:
python msmarco_eval_ranking.py <path_to_reference_file> <path_to_candidate_file>
Creation Date : 06/12/2018
Last Modified : 1/21/2019
Authors : Daniel Campos <dacamp@microsoft.com>, Rutger van Haasteren <ruvanh@microsoft... | 8,065 | 40.792746 | 161 | py |
MINDER | MINDER-main/seal/index.py | # Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import bisect
import pickle
import struct
import tempfile
from typing import List, Set, Tuple, Optional, Iterable, Iterator... | 7,468 | 33.419355 | 121 | py |
MINDER | MINDER-main/seal/cpp_modules/__init__.py | # Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
| 196 | 31.833333 | 61 | py |
SRU_for_GCI | SRU_for_GCI-master/main.py | #!/usr/bin/env python
# coding: utf-8
# Import header files
import math
import argparse
import torch
from torch import autograd
import torch.nn as nn
import torch.nn.functional as F
import matplotlib
import sys
import numpy as np
import pylab
from matplotlib import pyplot as plt
import time
import sys
from models.sru... | 12,432 | 33.72905 | 186 | py |
SRU_for_GCI | SRU_for_GCI-master/models/esru_2LF.py | import time
import torch
from torch import autograd
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
import math
from copy import deepcopy
# Statistical Recurrent Unit class (based on paper by Junier B. Oliva, arXiv:1703.00381v1)
class eSRU_2LF(torch.nn.Module):
def __init__(self,
... | 14,315 | 47.040268 | 216 | py |
SRU_for_GCI | SRU_for_GCI-master/models/esru_1LF.py | import time
import torch
from torch import autograd
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
import math
from copy import deepcopy
# Statistical Recurrent Unit class (based on paper by Junier B. Oliva, arXiv:1703.00381v1)
class eSRU_1LF(torch.nn.Module):
def __init__(self,
... | 13,531 | 45.501718 | 216 | py |
SRU_for_GCI | SRU_for_GCI-master/models/sru.py | import time
import torch
from torch import autograd
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
import math
from copy import deepcopy
# Statistical Recurrent Unit class (based on paper by Junier B. Oliva, arXiv:1703.00381v1)
class SRU(torch.nn.Module):
def __init__(self,
... | 15,047 | 45.018349 | 216 | py |
SRU_for_GCI | SRU_for_GCI-master/utils/utilFuncs.py | # Import header files
import math
import torch
from torch import autograd
import torch.nn as nn
import torch.nn.functional as F
import matplotlib
import sys
import numpy as np
import pylab
from matplotlib import pyplot as plt
import time
import sys
import csv
###########################################
# Python/numpy... | 11,267 | 28.730871 | 142 | py |
SRU_for_GCI | SRU_for_GCI-master/utils/lorenz96Checker.py | import numpy as np
import torch
from utilFuncs import calcPerfMetrics, calcAUROC, calcAUPR
# lorenz96 params
T = 1000
F = 40.0
model_name = 'lstm'
mu = 6.6 # F = 10, mu = 0.2| F = 40, mu = 4.0
n = 10
numDatasets = 5
max_iter = 500
verbose = 0
thresholdVec = np.arange(0, 1, 0.05)
#thresholdVec = np.arange(0, 0.1, ... | 1,909 | 32.508772 | 146 | py |
SRU_for_GCI | SRU_for_GCI-master/utils/perfChk.py | import math
import torch
import matplotlib
#import sys
import numpy as np
import pylab
from matplotlib import pyplot as plt
#import time
from utilFuncs import loadTrueNetwork, getCausalNodes, calcPerfMetrics, calcAUROC, calcAUPR
dataset = 'LORENZ'
#dataset = 'VAR'
#dataset = 'GENE'
if(dataset == 'LORENZ'):
dat... | 3,856 | 30.357724 | 160 | py |
errant | errant-master/setup.py | from pathlib import Path
from setuptools import setup, find_packages
# Get base working directory.
base_dir = Path(__file__).resolve().parent
# Readme text for long description
with open(base_dir/"README.md") as f:
readme = f.read()
setup(
name = "errant",
version = "2.3.3",
license = "MIT",
... | 1,900 | 39.446809 | 123 | py |
errant | errant-master/errant/alignment.py | from itertools import groupby
from rapidfuzz.distance import Indel
import spacy.parts_of_speech as POS
from errant.edit import Edit
class Alignment:
# Protected class resource
_open_pos = {POS.ADJ, POS.ADV, POS.NOUN, POS.VERB}
# Input 1: An original text string parsed by spacy
# Input 2: A corrected t... | 7,294 | 40.685714 | 89 | py |
errant | errant-master/errant/__init__.py | from importlib import import_module
import spacy
from errant.annotator import Annotator
# ERRANT version
__version__ = '2.3.3'
# Load an ERRANT Annotator object for a given language
def load(lang, nlp=None):
# Make sure the language is supported
supported = {"en"}
if lang not in supported:
raise E... | 813 | 29.148148 | 74 | py |
errant | errant-master/errant/annotator.py | from errant.alignment import Alignment
from errant.edit import Edit
from spacy.tokens import Doc
# Main ERRANT Annotator class
class Annotator:
# Input 1: A string language id: e.g. "en"
# Input 2: A spacy processing object for the language
# Input 3: A merging module for the language
# Input 4: A cla... | 3,788 | 36.89 | 83 | py |
errant | errant-master/errant/edit.py | # ERRANT edit class
class Edit:
# Input 1: An original text string parsed by spacy
# Input 2: A corrected text string parsed by spacy
# Input 3: A token span edit list: [o_start, o_end, c_start, c_end]
# Input 4: An error type string, if known
def __init__(self, orig, cor, edit, type="NA"):
... | 2,352 | 41.017857 | 89 | py |
errant | errant-master/errant/en/lancaster.py | # Taken from NLTK
# https://github.com/nltk/nltk/blob/develop/nltk/stem/lancaster.py
#
# Natural Language Toolkit: Stemmers
#
# Copyright (C) 2001-2020 NLTK Project
# Author: Steven Tomcavage <stomcava@law.upenn.edu>
# URL: <http://nltk.org/>
# For license information, see LICENSE.TXT
"""
A word stemmer based on the L... | 12,340 | 34.26 | 93 | py |
errant | errant-master/errant/en/merger.py | from itertools import combinations, groupby
from re import sub
from string import punctuation
from rapidfuzz.distance import Indel
import spacy.symbols as POS
from errant.edit import Edit
# Merger resources
open_pos = {POS.ADJ, POS.AUX, POS.ADV, POS.NOUN, POS.VERB}
# Input: An Alignment object
# Output: A list of Edi... | 5,806 | 45.456 | 77 | py |
errant | errant-master/errant/en/classifier.py | from pathlib import Path
from rapidfuzz.distance import Levenshtein
from errant.en.lancaster import LancasterStemmer
import spacy
import spacy.symbols as POS
# Load Hunspell word list
def load_word_list(path):
with open(path) as word_list:
return set([word.strip() for word in word_list])
# Load Universal ... | 22,283 | 42.608611 | 99 | py |
errant | errant-master/errant/en/__init__.py | 0 | 0 | 0 | py | |
errant | errant-master/errant/commands/m2_to_m2.py | import argparse
import errant
def main():
# Parse command line args
args = parse_args()
print("Loading resources...")
# Load Errant
annotator = errant.load("en")
print("Processing M2 file...")
# Open the m2 file and split it into text+edits blocks. Also open out_m2.
with open(args.m2_f... | 7,837 | 41.597826 | 90 | py |
errant | errant-master/errant/commands/compare_m2.py | import argparse
from collections import Counter
def main():
# Parse command line args
args = parse_args()
# Open hypothesis and reference m2 files and split into chunks
hyp_m2 = open(args.hyp).read().strip().split("\n\n")
ref_m2 = open(args.ref).read().strip().split("\n\n")
# Make sure they hav... | 17,092 | 41.100985 | 103 | py |
errant | errant-master/errant/commands/parallel_to_m2.py | import argparse
from contextlib import ExitStack
import errant
def main():
# Parse command line args
args = parse_args()
print("Loading resources...")
# Load Errant
annotator = errant.load("en")
print("Processing parallel files...")
# Process an arbitrary number of files line by line simul... | 3,648 | 39.544444 | 86 | py |
errant | errant-master/errant/commands/__init__.py | 0 | 0 | 0 | py | |
Quantized-GBDT | Quantized-GBDT-master/experiments/generate_script.py | import os
import argparse
arg_parser = argparse.ArgumentParser()
arg_parser.add_argument("data_path", type=str)
arg_parser.add_argument("--use-discretized-grad", action='store_true')
arg_parser.add_argument("--discretized-grad-renew", action='store_true')
arg_parser.add_argument("--stochastic-rounding", action='store_... | 7,377 | 46.294872 | 177 | py |
Quantized-GBDT | Quantized-GBDT-master/experiments/parse_logs.py | from argparse import ArgumentParser
import os
import numpy as np
parser = ArgumentParser()
parser.add_argument("log_dir", type=str)
parser.add_argument("out_fname", type=str)
parser.add_argument("num_seeds", type=int)
parser.add_argument("--for-speed", action='store_true')
datasets = ["higgs", "epsilon", "kitsune", "... | 5,658 | 53.941748 | 152 | py |
neuron-merging | neuron-merging-main/main.py | from __future__ import print_function
import warnings
warnings.simplefilter("ignore", UserWarning)
import argparse
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import os
import sys
import pickle
import copy
cwd = os.getcwd()
sys.path.append(cwd+'/.... | 14,964 | 38.485488 | 167 | py |
neuron-merging | neuron-merging-main/decompose.py | from __future__ import print_function
import argparse
import pickle
import numpy as np
from sklearn.utils.extmath import randomized_svd
from sklearn.metrics import pairwise_distances
from sklearn.metrics.pairwise import cosine_similarity
from scipy.spatial.distance import cosine
import torch
import torch.nn as nn
impo... | 19,186 | 35.616412 | 168 | py |
neuron-merging | neuron-merging-main/models/ResNet.py | import torch
import torch.nn as nn
import math
import torch.utils.model_zoo as model_zoo
import torch.nn.functional as F
def conv3x3(in_planes, out_planes, stride=1):
"3x3 convolution with padding"
return nn.Conv2d(in_planes, out_planes, kernel_size=3, stride=stride,
padding=1, bias=False... | 7,173 | 26.381679 | 99 | py |
neuron-merging | neuron-merging-main/models/LeNet_300_100.py | from __future__ import print_function
import torch
import torch.nn as nn
import os
class LeNet_300_100(nn.Module):
def __init__(self, bias_flag, cfg):
if cfg == None:
cfg = [300,100]
super(LeNet_300_100, self).__init__()
self.ip1 = nn.Linear(28*28, cfg[0], bias=bias_flag)
... | 749 | 29 | 60 | py |
neuron-merging | neuron-merging-main/models/VGG.py | from __future__ import print_function
import math
import torch
import torch.nn as nn
from torch.autograd import Variable
import torch.nn.functional as F
__all__ = ['VGG']
defaultcfg = {
11: [64, 'M', 128, 'M', 256, 256, 'M', 512, 512, 'M', 512, 512],
13: [64, 64, 'M', 128, 128, 'M', 256, 256, 'M', 512, 512,... | 3,154 | 26.920354 | 107 | py |
neuron-merging | neuron-merging-main/models/__init__.py | from .LeNet_300_100 import *
from .VGG import *
from .ResNet import *
from .WideResNet import * | 111 | 27 | 32 | py |
neuron-merging | neuron-merging-main/models/WideResNet.py | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
class BasicBlock(nn.Module):
def __init__(self, in_planes, out_planes, stride, cfg, dropRate=0.0):
super(BasicBlock, self).__init__()
self.bn1 = nn.BatchNorm2d(in_planes)
self.relu1 = nn.ReLU(inplace=True)
... | 4,955 | 35.711111 | 119 | py |
LAP-PAL | LAP-PAL-master/continuous/main.py | import numpy as np
import torch
import gym
import argparse
import os
import time
import utils
import TD3
import LAP_TD3
import PAL_TD3
import PER_TD3
# Runs policy for X episodes and returns average reward
def eval_policy(policy, env, seed, eval_episodes=10):
eval_env = gym.make(env)
eval_env.seed(seed + 100)
av... | 5,222 | 33.361842 | 121 | py |
LAP-PAL | LAP-PAL-master/continuous/PAL_TD3.py | import copy
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
class Actor(nn.Module):
def __init__(self, state_dim, action_dim, max_action):
super(Actor, self).__init__()
self.l1 = nn.Linear(state_dim, 25... | 5,164 | 26.768817 | 119 | py |
LAP-PAL | LAP-PAL-master/continuous/PER_TD3.py | import copy
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
class Actor(nn.Module):
def __init__(self, state_dim, action_dim, max_action):
super(Actor, self).__init__()
self.l1 = nn.Linear(state_dim, 25... | 5,032 | 26.653846 | 94 | py |
LAP-PAL | LAP-PAL-master/continuous/utils.py | import numpy as np
import torch
class ReplayBuffer(object):
def __init__(self, state_dim, action_dim, max_size=int(1e6)):
self.max_size = max_size
self.ptr = 0
self.size = 0
self.state = np.zeros((max_size, state_dim))
self.action = np.zeros((max_size, action_dim))
self.next_state = np.zeros((max_size, ... | 4,293 | 28.410959 | 93 | py |
LAP-PAL | LAP-PAL-master/continuous/TD3.py | import copy
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
class Actor(nn.Module):
def __init__(self, state_dim, action_dim, max_action):
super(Actor, self).__init__()
self.l1 = nn.Linear(state_dim, 25... | 4,551 | 26.756098 | 93 | py |
LAP-PAL | LAP-PAL-master/continuous/LAP_TD3.py | import copy
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
class Actor(nn.Module):
def __init__(self, state_dim, action_dim, max_action):
super(Actor, self).__init__()
self.l1 = nn.Linear(state_dim, 25... | 5,118 | 26.67027 | 116 | py |
LAP-PAL | LAP-PAL-master/discrete/main.py | import argparse
import copy
import importlib
import json
import os
import numpy as np
import torch
import DDQN
import PER_DDQN
import LAP_DDQN
import PAL_DDQN
import utils
def main(env, replay_buffer, is_atari, state_dim, num_actions, args, parameters, device):
# Initialize and load policy
kwargs = {
"is_atari"... | 6,543 | 26.846809 | 116 | py |
LAP-PAL | LAP-PAL-master/discrete/utils.py | import cv2
import gym
import numpy as np
import torch
def ReplayBuffer(state_dim, prioritized, is_atari, atari_preprocessing, batch_size, buffer_size, device):
if is_atari:
return PrioritizedAtariBuffer(state_dim, atari_preprocessing, batch_size, buffer_size, device, prioritized)
else:
return PrioritizedStand... | 10,436 | 28.483051 | 109 | py |
LAP-PAL | LAP-PAL-master/discrete/PER_DDQN.py | import copy
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
# Used for Atari
class Conv_Q(nn.Module):
def __init__(self, frames, num_actions):
super(Conv_Q, self).__init__()
self.c1 = nn.Conv2d(frames, 32, kernel_size=8, stride=4)
self.c2 = nn.Conv2d(32, 64, kernel_size=4,... | 5,366 | 28.010811 | 111 | py |
LAP-PAL | LAP-PAL-master/discrete/PAL_DDQN.py | import copy
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
# Used for Atari
class Conv_Q(nn.Module):
def __init__(self, frames, num_actions):
super(Conv_Q, self).__init__()
self.c1 = nn.Conv2d(frames, 32, kernel_size=8, stride=4)
self.c2 = nn.Conv2d(32, 64, kernel_size=4,... | 4,712 | 27.053571 | 111 | py |
LAP-PAL | LAP-PAL-master/discrete/LAP_DDQN.py | import copy
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
# Used for Atari
class Conv_Q(nn.Module):
def __init__(self, frames, num_actions):
super(Conv_Q, self).__init__()
self.c1 = nn.Conv2d(frames, 32, kernel_size=8, stride=4)
self.c2 = nn.Conv2d(32, 64, kernel_size=4,... | 4,658 | 27.408537 | 111 | py |
LAP-PAL | LAP-PAL-master/discrete/DDQN.py | import copy
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
# Used for Atari
class Conv_Q(nn.Module):
def __init__(self, frames, num_actions):
super(Conv_Q, self).__init__()
self.c1 = nn.Conv2d(frames, 32, kernel_size=8, stride=4)
self.c2 = nn.Conv2d(32, 64, kernel_size=4,... | 4,265 | 27.251656 | 111 | py |
inversegraphics | inversegraphics-master/process_mesh.py | import meshtool.filters.simplify_filters.sander_simplify
from meshtool.filters.base_filters import MetaFilter
from meshtool.filters import factory
from itertools import chain, izip, combinations
import collada
import numpy
def process(meshPath):
mesh = collada.Collada(meshPath)
# 'triangulate',
optimize... | 921 | 23.918919 | 87 | py |
inversegraphics | inversegraphics-master/teapots.py | #!/usr/bin/env python3.4m
from blender_utils import *
baseDir = '../databaseFull/models/'
lines = [line.strip() for line in open('teapots.txt')]
for object in bpy.data.scenes['Scene'].objects: print(object.name)
lamp = bpy.data.scenes['Scene'].objects[1]
lamp.location = (0,0.0,1.5)
camera = bpy.data.scenes['Scen... | 8,858 | 29.030508 | 193 | py |
inversegraphics | inversegraphics-master/diffrender_groundtruth.py | __author__ = 'pol'
import matplotlib
# matplotlib.use('Qt4Agg')
import bpy
import scene_io_utils
import mathutils
from math import radians
import timeit
import time
import opendr
import chumpy as ch
import geometry
import image_processing
import numpy as np
import cv2
from blender_utils import *
import generative_mode... | 44,438 | 44.392237 | 946 | py |
inversegraphics | inversegraphics-master/azimuth_test.py | #!/usr/bin/env python3.4m
from blender_utils import *
# bpy.ops.render.render( write_still=True )
lines = [line.strip() for line in open('teapots.txt')]
# lamp = bpy.data.scenes['Scene'].objects[1]
# lamp.location = (0,0.0,1.5)
lamp_data = bpy.data.lamps.new(name="LampTopData", type='AREA')
lamp = bpy.data.objec... | 13,769 | 36.82967 | 369 | py |
inversegraphics | inversegraphics-master/export_occlusions.py | __author__ = 'pol'
import matplotlib
matplotlib.use('Qt4Agg')
import bpy
import scene_io_utils
import mathutils
from math import radians
import timeit
import time
import opendr
import chumpy as ch
import geometry
import image_processing
import numpy as np
import cv2
from blender_utils import *
import glfw
import gener... | 14,109 | 40.378299 | 357 | py |
inversegraphics | inversegraphics-master/recognition_models.py | import matplotlib.pyplot as plt
import numpy as np
from sklearn import datasets, linear_model
from sklearn.metrics import r2_score
from collections import defaultdict
from sklearn.ensemble import RandomForestRegressor
from sklearn import mixture
import ipdb
from chumpy.ch import MatVecMult, Ch
class segmentCRFModel(C... | 5,058 | 30.03681 | 153 | py |
inversegraphics | inversegraphics-master/clean_collada.py | import pyassimp
from pyassimp.postprocess import *
modelPath = '../databaseFull/models/teapots/78ed1a0383cd2eab7552b099aebcb24e/Teapot_fixed.dae'
# aiProcessPreset_TargetRealtime_Quality = ( \
# aiProcess_CalcTangentSpace | \
# aiProcess_GenSmoothNormals | \
# aiProcess_JoinIde... | 918 | 37.291667 | 94 | py |
inversegraphics | inversegraphics-master/diffrender_opt.py | # Copyright (c) 2015, Javier Gonzalez
# Copyright (c) 2015, the GPy Authors (see GPy AUTHORS.txt)
# Licensed under the BSD 3-clause license (see LICENSE.txt)
import numpy as np
import GPyOpt
import GPy
import ipdb
from numpy.random import seed
import chumpy as ch
"""
This is a simple demo to demonstrate the use of Ba... | 8,886 | 39.031532 | 213 | py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.