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
cymetric
cymetric-main/cymetric/__init__.py
0
0
0
py
cymetric
cymetric-main/cymetric/pointgen/pointgen_toric.py
""" ToricPointGenerator module. :Authors: Fabian Ruehle <fabian.ruehle@cern.ch> and Robin Schneider <robin.schneider@physics.uu.se> """ import numpy as np import logging import sympy as sp import scipy.optimize as opt from joblib import Parallel, delayed import random from cymetric.pointgen.nphelper import pr...
20,677
43.952174
178
py
cymetric
cymetric-main/cymetric/pointgen/nphelper.py
""" A collection of various numpy helper functions. """ import os as os import numpy as np import pickle import itertools as it from sympy import LeviCivita def get_levicivita_tensor(dim): r"""Computes Levi-Civita tensor in dim dimensions. Conventions are zero for same indices, 1 for even permutations a...
10,651
36.507042
122
py
cymetric
cymetric-main/cymetric/pointgen/pointgen_cicy.py
""" CICY PointGenerator. :Authors: Fabian Ruehle <fabian.ruehle@cern.ch> and Robin Schneider <robin.schneider@physics.uu.se> """ import numpy as np import logging import sympy as sp from sympy.geometry.util import idiff import scipy.optimize as opt from joblib import Parallel, delayed from cymetric.pointgen....
27,534
43.197432
126
py
cymetric
cymetric-main/cymetric/pointgen/pointgen.py
""" Main PointGenerator module. :Authors: Fabian Ruehle <fabian.ruehle@cern.ch> and Robin Schneider <robin.schneider@physics.uu.se> """ import numpy as np import logging import sympy as sp from cymetric.pointgen.nphelper import prepare_basis_pickle, prepare_dataset, get_levicivita_tensor from sympy.geometry.u...
58,913
40.026462
149
py
cymetric
cymetric-main/cymetric/pointgen/pointgen_mathematica.py
""" Class to call Mathematica point generator. Authors ------- Fabian Ruehle fabian.ruehle@cern.ch Robin Schneider robin.schneider@physics.uu.se """ import os import pickle import numpy as np import sympy as sp import decimal import re from wolframclient.evaluation import WolframLanguageSession from wolframclient.la...
20,128
47.975669
314
py
cymetric
cymetric-main/cymetric/pointgen/__init__.py
0
0
0
py
cymetric
cymetric-main/cymetric/sage/__init__.py
0
0
0
py
cymetric
cymetric-main/cymetric/sage/sagelib.py
# tested with Sage 9.x from sage.all import * import itertools import numpy as np import os import pickle def to_patch(fan, patch_index): # given a fan and a desired patch_index = 0, 1, ..., number(dual_cones), returns the exponents of the homogeneous coordinates in that patch such that the product of the hom coo...
9,082
43.307317
243
py
cymetric
cymetric-main/cymetric/models/tfmodels.py
""" A selection of custom tensorflow models for learning Calabi-Yau metrics using neural networks. """ import tensorflow as tf from cymetric.models.losses import sigma_loss from cymetric.models.fubinistudy import FSModel from cymetric.pointgen.nphelper import get_all_patch_degrees, compute_all_w_of_x, get_levicivita_...
50,954
41.783375
236
py
cymetric
cymetric-main/cymetric/models/losses.py
""" Sigma loss function in tensorflow. """ import tensorflow as tf def sigma_loss(kappa=1., nfold=3., flat=False): r"""MA loss. Args: kappa (float): inverse volume of the CY given by weights. Defaults to 1. nfold (float): dimension of the CY. Defaults to 3. flat (bool): True if metric...
2,940
34.433735
83
py
cymetric
cymetric-main/cymetric/models/callbacks.py
""" A collection of tensorflow callbacks. """ import tensorflow as tf import numpy as np from cymetric.models.measures import ricci_measure, sigma_measure, \ kaehler_measure_loss, transition_measure_loss, ricci_scalar_fn tfk = tf.keras sigma_measure_tf = tf.function(func=sigma_measure) kaehler_measure_tf = tf.fun...
14,605
38.158177
94
py
cymetric
cymetric-main/cymetric/models/fubinistudy.py
""" Pullbacked fubini study metric implemented as a tfk.model. """ import tensorflow as tf import itertools as it from cymetric.pointgen.nphelper import generate_monomials, get_levicivita_tensor import numpy as np tfk = tf.keras class FSModel(tfk.Model): r"""FSModel implements all underlying tensorflow routines ...
37,282
44.027778
175
py
cymetric
cymetric-main/cymetric/models/tfhelper.py
""" A collection of various helper functions. """ import tensorflow as tf def prepare_tf_basis(basis, dtype=tf.complex64): r"""Casts each entry in Basis to dtype. Args: basis (dict): dictionary containing geometric information dtype (_type_, optional): type to cast to. Defaults to tf.complex...
4,556
40.807339
82
py
cymetric
cymetric-main/cymetric/models/measures.py
""" Various error measures for neural nets representing (ricci flat) kaehler metrics. """ import tensorflow as tf import sys def sigma_measure(model, points, y_true): r"""We compute the Monge Ampere equation .. math:: \sigma = 1 / (\text{Vol}_\text{cy} n_p) \sum_i |1 - (\det(g) \text{Vol}_\text{cy...
7,500
36.693467
126
py
cymetric
cymetric-main/cymetric/models/metrics.py
""" A bunch of custom metrics for the custom model. Need to be declared separately otherwise .fit throws an error, since they only take the loss values and not y_pred, y_true as arguments. """ import tensorflow as tf tfk = tf.keras class SigmaLoss(tfk.metrics.Metric): def __init__(self, name='sigma_loss', **kwa...
6,649
32.585859
89
py
cymetric
cymetric-main/cymetric/models/__init__.py
0
0
0
py
cymetric
cymetric-main/cymetric/potential/donaldson.py
""" Implementation of the Donaldson algorithm using numpy. """ import numpy as np from joblib import Parallel, delayed from cymetric.pointgen.nphelper import generate_monomials from cymetric.models.fubinistudy import FSModel import os as os from scipy.special import factorial import sympy as sp from sympy.geometry.uti...
29,386
44.702955
149
py
cymetric
cymetric-main/cymetric/potential/__init__.py
0
0
0
py
cymetric
cymetric-main/cymetric/wolfram/mathematicalib.py
import numpy as np import sys import os import re import logging import pickle logging.basicConfig(stream=sys.stdout) mcy_logger = logging.getLogger('mathematica') from cymetric.pointgen.pointgen_mathematica import PointGeneratorMathematica, ToricPointGeneratorMathematica from cymetric.pointgen.nphelper import prepare...
15,916
38.7925
267
py
cymetric
cymetric-main/cymetric/wolfram/__init__.py
0
0
0
py
cymetric
cymetric-main/cymetric/bundle/hym_helper.py
import numpy as np # ML packages import tensorflow as tf from cymetric.pointgen.nphelper import generate_monomials print("The HYM helper can help you with finding a solution to the HYM equation.\ They have not been thoroughly tested and documented yet. Procceed on your \ own risk.") @tf.function def function...
4,369
40.226415
80
py
cymetric
cymetric-main/cymetric/bundle/__init__.py
0
0
0
py
cymetric
cymetric-main/docs/source/conf.py
# Configuration file for the Sphinx documentation builder. # # This file only contains a selection of the most common options. For a full # list see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html # -- Path setup -------------------------------------------------------------- # If ex...
2,791
34.794872
84
py
PnP-CASSI
PnP-CASSI-main/main.py
import os import time import math import h5py import numpy as np import scipy.io as sio import matplotlib.pyplot as plt from statistics import mean from numpy import * from dvp_linear_inv_cassi import (gap_denoise, admm_denoise, GAP_TV_rec, ADMM_TV_rec) from utils import (A, At, psnr,shift,s...
3,582
38.811111
78
py
PnP-CASSI
PnP-CASSI-main/utils.py
''' Utilities ''' import math import numpy as np import scipy.io as sio import cv2 def TV_denoiser(x, _lambda, n_iter_max): dt = 0.25 N = x.shape idx = np.arange(1,N[0]+1) idx[-1] = N[0]-1 iux = np.arange(-1,N[0]-1) iux[0] = 0 ir = np.arange(1,N[1]+1) ir[-1] = N[1]-1 il = np.arange(-...
3,921
30.126984
89
py
PnP-CASSI
PnP-CASSI-main/dvp_linear_inv_cassi.py
import time import math import numpy as np from skimage.restoration import (denoise_tv_chambolle, denoise_bilateral, denoise_wavelet, estimate_sigma) from skimage.measure import (compare_psnr, compare_ssim) from utils import (A, At, psnr, shift, shift_back,calculate_ssim,TV_denoiser) # ...
22,862
48.702174
261
py
PnP-CASSI
PnP-CASSI-main/hsi.py
import numpy as np import torch.nn as nn import torch import torch.utils.data as data from torch.optim import Adam from torch.optim import lr_scheduler from collections import OrderedDict import os import math from torch.utils.data import DataLoader import random from torch.optim import Adam def pixel_unshuffle(input,...
2,852
31.793103
138
py
multihop_dense_retrieval
multihop_dense_retrieval-main/setup.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. from setuptools import setup, find_packages import sys import subprocess with open('README.md') as f...
774
24
87
py
multihop_dense_retrieval
multihop_dense_retrieval-main/scripts/train_momentum.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 logging import os import random from datetime import date from functools import partial import numpy as np import t...
10,671
44.220339
236
py
multihop_dense_retrieval
multihop_dense_retrieval-main/scripts/encode_corpus.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. """ Description: encode text corpus into a store of dense vectors. Usage (adjust the batch size according to your GPU me...
3,707
30.423729
127
py
multihop_dense_retrieval
multihop_dense_retrieval-main/scripts/end2end.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. """ Efficient end2end QA with HNSW index taskset --cpu-list 0-15 python end2end.py ../data/hotpot/ho...
8,165
44.116022
251
py
multihop_dense_retrieval
multihop_dense_retrieval-main/scripts/train_mhop.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. """ Description: train a multi-hop dense retrieval from pretrained BERT/RoBERTa encoder Usage: CUDA_VISIBLE_DEVICES=0,1...
10,731
41.086275
269
py
multihop_dense_retrieval
multihop_dense_retrieval-main/scripts/demo.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 streamlit as st import torch import os import numpy as np from apex import amp import faiss import json import argpa...
7,262
40.741379
192
py
multihop_dense_retrieval
multihop_dense_retrieval-main/scripts/train_qa.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 collections import json import logging import os import random from datetime import date from functools import parti...
21,946
44.251546
242
py
multihop_dense_retrieval
multihop_dense_retrieval-main/scripts/eval/eval_mhop_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. """ Evaluating trained retrieval model. Usage: python eval_mhop_retrieval.py ${EVAL_DATA} ${CORPUS_VECTOR_PATH} ${CORPUS_D...
12,631
43.322807
159
py
multihop_dense_retrieval
multihop_dense_retrieval-main/scripts/eval/eval_mhop_fever.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. """ python eval_mhop_fever.py /private/home/xwhan/data/fever/retrieval/dev_multi_evidence.txt index/fever.npy index/fever_c...
8,812
49.073864
402
py
multihop_dense_retrieval
multihop_dense_retrieval-main/scripts/eval/eval_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. """ Single-hop retrieval evaluation ## Use the unified model (trained with both hotpotQA and NQ) python eval_retrieval.p...
9,540
44.650718
401
py
multihop_dense_retrieval
multihop_dense_retrieval-main/scripts/eval/eval_single_fever.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. """ python eval_single_fever.py /private/home/xwhan/data/fever/retrieval/dev_single_evidence.txt index/fever_single.npy ind...
5,252
41.707317
378
py
multihop_dense_retrieval
multihop_dense_retrieval-main/scripts/eval/eval_reranked.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 json import numpy as np from utils.utils import para_has_answer, normalize from utils.basic_tokenizer import SimpleT...
2,099
30.343284
130
py
multihop_dense_retrieval
multihop_dense_retrieval-main/submitit/submitit_train.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 numpy as np import uuid import itertools from typing import Dict import submitit from collections import I...
4,031
35.654545
98
py
multihop_dense_retrieval
multihop_dense_retrieval-main/submitit/submitit_train_qa.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 numpy as np import uuid import itertools from typing import Dict import submitit from collections import I...
4,658
37.825
98
py
multihop_dense_retrieval
multihop_dense_retrieval-main/mdr/__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. from . import qa from . import retrieval
239
25.666667
62
py
multihop_dense_retrieval
multihop_dense_retrieval-main/mdr/qa/train_ranker.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 collections import json import logging import os import random from datetime import date from functools import parti...
10,232
41.995798
170
py
multihop_dense_retrieval
multihop_dense_retrieval-main/mdr/qa/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 import sqlite3 import unicodedata import collections import logging import re def set_global_logging_level(le...
13,636
33.350126
129
py
multihop_dense_retrieval
multihop_dense_retrieval-main/mdr/qa/data_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 json from tqdm import tqdm import numpy as np def explore(path): train = json.load(open(path)) neg_counts...
865
29.928571
83
py
multihop_dense_retrieval
multihop_dense_retrieval-main/mdr/qa/config.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 argparse from ast import parse from typing import NamedTuple from torch.nn import parallel class ClusterConfig(Nam...
4,948
54.606742
115
py
multihop_dense_retrieval
multihop_dense_retrieval-main/mdr/qa/basic_tokenizer.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. #!/usr/bin/env python3 # Copyright 2017-present, Facebook, Inc. # All rights reserved. # # This source code is licensed und...
9,125
31.709677
80
py
multihop_dense_retrieval
multihop_dense_retrieval-main/mdr/qa/qa_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. import collections import json import random import torch from torch.utils.data import Dataset, Sampler from tqdm import t...
18,839
39.603448
179
py
multihop_dense_retrieval
multihop_dense_retrieval-main/mdr/qa/qa_model.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 transformers import AutoModel, BertModel import torch.nn as nn from torch.nn import CrossEntropyLoss import torch imp...
4,377
38.8
139
py
multihop_dense_retrieval
multihop_dense_retrieval-main/mdr/qa/__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.
199
24
62
py
multihop_dense_retrieval
multihop_dense_retrieval-main/mdr/qa/qa_trainer.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 argparse import json import os import os.path as osp import random from functools import partial from pathlib import...
19,844
46.589928
193
py
multihop_dense_retrieval
multihop_dense_retrieval-main/mdr/qa/hotpot_evaluate_v1.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 sys import ujson as json import re import string from collections import Counter import pickle def normalize_answer...
4,454
31.757353
113
py
multihop_dense_retrieval
multihop_dense_retrieval-main/mdr/retrieval/decomposed_analysis.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 json def decomposed_errors(): top1_pred = [json.loads(l) for l in open("/private/home/xwhan/data/hotpot/dense_...
5,525
32.695122
116
py
multihop_dense_retrieval
multihop_dense_retrieval-main/mdr/retrieval/interactive_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. from models.mhop_retriever import MhopRetriever import faiss import numpy as np import torch from tqdm import tqdm from t...
2,527
36.731343
155
py
multihop_dense_retrieval
multihop_dense_retrieval-main/mdr/retrieval/mhop_trainer.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. """ submitit trainer for hyperparameter tuning """ import os import os.path as osp from typing import Optional, NamedTupl...
12,533
41.778157
190
py
multihop_dense_retrieval
multihop_dense_retrieval-main/mdr/retrieval/criterions.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.nn import CrossEntropyLoss import torch.nn.functional as F # def loss_single(model, batch, momentu...
11,894
46.390438
185
py
multihop_dense_retrieval
multihop_dense_retrieval-main/mdr/retrieval/train_single.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. """ # DPR baseline shared encoder CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7 python train_single.py \ --do_train \ --pre...
13,227
38.369048
182
py
multihop_dense_retrieval
multihop_dense_retrieval-main/mdr/retrieval/config.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 argparse from ast import parse from typing import NamedTuple class ClusterConfig(NamedTuple): dist_backend: str...
5,934
51.522124
123
py
multihop_dense_retrieval
multihop_dense_retrieval-main/mdr/retrieval/single_trainer.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. """ trainer defined for submitit hyperparameter tuning """ import os import os.path as osp from typing import Optional, ...
13,371
41.050314
150
py
multihop_dense_retrieval
multihop_dense_retrieval-main/mdr/retrieval/__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. #!/usr/bin/env python # Copyright 2017-present, Facebook, Inc. # All rights reserved. # # This source code is licensed unde...
466
28.1875
62
py
multihop_dense_retrieval
multihop_dense_retrieval-main/mdr/retrieval/models/retriever.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. """ single hop retrieval models """ from transformers import AutoModel import torch.nn as nn import torch class BertRetri...
7,436
38.142105
178
py
multihop_dense_retrieval
multihop_dense_retrieval-main/mdr/retrieval/models/unified_retriever.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 transformers import AutoModel import torch.nn as nn import torch class UnifiedRetriever(nn.Module): def __init__...
8,004
41.807487
152
py
multihop_dense_retrieval
multihop_dense_retrieval-main/mdr/retrieval/models/hop1_retriever.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 transformers import BertModel, BertConfig, BertPreTrainedModel import torch.nn as nn import torch from torch.nn.parame...
1,496
35.512195
109
py
multihop_dense_retrieval
multihop_dense_retrieval-main/mdr/retrieval/models/mhop_retriever.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 torch import embedding from transformers import AutoModel import torch.nn as nn import torch class RobertaRetriever(...
4,975
36.69697
148
py
multihop_dense_retrieval
multihop_dense_retrieval-main/mdr/retrieval/utils/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 import sqlite3 import unicodedata def load_saved(model, path, exact=True): try: state_dict = torc...
5,278
29.871345
137
py
multihop_dense_retrieval
multihop_dense_retrieval-main/mdr/retrieval/utils/gen_index_id_map.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 json mapping = {} with open('../data/para_doc.db') as f_in: for idx, line in enumerate(f_in): sample = ...
463
28
62
py
multihop_dense_retrieval
multihop_dense_retrieval-main/mdr/retrieval/utils/basic_tokenizer.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. #!/usr/bin/env python3 # Copyright 2017-present, Facebook, Inc. # All rights reserved. # # This source code is licensed und...
11,487
33.190476
80
py
multihop_dense_retrieval
multihop_dense_retrieval-main/mdr/retrieval/utils/tokenizer.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. # coding=utf-8 # Copyright 2018 The Google AI Language Team Authors. # # Licensed under the Apache License, Version 2.0 (th...
5,510
28.629032
79
py
multihop_dense_retrieval
multihop_dense_retrieval-main/mdr/retrieval/utils/mhop_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 sys import json from tqdm import tqdm import collections import re from collections import Counter import string fro...
11,200
40.794776
243
py
multihop_dense_retrieval
multihop_dense_retrieval-main/mdr/retrieval/data/unified_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 torch.utils.data import Dataset, Sampler import torch import json import random from .data_utils import collate_token...
16,160
41.528947
184
py
multihop_dense_retrieval
multihop_dense_retrieval-main/mdr/retrieval/data/encode_datasets.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 csv import json import pdb import numpy as np from torch.utils.data import Dataset from tqdm import tqdm import code...
3,991
33.713043
163
py
multihop_dense_retrieval
multihop_dense_retrieval-main/mdr/retrieval/data/mhop_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 torch.utils.data import Dataset import json import random from .data_utils import collate_tokens class MhopDataset(D...
5,278
42.270492
146
py
multihop_dense_retrieval
multihop_dense_retrieval-main/mdr/retrieval/data/data_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 collections import pdb import re import string def collate_tokens(values, pad_idx, eos_idx=None, left_pad=False, mo...
9,089
37.033473
132
py
multihop_dense_retrieval
multihop_dense_retrieval-main/mdr/retrieval/data/__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.
198
27.428571
62
py
multihop_dense_retrieval
multihop_dense_retrieval-main/mdr/retrieval/data/fever_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 torch import normal from torch.utils.data import Dataset import torch import json import random import unicodedata imp...
2,992
33.802326
146
py
multihop_dense_retrieval
multihop_dense_retrieval-main/mdr/retrieval/data/sp_datasets.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. """ Dataset classes for NQ expeirments """ from torch.utils.data import Dataset import json import random from .data_utils...
13,614
37.678977
157
py
flaxformer
flaxformer-main/setup.py
# Copyright 2023 Google LLC. # # 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,963
29.215385
74
py
flaxformer
flaxformer-main/flaxformer/activation_partitioning_test.py
# Copyright 2023 Google LLC. # # 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,816
35.115385
80
py
flaxformer
flaxformer-main/flaxformer/param_conversion_util.py
# Copyright 2023 Google LLC. # # 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,812
35.064103
80
py
flaxformer
flaxformer-main/flaxformer/testing_utils_test.py
# Copyright 2023 Google LLC. # # 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,132
26.346154
79
py
flaxformer
flaxformer-main/flaxformer/testing_utils.py
# Copyright 2023 Google LLC. # # 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, ...
7,432
33.253456
111
py
flaxformer
flaxformer-main/flaxformer/activation_partitioning.py
# Copyright 2023 Google LLC. # # 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, ...
7,241
43.158537
129
py
flaxformer
flaxformer-main/flaxformer/transformer_common.py
# Copyright 2023 Google LLC. # # 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, ...
5,500
40.674242
103
py
flaxformer
flaxformer-main/flaxformer/types.py
# Copyright 2023 Google LLC. # # 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, ...
986
30.83871
74
py
flaxformer
flaxformer-main/flaxformer/sharding.py
# Copyright 2023 Google LLC. # # 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,440
30.94964
80
py
flaxformer
flaxformer-main/flaxformer/sharding_test.py
# Copyright 2023 Google LLC. # # 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, ...
3,844
28.351145
78
py
flaxformer
flaxformer-main/flaxformer/__init__.py
0
0
0
py
flaxformer
flaxformer-main/flaxformer/transformer_common_test.py
# Copyright 2023 Google LLC. # # 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, ...
5,809
35.540881
80
py
flaxformer
flaxformer-main/flaxformer/architectures/__init__.py
0
0
0
py
flaxformer
flaxformer-main/flaxformer/architectures/dual_encoder/components_test.py
# Copyright 2023 Google LLC. # # 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,429
31.5
76
py
flaxformer
flaxformer-main/flaxformer/architectures/dual_encoder/dual_encoder_architecture_test.py
# Copyright 2023 Google LLC. # # 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, ...
13,011
32.278772
105
py
flaxformer
flaxformer-main/flaxformer/architectures/dual_encoder/l2_norm_test.py
# Copyright 2023 Google LLC. # # 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,333
31.536585
74
py
flaxformer
flaxformer-main/flaxformer/architectures/dual_encoder/poolings_test.py
# Copyright 2023 Google LLC. # # 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,504
30.725352
80
py
flaxformer
flaxformer-main/flaxformer/architectures/dual_encoder/dual_encoder_architecture.py
# Copyright 2023 Google LLC. # # 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, ...
10,154
35.397849
93
py
flaxformer
flaxformer-main/flaxformer/architectures/dual_encoder/similarity_functions.py
# Copyright 2023 Google LLC. # # 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, ...
18,034
37.618844
105
py
flaxformer
flaxformer-main/flaxformer/architectures/dual_encoder/components.py
# Copyright 2023 Google LLC. # # 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,925
32.206897
78
py
flaxformer
flaxformer-main/flaxformer/architectures/dual_encoder/single_tower_logit_functions_test.py
# Copyright 2023 Google LLC. # # 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,483
34.333333
78
py
flaxformer
flaxformer-main/flaxformer/architectures/dual_encoder/similarity_functions_test.py
# Copyright 2023 Google LLC. # # 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, ...
7,770
33.847534
80
py
flaxformer
flaxformer-main/flaxformer/architectures/dual_encoder/poolings.py
# Copyright 2023 Google LLC. # # 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, ...
12,448
33.969101
105
py