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 |
|---|---|---|---|---|---|---|
mix | mix-master/fairseq/data/encoders/gpt2_bpe.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from fairseq import file_utils
from fairseq.data.encoders import register_bpe
from .gpt2_bpe_utils import get_encoder
DEFAULT_ENCODER_JSON ... | 1,637 | 31.76 | 85 | py |
mix | mix-master/fairseq/data/encoders/nltk_tokenizer.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from fairseq.data.encoders import register_tokenizer
@register_tokenizer('nltk')
class NLTKTokenizer(object):
def __init__(self, source... | 707 | 28.5 | 75 | py |
mix | mix-master/fairseq/data/encoders/hf_byte_bpe.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from fairseq.data.encoders import register_bpe
@register_bpe('hf_byte_bpe')
class HuggingFaceByteLevelBPE(object):
@staticmethod
de... | 1,499 | 30.914894 | 74 | py |
mix | mix-master/fairseq/data/encoders/fastbpe.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from fairseq import file_utils
from fairseq.data.encoders import register_bpe
@register_bpe('fastbpe')
class fastBPE(object):
@staticme... | 1,105 | 29.722222 | 81 | py |
mix | mix-master/fairseq/data/encoders/sentencepiece_bpe.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from fairseq import file_utils
from fairseq.data.encoders import register_bpe
@register_bpe('sentencepiece')
class SentencepieceBPE(object):... | 1,602 | 35.431818 | 93 | py |
mix | mix-master/fairseq/data/encoders/utils.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import torch
from fairseq.data import encoders
def get_whole_word_mask(args, dictionary):
bpe = encoders.build_bpe(args)
if bpe is n... | 907 | 30.310345 | 67 | py |
mix | mix-master/fairseq/data/encoders/gpt2_bpe_utils.py | """
Byte pair encoding utilities from GPT-2.
Original source: https://github.com/openai/gpt-2/blob/master/src/encoder.py
Original license: MIT
"""
from functools import lru_cache
import json
@lru_cache()
def bytes_to_unicode():
"""
Returns list of utf-8 byte and a corresponding list of unicode strings.
... | 4,461 | 33.859375 | 117 | py |
mix | mix-master/fairseq/data/encoders/space_tokenizer.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import re
from fairseq.data.encoders import register_tokenizer
@register_tokenizer('space')
class SpaceTokenizer(object):
def __init__... | 543 | 23.727273 | 65 | py |
mix | mix-master/fairseq/data/encoders/hf_bert_bpe.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from fairseq.data.encoders import register_bpe
@register_bpe('bert')
class BertBPE(object):
@staticmethod
def add_args(parser):
... | 1,799 | 33.615385 | 90 | py |
mix | mix-master/fairseq/data/encoders/subword_nmt_bpe.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from fairseq import file_utils
from fairseq.data.encoders import register_bpe
@register_bpe('subword_nmt')
class SubwordNMTBPE(object):
... | 1,642 | 32.530612 | 89 | py |
mix | mix-master/fairseq/data/encoders/__init__.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import importlib
import os
from fairseq import registry
build_tokenizer, register_tokenizer, TOKENIZER_REGISTRY = registry.setup_registry(... | 746 | 23.9 | 82 | py |
mix | mix-master/fairseq/data/encoders/moses_tokenizer.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from fairseq.data.encoders import register_tokenizer
@register_tokenizer('moses')
class MosesTokenizer(object):
@staticmethod
def a... | 1,938 | 37.78 | 92 | py |
mix | mix-master/fairseq/data/encoders/characters.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from fairseq.data.encoders import register_bpe
SPACE = chr(32)
SPACE_ESCAPE = chr(9601)
@register_bpe('characters')
class Characters(objec... | 680 | 21.7 | 65 | py |
mix | mix-master/fairseq/data/legacy/block_pair_dataset.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import math
import numpy as np
import torch
from fairseq.data import FairseqDataset
class BlockPairDataset(FairseqDataset):
"""Break a... | 12,878 | 40.146965 | 99 | py |
mix | mix-master/fairseq/data/legacy/masked_lm_dataset.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import math
import numpy as np
import torch
from typing import Dict, List, Tuple
from fairseq.data import FairseqDataset, data_utils
from ... | 12,468 | 37.603715 | 83 | py |
mix | mix-master/fairseq/data/legacy/masked_lm_dictionary.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from fairseq.data import Dictionary
class MaskedLMDictionary(Dictionary):
"""
Dictionary for Masked Language Modelling tasks. This e... | 1,528 | 24.915254 | 79 | py |
mix | mix-master/fairseq/data/legacy/__init__.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from .masked_lm_dictionary import BertDictionary, MaskedLMDictionary
from .block_pair_dataset import BlockPairDataset
from .masked_lm_dataset ... | 453 | 27.375 | 68 | py |
mix | mix-master/fairseq/tasks/multilingual_denoising.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import logging
import os
import numpy as np
from fairseq.data import (
data_utils,
Dictionary,
AppendTokenDataset,
ConcatDat... | 8,000 | 35.040541 | 116 | py |
mix | mix-master/fairseq/tasks/translation_from_pretrained_bart.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import torch
from fairseq.data import LanguagePairDataset
from .translation import load_langpair_dataset, TranslationTask
from . import regi... | 4,719 | 40.403509 | 109 | py |
mix | mix-master/fairseq/tasks/legacy_masked_lm.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import itertools
import logging
import os
import numpy as np
from fairseq import tokenizer
from fairseq.data import (
ConcatDataset,
... | 4,882 | 32.675862 | 103 | py |
mix | mix-master/fairseq/tasks/translation_self_distill.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from argparse import Namespace
import json
import itertools
import logging
import os
import torch
import numpy as np
from fairseq import met... | 20,267 | 42.493562 | 126 | py |
mix | mix-master/fairseq/tasks/language_modeling.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import logging
import os
import numpy as np
import torch
from fairseq import utils
from fairseq.data import (
data_utils,
Dictionary... | 10,106 | 36.712687 | 112 | py |
mix | mix-master/fairseq/tasks/masked_lm.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import logging
import os
import numpy as np
from fairseq.data import (
data_utils,
Dictionary,
IdDataset,
MaskTokensDataset,... | 7,626 | 38.112821 | 98 | py |
mix | mix-master/fairseq/tasks/translation.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from argparse import Namespace
import json
import itertools
import logging
import os
import numpy as np
from fairseq import metrics, options... | 17,187 | 42.624365 | 102 | py |
mix | mix-master/fairseq/tasks/translation_from_pretrained_xlm.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from fairseq.data.legacy.masked_lm_dictionary import MaskedLMDictionary
from fairseq.tasks.translation import TranslationTask
from . import r... | 1,106 | 33.59375 | 78 | py |
mix | mix-master/fairseq/tasks/audio_pretraining.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import os
from fairseq.data import FileAudioDataset
from . import FairseqTask, register_task
@register_task('audio_pretraining')
class Audi... | 2,111 | 34.79661 | 112 | py |
mix | mix-master/fairseq/tasks/semisupervised_translation.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from collections import OrderedDict
import logging
import os
from fairseq.data import (
BacktranslationDataset,
data_utils,
index... | 19,331 | 47.089552 | 124 | py |
mix | mix-master/fairseq/tasks/cross_lingual_lm.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from collections import OrderedDict
import itertools
import logging
import os
import numpy as np
from fairseq import tokenizer
from fairseq.... | 6,176 | 35.122807 | 100 | py |
mix | mix-master/fairseq/tasks/translation_struct.py | # Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the LICENSE file in
# the root directory of this source tree. An additional grant of patent rights
# can be found in the PATENTS file in the same directory.
import itertools
import os
import... | 10,110 | 39.606426 | 97 | py |
mix | mix-master/fairseq/tasks/multilingual_masked_lm.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import logging
import os
import numpy as np
import torch
from fairseq.data import (
data_utils,
Dictionary,
encoders,
Concat... | 12,616 | 38.676101 | 98 | py |
mix | mix-master/fairseq/tasks/denoising.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import logging
import os
from fairseq.data import (
data_utils,
Dictionary,
AppendTokenDataset,
DenoisingDataset,
Prepend... | 6,135 | 34.674419 | 91 | py |
mix | mix-master/fairseq/tasks/multilingual_translation.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from collections import OrderedDict
import logging
import os
import torch
from fairseq import metrics, options
from fairseq.data import (
... | 15,113 | 43.322581 | 116 | py |
mix | mix-master/fairseq/tasks/translation_lev.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import os
import torch
from fairseq.utils import new_arange
from fairseq.tasks import register_task
from fairseq.tasks.translation import Tr... | 6,640 | 39.993827 | 87 | py |
mix | mix-master/fairseq/tasks/__init__.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import argparse
import importlib
import os
from .fairseq_task import FairseqTask
TASK_REGISTRY = {}
TASK_CLASS_NAMES = set()
def setup_tas... | 2,555 | 29.795181 | 104 | py |
mix | mix-master/fairseq/tasks/sentence_prediction.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import logging
import os
import numpy as np
from fairseq.data import (
ConcatSentencesDataset,
data_utils,
Dictionary,
IdDat... | 8,261 | 33.569038 | 125 | py |
mix | mix-master/fairseq/tasks/fairseq_task.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import warnings
import torch
from fairseq import metrics, search, tokenizer, utils
from fairseq.data import data_utils, FairseqDataset, iter... | 15,928 | 36.21729 | 87 | py |
mix | mix-master/fairseq/tasks/sentence_ranking.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import logging
import os
import numpy as np
from fairseq.data import (
ConcatSentencesDataset,
data_utils,
Dictionary,
IdDat... | 6,410 | 31.543147 | 93 | py |
mix | mix-master/docs/conf.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# fairseq documentation build configuration file, created by
# sphinx-quickstart on Fri Aug 17 21:45:30 2018.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# au... | 4,235 | 30.849624 | 80 | py |
mix | mix-master/fairseq_cli/score.py | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""
BLEU scoring of generated translations against reference translations.
"""
import argparse
import os
import sys
fr... | 3,142 | 33.538462 | 96 | py |
mix | mix-master/fairseq_cli/generate.py | #!/usr/bin/env python3 -u
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""
Translate pre-processed data with a trained model.
"""
import logging
import math
import os
import sys
import t... | 10,264 | 37.302239 | 110 | py |
mix | mix-master/fairseq_cli/validate.py | #!/usr/bin/env python3 -u
#!/usr/bin/env python3 -u
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import logging
import sys
import torch
from fairseq import checkpoint_utils, options, ut... | 3,706 | 30.415254 | 88 | py |
mix | mix-master/fairseq_cli/eval_lm.py | #!/usr/bin/env python3 -u
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""
Evaluate the perplexity of a trained language model.
"""
import logging
import math
import os
import torch
fr... | 8,462 | 32.717131 | 112 | py |
mix | mix-master/fairseq_cli/interactive.py | #!/usr/bin/env python3 -u
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""
Translate raw text with a trained model. Batches data on-the-fly.
"""
from collections import namedtuple
import ... | 7,270 | 32.353211 | 103 | py |
mix | mix-master/fairseq_cli/__init__.py | 0 | 0 | 0 | py | |
mix | mix-master/fairseq_cli/train.py | #!/usr/bin/env python3 -u
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""
Train a new model on one or across multiple GPUs.
"""
import logging
import math
import os
import random
import ... | 11,933 | 35.054381 | 117 | py |
mix | mix-master/fairseq_cli/preprocess.py | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""
Data pre-processing: build vocabularies and binarize training data.
"""
from collections import Counter
from iterto... | 14,073 | 37.558904 | 124 | py |
IoCMiner | IoCMiner-master/main.py | import tweepy # https://github.com/tweepy/tweepy
from queue import Queue
from threading import Thread
from gglsbl import SafeBrowsingList
import requests
import shutil
from CTI_expert_finder import *
from CTI_classifer import *
import numpy
class IOCMinerStreamListener(tweepy.StreamListener):
def __init__(self,... | 8,315 | 43.234043 | 192 | py |
IoCMiner | IoCMiner-master/utility.py | import tweepy
import json
import datetime
def get_twitter_api():
with open(r'config/tweeter.auth', 'r') as auth_file:
consumer_key, consumer_secret, access_token, access_token_secret = auth_file.read().split()
# OAuth process, using the keys and tokens
auth = tweepy.OAuthHandler(consumer_k... | 3,065 | 27.654206 | 99 | py |
IoCMiner | IoCMiner-master/CTI_expert_finder.py | import os
import glob
import csv
import time
import re
import math
from utility import *
import iocextract
from dateutil.parser import parse
class Dummy(object):
pass
def get_user_lists(api, user, max_count=1000):
res = api.lists_memberships(screen_name=user, count=max_count)
# Sorting the results based o... | 19,316 | 39.412134 | 128 | py |
IoCMiner | IoCMiner-master/CTI_classifer.py | import numpy
from sklearn.model_selection import train_test_split
from sklearn import metrics
from sklearn.ensemble import RandomForestClassifier
import pandas as ps
import statistics
from nltk.tokenize import word_tokenize
from nltk.stem import WordNetLemmatizer
import nltk
number_of_classifiers = 11
nltk.download('... | 2,379 | 26.356322 | 120 | py |
IoCMiner | IoCMiner-master/construct_tweet_threads.py | import os
import glob
import json
ioc_base_dir = r'results'
class TweetInfo:
def __init__(self, tweet):
self.tweet = tweet
self.responses = []
self.reply_to = None
@staticmethod
def get_all_text(tweet):
result = ''
for response in tweet.responses:
resul... | 2,929 | 32.295455 | 123 | py |
transmatching | transmatching-main/setup.py | import setuptools
with open("README.md", "r") as fh:
long_description = fh.read()
setuptools.setup(
name="transmatching", # Replace with your own username
version="0.0.1",
author="Example Author",
author_email="author@example.com",
description="A small example package",
long_description=l... | 1,064 | 26.307692 | 59 | py |
transmatching | transmatching-main/evaluation/evaluate.py | import itertools
import json
from pathlib import Path
from typing import Dict, Optional, Sequence, Union
import hydra
import igl
import meshio
import numpy as np
import omegaconf
from matplotlib import pyplot as plt
from pytorch_lightning import seed_everything
from scipy import sparse
from scipy.sparse.csgraph import... | 11,713 | 28.959079 | 89 | py |
transmatching | transmatching-main/evaluation/print_performance.py | import json
from collections import defaultdict
from pathlib import Path
import numpy as np
from rich.console import Console
from rich.table import Table
from evaluation.utils import PROJECT_ROOT
PERF_ROOT = Path(PROJECT_ROOT / "evaluation" / "performance")
console = Console()
datasets = sorted(set(x.name for x in ... | 2,256 | 25.552941 | 87 | py |
transmatching | transmatching-main/evaluation/utils.py | import os
from pathlib import Path
from typing import Optional, Union
import dotenv
import git
import hydra
import numpy as np
import omegaconf
import torch
from hydra.core.global_hydra import GlobalHydra
from hydra.experimental import compose
from matplotlib import pyplot as plt
from plotly.graph_objs import Layout
... | 19,194 | 26.539455 | 105 | py |
transmatching | transmatching-main/evaluation/predict.py | import itertools
from typing import Dict, Union
import hydra
import meshio
import numpy as np
import omegaconf
from plotly import graph_objects as go
from pytorch_lightning import seed_everything
from tqdm import tqdm
from evaluation.competitors.eval_dataset import EvalDataset
from evaluation.utils import PROJECT_ROO... | 3,844 | 27.69403 | 85 | py |
transmatching | transmatching-main/evaluation/competitors/shape_normalization.py | import numpy as np
from transmatching.Utils.utils import est_area
from evaluation.utils import calc_tri_areas
def unit_area_normalization(points, faces):
area_A = np.sqrt(calc_tri_areas(points, faces).sum())
points = points / area_A
points -= points.mean(0)
return points
def naive_normalization(poi... | 1,900 | 24.346667 | 87 | py |
transmatching | transmatching-main/evaluation/competitors/__init__.py | 0 | 0 | 0 | py | |
transmatching | transmatching-main/evaluation/competitors/eval_dataset.py | import json
from typing import Dict
import meshio
import numpy as np
from torch.utils.data import Dataset
from evaluation.utils import PROJECT_ROOT
class EvalDataset(Dataset):
def __init__(self, dataset_name: str):
"""
A generic dataset that is able to read every dataset that follows the structu... | 2,406 | 28.353659 | 88 | py |
transmatching | transmatching-main/evaluation/competitors/eval_model.py | import abc
from typing import Dict
import numpy as np
class ModelMatching:
def __init__(self) -> None:
"""
Abstract class that defines the generic (minimal) interface all approaches must
expose:
- All approaches must have a `name` attribute
- All approaches must be... | 1,197 | 25.622222 | 88 | py |
transmatching | transmatching-main/evaluation/competitors/our/our.py | from typing import Dict
import meshio
import numpy as np
import scipy.io
import torch
from transmatching.Model.model import Model
from transmatching.Utils.refine import refine, refine_hires
from evaluation.competitors.eval_dataset import EvalDataset
from evaluation.competitors.eval_model import ModelMatching
from eva... | 9,955 | 31.75 | 143 | py |
transmatching | transmatching-main/evaluation/competitors/our/__init__.py | 0 | 0 | 0 | py | |
transmatching | transmatching-main/evaluation/competitors/our_s2t/our_s2t.py | from evaluation.competitors.eval_dataset import EvalDataset
from evaluation.competitors.our.our import OurMatching
from evaluation.utils import PROJECT_ROOT
checkpoint_file = "best_fine_tune_best_s2s"
CHECKPOINTS_ROOT = PROJECT_ROOT / "evaluation" / "competitors" / "our" / "checkpoints"
class OurMatchingS2T(OurMatc... | 790 | 26.275862 | 86 | py |
transmatching | transmatching-main/evaluation/competitors/our_s2t/__init__.py | 0 | 0 | 0 | py | |
transmatching | transmatching-main/evaluation/competitors/our_s2t_refined/our_s2t_refined.py | from evaluation.competitors.our.our import OurMatching
checkpoint_file = "best_fine_tune_best_s2s"
class OurMatchingRefinedS2T(OurMatching):
def __init__(self, device="cpu", **kwargs) -> None:
super(OurMatchingRefinedS2T, self).__init__(
checkpoint_name=checkpoint_file, refine=True, device=de... | 417 | 28.857143 | 81 | py |
transmatching | transmatching-main/evaluation/competitors/our_s2t_refined/__init__.py | 0 | 0 | 0 | py | |
transmatching | transmatching-main/evaluation/competitors/our_refined/our_refined.py | from pytorch_lightning import seed_everything
from evaluation.competitors.eval_dataset import EvalDataset
from evaluation.competitors.our.our import OurMatching
class OurMatchingRefined(OurMatching):
def __init__(self, **kwargs) -> None:
super(OurMatchingRefined, self).__init__(refine=True, **kwargs)
... | 1,691 | 28.684211 | 80 | py |
transmatching | transmatching-main/evaluation/competitors/our_refined/__init__.py | 0 | 0 | 0 | py | |
transmatching | transmatching-main/evaluation/datasets/faust_1k_s2t/generate.py | import json
from pathlib import Path
import meshio
import numpy as np
from pytorch_lightning import seed_everything
from scipy import io
from tqdm import tqdm
from evaluation.utils import PROJECT_ROOT, Mesh, plot_meshes
N_PAIRS = 100
FAUST_REM = Path(PROJECT_ROOT / "evaluation/datasets/faust_1k/FAUSTS_rem.mat")
TEMP... | 1,753 | 29.241379 | 94 | py |
transmatching | transmatching-main/evaluation/datasets/faust/generate.py | import json
from pathlib import Path
import meshio
import numpy as np
from pytorch_lightning import seed_everything
from tqdm import tqdm
FAUST_PATH = Path("/run/media/luca/LocalDisk/Datasets/MPI-FAUST/training/registrations")
assert FAUST_PATH.exists(), "Do not regenerate! Download from Drive or DVC."
N_PAIRS = 100... | 1,559 | 30.836735 | 94 | py |
transmatching | transmatching-main/evaluation/datasets/faust_1k/generate.py | import json
from pathlib import Path
import meshio
import numpy as np
from meshio import Mesh
from pytorch_lightning import seed_everything
from scipy import io
from tqdm import tqdm
from evaluation.utils import PROJECT_ROOT
N_PAIRS = 100
FAUST_REM = Path("/home/luca/Desktop/FAUSTS_rem.mat")
seed_everything(0)
sha... | 1,649 | 29 | 94 | py |
transmatching | transmatching-main/evaluation/datasets/faust_1k_outliers/generate.py | import json
from pathlib import Path
import meshio
import numpy as np
from pytorch_lightning import seed_everything
from scipy import io
from scipy.spatial.transform import Rotation as R
from tqdm import tqdm
from evaluation.utils import PROJECT_ROOT, Mesh, plot_meshes
N_PAIRS = 100
FAUST_0NOISE = Path(
PROJECT_... | 2,476 | 27.802326 | 94 | py |
transmatching | transmatching-main/evaluation/datasets/faust_1k_noise/generate.py | import json
from pathlib import Path
import meshio
import numpy as np
from meshio import Mesh
from pytorch_lightning import seed_everything
from scipy import io
from tqdm import tqdm
from evaluation.utils import PROJECT_ROOT
N_PAIRS = 100
FAUST_NOISE = Path(
PROJECT_ROOT / "evaluation/datasets/faust_1k_noise/FAU... | 1,729 | 27.833333 | 94 | py |
transmatching | transmatching-main/evaluation/datasets/faust_permuted/generate.py | import json
from pathlib import Path
import meshio
import numpy as np
from meshio import Mesh
from plotly import graph_objects as go
from pytorch_lightning import seed_everything
from tqdm import tqdm
from evaluation.utils import PROJECT_ROOT
FAUST_PATH = Path("/run/media/luca/LocalDisk/Datasets/MPI-FAUST/training/r... | 2,803 | 27.612245 | 94 | py |
transmatching | transmatching-main/evaluation/datasets/faust_s2t/generate.py | import json
from pathlib import Path
import meshio
import numpy as np
from pytorch_lightning import seed_everything
from scipy.io import loadmat
from tqdm import tqdm
from evaluation.utils import PROJECT_ROOT, Mesh, invert_permutation, plot_meshes
FAUST_PATH = Path("/run/media/luca/LocalDisk/Datasets/MPI-FAUST/train... | 1,995 | 32.266667 | 94 | py |
transmatching | transmatching-main/evaluation/datasets/shrec19/generate.py | import json
from pathlib import Path
import meshio
import numpy as np
import scipy
from meshio import Mesh
from plotly import graph_objects as go
from pytorch_lightning import seed_everything
from scipy import io
from tqdm import tqdm
from evaluation.utils import PROJECT_ROOT
seed_everything(0)
SHREC_PATH = Path(PR... | 1,681 | 29.035714 | 95 | py |
transmatching | transmatching-main/evaluation/datasets/faust_1k_0noise/generate.py | import json
from pathlib import Path
import meshio
import numpy as np
from meshio import Mesh
from pytorch_lightning import seed_everything
from scipy import io
from tqdm import tqdm
from evaluation.utils import PROJECT_ROOT
N_PAIRS = 100
FAUST_0NOISE = Path(
PROJECT_ROOT / "evaluation/datasets/faust_1k_0noise/F... | 1,733 | 27.9 | 94 | py |
transmatching | transmatching-main/evaluation/ui/generate_point_colors.py | import numpy as np
import streamlit as st
from pytorch_lightning import seed_everything
from stqdm import stqdm
from evaluation.competitors.eval_dataset import EvalDataset
from evaluation.utils import (
PROJECT_ROOT,
Mesh,
convert_colors,
get_dists,
get_hydra_cfg,
get_point_colors,
plot_mes... | 3,605 | 24.394366 | 90 | py |
transmatching | transmatching-main/transmatching/__init__.py | 0 | 0 | 0 | py | |
transmatching | transmatching-main/transmatching/Data/dataset_faust.py | import numpy as np
import os
import torch
import trimesh
from torch.utils.data import Dataset
from scipy.io import loadmat
from transmatching.Utils.utils import RandomRotateCustom, est_area
class FaustDataset(Dataset):
def __init__(self, in_path, area=True):
self.in_path = in_path
self.area = are... | 1,705 | 31.188679 | 141 | py |
transmatching | transmatching-main/transmatching/Data/__init__.py | 0 | 0 | 0 | py | |
transmatching | transmatching-main/transmatching/Data/dataset_smpl.py | import numpy as np
import os
import torch
import trimesh
from torch.utils.data import Dataset
from transmatching.Utils.utils import RandomRotateCustom, est_area
class SMPLDataset(Dataset):
def __init__(self, in_path, train=True, area=True):
self.in_path = in_path
self.train = train
self... | 1,668 | 31.72549 | 111 | py |
transmatching | transmatching-main/transmatching/Model/feedforward.py | from torch import nn
import torch.nn.functional as F
class FeedForward(nn.Module):
def __init__(self, d_model, d_ff=32, dropout=0.05):
super().__init__()
self.linear_1 = nn.Linear(d_model, d_ff)
self.dropout = nn.Dropout(dropout)
self.linear_2 = nn.Linear(d_ff, d_model)
def f... | 435 | 23.222222 | 55 | py |
transmatching | transmatching-main/transmatching/Model/norm.py | import torch
from torch import nn
class Norm(nn.Module):
def __init__(self, d_model, eps=1e-06):
super().__init__()
self.size = d_model
self.alpha = nn.Parameter(torch.ones(self.size))
self.bias = nn.Parameter(torch.zeros(self.size))
self.eps = eps
def forward(self, x... | 467 | 23.631579 | 121 | py |
transmatching | transmatching-main/transmatching/Model/layernorm.py | from torch import nn
class AddNorm(nn.Module):
def __init__(self, normalized_shape, dropout):
super().__init__()
self.dropout = nn.Dropout(dropout)
self.ln = nn.LayerNorm(normalized_shape)
def forward(self, X, Y):
return self.ln(self.dropout(Y) + X)
| 296 | 18.8 | 50 | py |
transmatching | transmatching-main/transmatching/Model/model.py | import torch
from torch import nn
from transmatching.Model.decoder import Decoder
from transmatching.Model.encoder import Encoder
from transmatching.Model.attention import MultiHeadAttention
from transmatching.Model.feedforward import FeedForward
from transmatching.Model.layernorm import AddNorm
from transmatching.Mo... | 2,138 | 37.890909 | 133 | py |
transmatching | transmatching-main/transmatching/Model/encoder.py | from torch import nn
from transmatching.Model.attention import MultiHeadAttention
from transmatching.Model.feedforward import FeedForward
from transmatching.Model.layernorm import AddNorm
from transmatching.Model.norm import Norm
from transmatching.Model.pos_enc import PositionalEncoderLearnt
import torch
from transmat... | 2,357 | 35.84375 | 119 | py |
transmatching | transmatching-main/transmatching/Model/decoder.py | import torch
from torch import nn
from transmatching.Model.attention import MultiHeadAttention
from transmatching.Model.feedforward import FeedForward
from transmatching.Model.layernorm import AddNorm
from transmatching.Model.norm import Norm
from transmatching.Model.pos_enc import PositionalEncoderLearnt
from transmat... | 2,412 | 35.014925 | 99 | py |
transmatching | transmatching-main/transmatching/Model/__init__.py | 0 | 0 | 0 | py | |
transmatching | transmatching-main/transmatching/Model/attention.py | import math
import torch
from torch import nn
import torch.nn.functional as F
from transmatching.Model.debug import Debug
try:
from pykeops.torch import LazyTensor
except ImportError:
Debug.keops=False
def attention(q, k, v, d_k, mask=None, dropout=None, weights=None, w=1):
if Debug.keops:
bs = ... | 2,928 | 28.887755 | 127 | py |
transmatching | transmatching-main/transmatching/Model/debug.py | class Debug:
debug=False | 28 | 13.5 | 15 | py |
transmatching | transmatching-main/transmatching/Model/pos_enc.py | import torch
from torch import nn
class PositionalEncoderLearnt(nn.Module):
def __init__(self, d_model, max_seq_len):
super().__init__()
self.pos = nn.Parameter(torch.zeros(max_seq_len, d_model))
def forward(self, x):
seq_len = x.size(-2)
x = x + self.pos[:seq_len]
re... | 328 | 19.5625 | 66 | py |
transmatching | transmatching-main/transmatching/Utils/refine.py | import torch
# from transmatching.Model.model import Model
import matplotlib.pyplot as plt
import time
import gc
from transmatching.Utils.utils import get_clones, est_area, chamfer_loss
from transmatching.Model.debug import Debug
def chamfer(y_hat,src):
dist = torch.cdist(y_hat,src)
loss = dist.min(-2)[0].mea... | 7,206 | 31.463964 | 88 | py |
transmatching | transmatching-main/transmatching/Utils/utils.py | import igl
import torch
import matplotlib.pyplot as plt
import plotly.graph_objects as go
import numpy as np
from plotly.subplots import make_subplots
from torch import nn
import copy
from transmatching.Model.debug import Debug
from scipy import sparse
from scipy.sparse.csgraph import dijkstra
from scipy.spatial.distan... | 7,124 | 27.846154 | 120 | py |
transmatching | transmatching-main/transmatching/Utils/__init__.py | 0 | 0 | 0 | py | |
transmatching | transmatching-main/test/test.py | import torch
from tqdm import tqdm
from transmatching.Model.model import Model
from argparse import ArgumentParser
from transmatching.Utils.utils import get_errors, area_weighted_normalization, chamfer_loss, approximate_geodesic_distances
import numpy as np
from pytorch_lightning import seed_everything
from scipy.io im... | 3,814 | 29.766129 | 123 | py |
transmatching | transmatching-main/test/train.py | import os
import time
import torch
from torch.utils.data import DataLoader
from tqdm import tqdm
from transmatching.Data.dataset_smpl import SMPLDataset
from transmatching.Model.model import Model
from argparse import ArgumentParser
def main(args):
# ------------------------------------------------------------------... | 4,167 | 31.310078 | 120 | py |
Proper-Learning-of-LDS | Proper-Learning-of-LDS-master/ncpop/ncpop300_higherdim.py | import sys
#sys.path.append("/home/zhouqua1")
sys.path.append("/home/zhouqua1/NCPOP")
from inputlds import*
from functions import*
from ncpol2sdpa import*
import numpy as np
import pandas as pd
from math import sqrt
from scipy.stats import unitary_group
# Set parameters
repeat=30
T=30
level=1
proc_noise_std=0.5
obs_... | 1,354 | 29.795455 | 94 | py |
Proper-Learning-of-LDS | Proper-Learning-of-LDS-master/ncpop/ncpop300_higherorder.py | import sys
#sys.path.append("/home/zhouqua1")
sys.path.append("/home/zhouqua1/NCPOP")
from inputlds import*
from functions import*
from ncpol2sdpa import*
import numpy as np
import pandas as pd
from math import sqrt
# Set parameters
start=0.1
stop=1.0
step=0.1
repeat=30
T=20
level=1
# Collect the nrmse value for ea... | 1,230 | 26.355556 | 95 | py |
Proper-Learning-of-LDS | Proper-Learning-of-LDS-master/ncpop/inputlds.py | # -*- coding: utf-8 -*-
# Copyright 2019 IBM.
#
# 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 agre... | 10,927 | 34.596091 | 138 | py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.