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 |
|---|---|---|---|---|---|---|
CLUE | CLUE-master/baselines/models_pytorch/classifier_pytorch/transformers/modeling_openai.py | # coding=utf-8
# Copyright 2018 The OpenAI Team Authors and HuggingFace Inc. team.
# Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License... | 30,836 | 48.57717 | 148 | py |
CLUE | CLUE-master/baselines/models_pytorch/classifier_pytorch/transformers/configuration_auto.py | # coding=utf-8
# Copyright 2018 The HuggingFace Inc. team.
#
# 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... | 8,111 | 57.782609 | 296 | py |
CLUE | CLUE-master/baselines/models_pytorch/classifier_pytorch/transformers/tokenization_bert.py | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team.
#
# 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/LICEN... | 22,451 | 43.636183 | 183 | py |
CLUE | CLUE-master/baselines/models_pytorch/classifier_pytorch/transformers/configuration_ctrl.py | # coding=utf-8
# Copyright 2018 Salesforce and HuggingFace Inc. team.
# Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# htt... | 5,775 | 39.111111 | 120 | py |
CLUE | CLUE-master/baselines/models_pytorch/classifier_pytorch/transformers/modeling_auto.py | # coding=utf-8
# Copyright 2018 The HuggingFace Inc. team.
#
# 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... | 36,985 | 72.384921 | 472 | py |
CLUE | CLUE-master/baselines/models_pytorch/classifier_pytorch/transformers/tokenization_xlnet.py | # coding=utf-8
# Copyright 2018 Google AI, Google Brain and Carnegie Mellon University Authors and the HuggingFace Inc. team.
#
# 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://ww... | 10,317 | 39.622047 | 125 | py |
CLUE | CLUE-master/baselines/models_pytorch/classifier_pytorch/transformers/tokenization_distilbert.py | # coding=utf-8
# Copyright 2018 The HuggingFace Inc. team.
#
# 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... | 2,438 | 37.714286 | 144 | py |
CLUE | CLUE-master/baselines/models_pytorch/classifier_pytorch/transformers/configuration_transfo_xl.py | # coding=utf-8
# Copyright 2018 Google AI, Google Brain and Carnegie Mellon University Authors and the HuggingFace Inc. team.
# Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the Lice... | 6,819 | 39.35503 | 125 | py |
CLUE | CLUE-master/baselines/models_pytorch/classifier_pytorch/transformers/file_utils.py | """
Utilities for working with the local dataset cache.
This file is adapted from the AllenNLP library at https://github.com/allenai/allennlp
Copyright by the AllenNLP authors.
"""
from __future__ import (absolute_import, division, print_function, unicode_literals)
import sys
import json
import logging
import os
impor... | 11,622 | 34.763077 | 144 | py |
CLUE | CLUE-master/baselines/models_pytorch/classifier_pytorch/transformers/__init__.py | __version__ = "2.1.1"
# Work around to update TensorFlow's absl.logging threshold which alters the
# default Python logging output behavior when present.
# see: https://github.com/abseil/abseil-py/issues/99
# and: https://github.com/tensorflow/tensorflow/issues/26691#issuecomment-500369493
try:
import absl.logging... | 5,761 | 58.402062 | 109 | py |
CLUE | CLUE-master/baselines/models_pytorch/classifier_pytorch/transformers/configuration_gpt2.py | # coding=utf-8
# Copyright 2018 The OpenAI Team Authors and HuggingFace Inc. team.
# Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License... | 6,053 | 40.751724 | 131 | py |
CLUE | CLUE-master/baselines/models_pytorch/classifier_pytorch/transformers/tokenization_gpt2.py | # coding=utf-8
# Copyright 2018 The Open AI Team Authors and The HuggingFace Inc. team.
#
# 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,802 | 40.893162 | 182 | py |
CLUE | CLUE-master/baselines/models_pytorch/classifier_pytorch/transformers/configuration_roberta.py | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team.
# Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a cop... | 1,415 | 38.333333 | 111 | py |
CLUE | CLUE-master/baselines/models_pytorch/classifier_pytorch/transformers/configuration_openai.py | # coding=utf-8
# Copyright 2018 The OpenAI Team Authors and HuggingFace Inc. team.
# Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License... | 5,100 | 36.785185 | 121 | py |
CLUE | CLUE-master/baselines/models_pytorch/classifier_pytorch/transformers/modeling_transfo_xl.py | # coding=utf-8
# Copyright 2018 Google AI, Google Brain and Carnegie Mellon University Authors and the HuggingFace Inc. team.
# Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the Lice... | 39,657 | 43.50954 | 157 | py |
CLUE | CLUE-master/baselines/models_pytorch/classifier_pytorch/transformers/modeling_albert.py | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team.
# Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a cop... | 54,163 | 49.810507 | 153 | py |
CLUE | CLUE-master/baselines/models_pytorch/classifier_pytorch/transformers/modeling_xlnet.py | # coding=utf-8
# Copyright 2018 Google AI, Google Brain and Carnegie Mellon University Authors and the HuggingFace Inc. team.
# Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the Lice... | 72,560 | 52.002922 | 169 | py |
CLUE | CLUE-master/baselines/models_pytorch/classifier_pytorch/transformers/modeling_xlm.py | # coding=utf-8
# Copyright 2019-present, Facebook, Inc and the HuggingFace Inc. team.
#
# 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
#
# Un... | 45,543 | 50.34611 | 163 | py |
CLUE | CLUE-master/baselines/models_pytorch/classifier_pytorch/transformers/modeling_ctrl.py | # coding=utf-8
# Copyright 2018 Salesforce and HuggingFace Inc. team.
# Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# h... | 23,436 | 47.22428 | 134 | py |
CLUE | CLUE-master/baselines/models_pytorch/classifier_pytorch/transformers/tokenization_transfo_xl.py | # coding=utf-8
# Copyright 2018 Google AI, Google Brain and Carnegie Mellon University Authors and the HuggingFace Inc. team.
# Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the Lice... | 21,824 | 36.62931 | 133 | py |
CLUE | CLUE-master/baselines/models_pytorch/classifier_pytorch/transformers/tokenization_openai.py | # coding=utf-8
# Copyright 2018 The Open AI Team Authors and The HuggingFace Inc. team.
#
# 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
#
# ... | 7,784 | 36.248804 | 133 | py |
CLUE | CLUE-master/baselines/models_pytorch/classifier_pytorch/transformers/modeling_transfo_xl_utilities.py | # coding=utf-8
# Copyright 2018 Google AI, Google Brain and Carnegie Mellon University Authors and the HuggingFace Inc. team.
# Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the Lice... | 13,568 | 39.747748 | 132 | py |
CLUE | CLUE-master/baselines/models_pytorch/classifier_pytorch/transformers/modeling_roberta.py | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team.
# Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a cop... | 25,678 | 53.52017 | 151 | py |
CLUE | CLUE-master/baselines/models_pytorch/classifier_pytorch/transformers/tokenization_utils.py | # coding=utf-8
# Copyright 2018 The Open AI Team Authors and The HuggingFace Inc. team.
#
# 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
#
# ... | 54,979 | 50.431244 | 372 | py |
CLUE | CLUE-master/baselines/models_pytorch/mrc_pytorch/google_albert_pytorch_modeling.py | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors and The HugginFace Inc. team.
# Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy... | 22,556 | 42.885214 | 119 | py |
CLUE | CLUE-master/baselines/models_pytorch/mrc_pytorch/run_c3.py | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors and The HugginFace Inc. team.
#
# 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/LICENS... | 34,700 | 41.061818 | 120 | py |
CLUE | CLUE-master/baselines/models_pytorch/mrc_pytorch/test_mrc.py | import argparse
import collections
import json
import os
from glob import glob
import torch
from torch.utils.data import TensorDataset, DataLoader
from tqdm import tqdm
from pytorch_modeling import BertConfig, BertForQuestionAnswering, ALBertConfig, ALBertForQA
from google_albert_pytorch_modeling import AlbertConfig,... | 7,116 | 44.33121 | 110 | py |
CLUE | CLUE-master/baselines/models_pytorch/mrc_pytorch/run_mrc.py | import argparse
import collections
import json
import os
import random
import numpy as np
import torch
from google_albert_pytorch_modeling import AlbertConfig, AlbertForMRC
from preprocess.cmrc2018_evaluate import get_eval
from pytorch_modeling import BertConfig, BertForQuestionAnswering, ALBertConfig, ALBertForQA
fro... | 13,603 | 45.749141 | 112 | py |
CLUE | CLUE-master/baselines/models_pytorch/mrc_pytorch/pytorch_modeling.py | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors and The HugginFace Inc. team.
# Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy... | 57,982 | 45.798224 | 130 | py |
CLUE | CLUE-master/baselines/models_pytorch/mrc_pytorch/convert_tf_checkpoint_to_pytorch.py | # coding=utf-8
# Copyright 2018 The HugginFace Inc. team.
#
# 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 ... | 5,188 | 40.18254 | 105 | py |
CLUE | CLUE-master/baselines/models_pytorch/mrc_pytorch/test_multichoice_mrc.py | from __future__ import print_function
import argparse
import os
from glob import glob
import torch
from google_albert_pytorch_modeling import AlbertConfig, AlbertForMultipleChoice
from preprocess.CHID_preprocess import RawResult, get_final_predictions, write_predictions, \
generate_input
from pytorch_modeling imp... | 9,007 | 49.044444 | 118 | py |
CLUE | CLUE-master/baselines/models_pytorch/mrc_pytorch/run_multichoice_mrc.py | """
@name = 'roberta_wwm_ext_large'
@author = 'zhangxinrui'
@time = '2019/11/15'
roberta_wwm_ext_large 的baseline版本
coding=utf-8
Copyright 2018 The Google AI Language Team Authors and The HugginFace Inc. team.
Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
Licensed under the Apache License, Version 2.0 ... | 16,489 | 50.69279 | 118 | py |
CLUE | CLUE-master/baselines/models_pytorch/mrc_pytorch/tools/pytorch_optimization.py | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors and The HugginFace Inc. team.
#
# 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/LICENS... | 8,435 | 41.606061 | 116 | py |
CLUE | CLUE-master/baselines/models_pytorch/mrc_pytorch/tools/utils.py | import collections
import os
import re
from glob import glob
import tensorflow as tf
import tensorflow.contrib.slim as slim
import torch
def check_args(args):
args.setting_file = os.path.join(args.checkpoint_dir, args.setting_file)
args.log_file = os.path.join(args.checkpoint_dir, args.log_file)
os.maked... | 4,999 | 33.013605 | 117 | py |
CLUE | CLUE-master/baselines/models_pytorch/mrc_pytorch/tools/file_utils.py | """
Utilities for working with the local dataset cache.
This file is adapted from the AllenNLP library at https://github.com/allenai/allennlp
Copyright by the AllenNLP authors.
"""
import json
import logging
import os
import shutil
import tempfile
from functools import wraps
from hashlib import sha256
from pathlib imp... | 8,020 | 32.560669 | 98 | py |
CLUE | CLUE-master/baselines/models_pytorch/mrc_pytorch/tools/official_tokenization.py | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors and The HugginFace Inc. team.
#
# 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/LICENS... | 14,426 | 36.18299 | 133 | py |
CLUE | CLUE-master/baselines/models_pytorch/mrc_pytorch/tools/zh_wiki.py | # -*- coding: utf-8 -*-
# copy fom wikipedia
zh2Hant = {
'呆': '獃',
"打印机": "印表機",
'帮助文件': '說明檔案',
"画": "畫",
"龙": "竜",
"板": "板",
"表": "表",
"才": "才",
"丑": "醜",
"出": "出",
"淀": "澱",
"冬": "冬",
"范": "範",
"丰": "豐",
"刮": "刮",
"后": "後",
"胡": "胡",
"回": "回",
"伙": "夥",
"姜": "薑",
"借": "借",
"克": "克",
"困": "困",
"漓": "漓",
"里": "里",
"帘... | 91,927 | 10.091699 | 27 | py |
CLUE | CLUE-master/baselines/models_pytorch/mrc_pytorch/tools/langconv.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from copy import deepcopy
try:
import psyco
psyco.full()
except:
pass
from .zh_wiki import zh2Hant, zh2Hans
import sys
py3k = sys.version_info >= (3, 0, 0)
if py3k:
UEMPTY = ''
else:
_zh2Hant, _zh2Hans = {}, {}
for old, new in ((zh2Hant, _zh2Han... | 7,874 | 27.740876 | 75 | py |
CLUE | CLUE-master/baselines/models_pytorch/mrc_pytorch/preprocess/DRCD_output.py | import collections
import json
import math
from tqdm import tqdm
from tools.official_tokenization import BasicTokenizer
def write_predictions_topk(config, all_examples, all_features, all_results, n_best_size,
max_answer_length, do_lower_case, output_prediction_file,
... | 19,601 | 40.706383 | 104 | py |
CLUE | CLUE-master/baselines/models_pytorch/mrc_pytorch/preprocess/CHID_preprocess.py | '''
@author: zhangxinrui
@name: dataset_roberta.py
@date: 10/07/2019
'''
import collections
import os
import pickle
import numpy as np
import json
from tqdm import tqdm
try:
import regex as re
except Exception:
import re
RawResult = collections.namedtuple("RawResult",
["un... | 14,712 | 32.362812 | 149 | py |
CLUE | CLUE-master/baselines/models_pytorch/mrc_pytorch/preprocess/DRCD_preprocess.py | import collections
import copy
import json
import os
from tqdm import tqdm
from tools.langconv import Converter
SPIECE_UNDERLINE = '▁'
def whitespace_tokenize(text):
"""Runs basic whitespace cleaning and splitting on a peice of text."""
text = text.strip()
if not text:
return []
tokens = tex... | 14,501 | 40.913295 | 149 | py |
CLUE | CLUE-master/baselines/models_pytorch/mrc_pytorch/preprocess/cmrc2018_output.py | import collections
import json
import math
from tqdm import tqdm
from tools.official_tokenization import BasicTokenizer
def write_predictions_topk(FLAGS, all_examples, all_features, all_results, n_best_size,
max_answer_length, output_prediction_file, output_nbest_file):
_PrelimPredict... | 19,623 | 40.576271 | 104 | py |
CLUE | CLUE-master/baselines/models_pytorch/mrc_pytorch/preprocess/cmrc2018_preprocess.py | import collections
import json
import os
from tqdm import tqdm
from tools import official_tokenization as tokenization
SPIECE_UNDERLINE = '▁'
def _improve_answer_span(doc_tokens, input_start, input_end, tokenizer,
orig_answer_text):
"""Returns tokenized answer spans that better match t... | 14,964 | 40.225895 | 149 | py |
CLUE | CLUE-master/baselines/models_pytorch/mrc_pytorch/preprocess/cmrc2018_evaluate.py | # -*- coding: utf-8 -*-
'''
Evaluation script for CMRC 2018
version: v5 - special
Note:
v5 - special: Evaluate on SQuAD-style CMRC 2018 Datasets
v5: formatted output, add usage description
v4: fixed segmentation issues
'''
from __future__ import print_function
import json
import re
from collections import OrderedDict
... | 7,007 | 31.294931 | 97 | py |
SparseCoupledDictionaryLearning | SparseCoupledDictionaryLearning-master/args.py | # -*- coding: utf-8 -*-
"""SF DECONVOLVE ARGUMENTS
This module sets the arguments for sf_deconvolve.py.
:Author: Samuel Farrens <samuel.farrens@gmail.com>
:Version: 2.4
:Date: 23/10/2017
"""
import argparse as ap
from argparse import ArgumentDefaultsHelpFormatter as formatter
class ArgParser(ap.ArgumentParser)... | 3,662 | 26.961832 | 103 | py |
SparseCoupledDictionaryLearning | SparseCoupledDictionaryLearning-master/CDLOps.py |
"""SPARSE COUPLED DICTIONARY LEARNING
Sumplementary Class and Methods for the execution of intermediate matrices (Lagrange multiplier matrices, sparse coding matrices)
:Author: Nancy Panousopoulou <apanouso@ics.forth.gr>
:Reference document: Konstantina Fotiadou, Grigorios Tsagkatakis, Panagiotos Tsakalides `` Lin... | 3,834 | 27.198529 | 175 | py |
SparseCoupledDictionaryLearning | SparseCoupledDictionaryLearning-master/AuxOps.py | """SPARSE COUPLED DICTIONARY LEARNING
Sumplementary Methods for the execution of intermediate matrices (Lagrange multiplier matrices, sparse coding matrices)
:Author: Nancy Panousopoulou <apanouso@ics.forth.gr>
:Reference document: Konstantina Fotiadou, Grigorios Tsagkatakis, Panagiotos Tsakalides `` Linear Inverse... | 3,089 | 25.869565 | 175 | py |
SparseCoupledDictionaryLearning | SparseCoupledDictionaryLearning-master/SparseCoupledDictionaryTraining.py |
"""SPARSE COUPLED DICTIONARY LEARNING
The main script for execution
:Author: Nancy Panousopoulou <apanouso@ics.forth.gr>
::Reference document: Konstantina Fotiadou, Grigorios Tsagkatakis, Panagiotos Tsakalides `` Linear Inverse Problems with Sparsity Constraints,'' DEDALE DELIVERABLE 3.1, 2016.
:Date: December 2... | 5,357 | 27.652406 | 200 | py |
pointnerf | pointnerf-master/options/train_options.py | from .base_options import BaseOptions
class TrainOptions(BaseOptions):
def initialize(self, parser):
parser = BaseOptions.initialize(self, parser)
self.is_train = True
parser.add_argument(
'--print_freq',
type=int,
default=100,
help='frequen... | 5,016 | 39.459677 | 84 | py |
pointnerf | pointnerf-master/options/base_options.py | import argparse
import os
from models import find_model_class_by_name
from data import find_dataset_class_by_name
import torch
class BaseOptions:
def initialize(self, parser: argparse.ArgumentParser):
#================================ global ================================#
parser.add_argument('-... | 7,159 | 38.125683 | 107 | py |
pointnerf | pointnerf-master/options/__init__.py | from .train_options import TrainOptions
from .test_options import TestOptions
from .edit_options import EditOptions
| 116 | 28.25 | 39 | py |
pointnerf | pointnerf-master/options/test_options.py | from .base_options import BaseOptions
class TestOptions(BaseOptions):
def initialize(self, parser):
parser = BaseOptions.initialize(self, parser)
self.is_train = False
parser.add_argument('--test_num', type=int, default=1, help='test num')
parser.add_argument('--test_num_step', type... | 486 | 43.272727 | 109 | py |
pointnerf | pointnerf-master/options/edit_options.py | from .base_options import BaseOptions
class EditOptions(BaseOptions):
def initialize(self, parser):
parser = BaseOptions.initialize(self, parser)
self.is_train = False
parser.add_argument('--neural_points_names',
type=str,
nargs='+',
... | 1,766 | 44.307692 | 75 | py |
pointnerf | pointnerf-master/models/base_rendering_model.py | import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
from utils import format as fmt
import os
from .base_model import BaseModel
from .rendering.diff_render_func import find_render_function, find_blend_function, find_tone_map, alpha_blend
from .rendering.diff_ray_marching import find_r... | 28,653 | 41.45037 | 160 | py |
pointnerf | pointnerf-master/models/mvs_points_volumetric_model.py | from .base_rendering_model import *
from .neural_points_volumetric_model import NeuralPointsVolumetricModel
from .neural_points.neural_points import NeuralPoints
from .mvs.mvs_points_model import MvsPointsModel
from .mvs import mvs_utils
from. import base_model
from .aggregators.point_aggregators import PointAggregator... | 16,910 | 48.017391 | 519 | py |
pointnerf | pointnerf-master/models/base_model.py | import torch
from torch import nn
import os
from .helpers.networks import get_scheduler
class BaseModel:
@staticmethod
def modify_commandline_options(parser, is_train):
return parser
def name(self):
return self.__class__.__name__
def initialize(self, opt):
self.opt = opt
... | 5,600 | 34.675159 | 146 | py |
pointnerf | pointnerf-master/models/__init__.py | import importlib
from models.base_model import BaseModel
def find_model_class_by_name(model_name):
# Given the option --model [modelname],
# the file "models/modelname_model.py"
# will be imported.
model_filename = "models." + model_name + "_model"
modellib = importlib.import_module(model_filename... | 1,305 | 30.095238 | 109 | py |
pointnerf | pointnerf-master/models/neural_points_volumetric_model.py | from .base_rendering_model import *
from .neural_points.neural_points import NeuralPoints
from .aggregators.point_aggregators import PointAggregator
import os
class NeuralPointsVolumetricModel(BaseRenderingModel):
@staticmethod
def modify_commandline_options(parser, is_train=True):
BaseRenderingModel... | 17,131 | 46.065934 | 416 | py |
pointnerf | pointnerf-master/models/neural_points/point_query.py | import torch
import torch.nn
import torch.nn.functional as F
import os
import numpy as np
from numpy import dot
from math import sqrt
import matplotlib.pyplot as plt
import pickle
import time
from models.rendering.diff_ray_marching import near_far_linear_ray_generation, near_far_disparity_linear_ray_generation
parent_d... | 5,914 | 53.768519 | 209 | py |
pointnerf | pointnerf-master/models/neural_points/query_point_indices_worldcoords.py | import os
import numpy as np
from numpy import dot
from math import sqrt
import pycuda
from pycuda.compiler import SourceModule
import pycuda.driver as drv
import pycuda.gpuarray as gpuarray
import matplotlib.pyplot as plt
import torch
import pickle
import time
from models.rendering.diff_ray_marching import near_far_li... | 51,817 | 55.385201 | 484 | py |
pointnerf | pointnerf-master/models/neural_points/neural_points.py | import torch
import torch.nn as nn
from data.load_blender import load_blender_cloud
import numpy as np
from ..helpers.networks import init_seq, positional_encoding
import matplotlib.pyplot as plt
import torch.nn.utils.prune as prune_param
class NeuralPoints(nn.Module):
@staticmethod
def modify_commandline_op... | 35,753 | 47.978082 | 368 | py |
pointnerf | pointnerf-master/models/neural_points/__init__.py | 0 | 0 | 0 | py | |
pointnerf | pointnerf-master/models/neural_points/query_point_indices.py | import os
import numpy as np
from numpy import dot
from math import sqrt
import pycuda
from pycuda.compiler import SourceModule
import pycuda.driver as drv
import pycuda.gpuarray as gpuarray
import matplotlib.pyplot as plt
# from mpl_toolkits.mplot3d import Axes3D
import torch
import pickle
import time
# import cupy
# ... | 55,075 | 57.467091 | 475 | py |
pointnerf | pointnerf-master/models/depth_estimators/mvsnet.py | import torch
import torch.nn as nn
import torch.nn.functional as F
from .module import *
class FeatureNet(nn.Module):
def __init__(self):
super(FeatureNet, self).__init__()
self.inplanes = 32
self.conv0 = ConvBnReLU(3, 8, 3, 1, 1)
self.conv1 = ConvBnReLU(8, 8, 3, 1, 1)
se... | 5,505 | 35.95302 | 147 | py |
pointnerf | pointnerf-master/models/depth_estimators/module.py | import torch
import torch.nn as nn
import torch.nn.functional as F
class ConvBnReLU(nn.Module):
def __init__(self, in_channels, out_channels, kernel_size=3, stride=1, pad=1):
super(ConvBnReLU, self).__init__()
self.conv = nn.Conv2d(in_channels, out_channels, kernel_size, stride=stride, padding=pad... | 6,155 | 39.235294 | 118 | py |
pointnerf | pointnerf-master/models/depth_estimators/__init__.py | 0 | 0 | 0 | py | |
pointnerf | pointnerf-master/models/helpers/geometrics.py | import torch
def homogenize(m):
"""Adds homogeneous coordinates to a [..., N,N] matrix, returning [..., N+1, N+1]."""
assert m.shape[-1] == m.shape[-2] # Must be square
n = m.shape[-1]
eye_n_plus_1 = torch.eye(n + 1).cuda().expand(list(m.shape[:-2]) + [-1, -1])
extra_col = eye_n_plus_1[..., :-1, ... | 2,890 | 39.71831 | 125 | py |
pointnerf | pointnerf-master/models/helpers/networks.py | import torch
import torch.nn as nn
from torch.nn import init
import functools
from torch.optim import lr_scheduler
import torch.nn.functional as F
import numpy as np
def get_nonlinearity_layer(activation_type='PReLU'):
if activation_type == 'ReLU':
nonlinearity_layer = nn.ReLU(True)
elif activation_ty... | 7,692 | 39.489474 | 125 | py |
pointnerf | pointnerf-master/models/helpers/__init__.py | 0 | 0 | 0 | py | |
pointnerf | pointnerf-master/models/rendering/diff_ray_marching.py | import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
def find_ray_generation_method(name):
assert isinstance(name, str), 'ray generation method name must be string'
if name == 'cube':
return cube_ray_generation
elif name == 'near_far_linear':
return near_fa... | 23,672 | 40.314136 | 290 | py |
pointnerf | pointnerf-master/models/rendering/__init__.py | 0 | 0 | 0 | py | |
pointnerf | pointnerf-master/models/rendering/diff_render_func.py | import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
from utils import format as fmt
def find_render_function(name):
if name == 'radiance':
return radiance_render
elif name == 'white':
return white_color
raise RuntimeError('Unknown render function: ' + name... | 1,620 | 22.838235 | 73 | py |
pointnerf | pointnerf-master/models/aggregators/point_aggregators.py | import torch
import torch.nn as nn
import numpy as np
import torch.nn.functional as F
from ..helpers.networks import init_seq, positional_encoding
from utils.spherical import SphericalHarm_table as SphericalHarm
from ..helpers.geometrics import compute_world2local_dist
class PointAggregator(torch.nn.Module):
@... | 37,876 | 45.417892 | 330 | py |
pointnerf | pointnerf-master/models/aggregators/__init__.py | 0 | 0 | 0 | py | |
pointnerf | pointnerf-master/models/mvs/renderer.py | import torch
import torch.nn.functional as F
from .mvs_utils import normal_vect, index_point_feature, build_color_volume
def depth2dist(z_vals, cos_angle):
# z_vals: [N_ray N_sample]
device = z_vals.device
dists = z_vals[..., 1:] - z_vals[..., :-1]
dists = torch.cat([dists, torch.Tensor([1e10]).to(devi... | 7,260 | 38.461957 | 153 | py |
pointnerf | pointnerf-master/models/mvs/mvs_utils.py | import os, torch, cv2, re
import numpy as np
from torch_scatter import scatter_min, segment_coo, scatter_mean
from PIL import Image
import torch.nn.functional as F
import torchvision.transforms as T
from functools import partial
import matplotlib.pyplot as plt
from scipy.spatial.transform import Rotation as R
# Misc
... | 26,948 | 43.397035 | 318 | py |
pointnerf | pointnerf-master/models/mvs/mvs_points_model.py | import torch
import os
from torch.utils.data import DataLoader
import imageio
# models
from .models import *
from .renderer import *
from .mvs_utils import *
from . import filter_utils
from ..helpers.networks import init_seq
from ..depth_estimators.mvsnet import MVSNet as Ofcl_MVSNet
from torch.optim.lr_scheduler impo... | 22,547 | 54.674074 | 414 | py |
pointnerf | pointnerf-master/models/mvs/filter_utils.py | import sys
import os
import pathlib
# sys.path.append(os.path.join(pathlib.Path(__file__).parent.absolute(), '..'))
import torch.nn.functional as F
import copy
import torch
import numpy as np
import time
from models.mvs import mvs_utils
from tqdm import tqdm
import cv2
from PIL import Image
def reproject_with_depth(... | 16,375 | 53.586667 | 287 | py |
pointnerf | pointnerf-master/models/mvs/models.py | import torch
torch.autograd.set_detect_anomaly(True)
import torch.nn as nn
from .mvs_utils import *
from .mvs_utils import homo_warp
from inplace_abn import InPlaceABN
from .renderer import run_network_mvs
from ..depth_estimators.mvsnet import MVSNet as Ofcl_MVSNet
device = torch.device("cuda" if torch.cuda.is_availab... | 37,147 | 35.963184 | 166 | py |
pointnerf | pointnerf-master/run/editing.py | import sys
import os
import pathlib
sys.path.append(os.path.join(pathlib.Path(__file__).parent.absolute(), '..'))
import glob
import copy
import torch
import numpy as np
import time
from options import TrainOptions
from options import EditOptions
from data import create_data_loader, create_dataset
from models import cr... | 11,213 | 42.465116 | 774 | py |
pointnerf | pointnerf-master/run/evaluate.py | import os, sys, time, argparse, cv2
import numpy as np
try:
from skimage.measure import compare_ssim
from skimage.measure import compare_psnr
except:
from skimage.metrics import structural_similarity
from skimage.metrics import peak_signal_noise_ratio as compare_psnr
def compare_ssim(gt, img, win_s... | 9,769 | 61.229299 | 324 | py |
pointnerf | pointnerf-master/run/train_ft_nonstop.py | import sys
import os
import pathlib
sys.path.append(os.path.join(pathlib.Path(__file__).parent.absolute(), '..'))
import glob
import copy
import torch
import numpy as np
import time
from options import TrainOptions
from data import create_data_loader, create_dataset
from models import create_model
from models.mvs.mvs_p... | 60,868 | 55.308048 | 392 | py |
pointnerf | pointnerf-master/run/render_vid.py | import sys
import os
import pathlib
sys.path.append(os.path.join(pathlib.Path(__file__).parent.absolute(), '..'))
import copy
import torch
import numpy as np
import time
from options import TestOptions
from data import create_data_loader, create_dataset
from models import create_model
from utils.visualizer import Visu... | 4,702 | 34.097015 | 110 | py |
pointnerf | pointnerf-master/run/train_ft.py | import sys
import os
import pathlib
sys.path.append(os.path.join(pathlib.Path(__file__).parent.absolute(), '..'))
import glob
import copy
import torch
import numpy as np
import time
from options import TrainOptions
from data import create_data_loader, create_dataset
from models import create_model
from models.mvs.mvs_p... | 60,882 | 55.268946 | 392 | py |
pointnerf | pointnerf-master/run/test_ft.py | import sys
import os
import pathlib
sys.path.append(os.path.join(pathlib.Path(__file__).parent.absolute(), '..'))
import glob
import copy
import torch
import numpy as np
import time
from options import TrainOptions
from data import create_data_loader, create_dataset
from models import create_model
from models.mvs.mvs_p... | 17,612 | 48.754237 | 331 | py |
pointnerf | pointnerf-master/run/train.py | import sys
import os
import pathlib
sys.path.append(os.path.join(pathlib.Path(__file__).parent.absolute(), '..'))
import copy
import torch
import numpy as np
import time
from options import TrainOptions
from data import create_data_loader, create_dataset
from models import create_model
from utils.visualizer import Vis... | 17,776 | 47.438692 | 219 | py |
pointnerf | pointnerf-master/run/visualize.py | import sys
import os
import pathlib
sys.path.append(os.path.join(pathlib.Path(__file__).parent.absolute(), '..'))
import copy
import torch
import numpy as np
import time
from options import TestOptions
from data import create_data_loader, create_dataset
from models import create_model
from utils.visualizer import Visu... | 1,721 | 29.75 | 90 | py |
pointnerf | pointnerf-master/run/vis_grow_train.py | import sys
import os
import pathlib
sys.path.append(os.path.join(pathlib.Path(__file__).parent.absolute(), '..'))
import glob
import copy
import torch
import numpy as np
import time
from options import TrainOptions
from data import create_data_loader, create_dataset
from models import create_model
from models.mvs.mvs_p... | 2,394 | 34.746269 | 183 | py |
pointnerf | pointnerf-master/utils/format.py | PURPLE = '\033[1;35;48m'
CYAN = '\033[1;36;48m'
BOLD = '\033[1;37;48m'
BLUE = '\033[1;34;48m'
GREEN = '\033[1;32;48m'
YELLOW = '\033[1;33;48m'
RED = '\033[1;31;48m'
BLACK = '\033[1;30;48m'
UNDERLINE = '\033[4;37;48m'
END = '\033[1;37;0m'
| 238 | 20.727273 | 27 | py |
pointnerf | pointnerf-master/utils/visualizer.py | import numpy as np
import os
from PIL import Image
import shutil
from collections import OrderedDict
import time
import datetime
import torch
import imageio
from utils.util import to8b
from models.mvs.mvs_utils import *
def mse2psnr(x): return -10.* torch.log(x)/np.log(10.)
def save_image(img_array, filepath):
a... | 7,619 | 40.639344 | 101 | py |
pointnerf | pointnerf-master/utils/util.py | from __future__ import print_function
import torch
import numpy as np
from PIL import Image
import os
from torchvision.utils import make_grid
from os.path import join
import torch.nn.functional as F
import matplotlib as mpl
import matplotlib.cm as cm
import matplotlib.pyplot as plt
from scipy.spatial.transform import R... | 2,196 | 30.84058 | 109 | py |
pointnerf | pointnerf-master/utils/ncg_string.py | '''Manipulate strings'''
def underscore2camelcase(s):
assert s == s.lower(), 'Invalid underscore string: no upper case character is allowed, in "{}"'.format(s)
assert all([x.isdigit() or x.isalpha() or x == '_' for x in s]),\
'Invalid underscore, all character must be letters or numbers or underscore'... | 1,077 | 36.172414 | 109 | py |
pointnerf | pointnerf-master/utils/spherical.py | import torch
from scipy.special import sph_harm, lpmn, lpmv
from scipy.special import factorial
import numpy as np
import math
import time
class SphericalHarm(object):
def __init__(self, total_deg):
self.total_deg = total_deg
self.orderIds, self.lIds, self.mIds, self.num_at_deg, self.m0inorder, se... | 9,061 | 37.236287 | 129 | py |
pointnerf | pointnerf-master/data/llff_ft_dataset.py | from models.mvs.mvs_utils import read_pfm
import os
import numpy as np
import cv2
from PIL import Image
import torch
from torchvision import transforms as T
import torchvision.transforms.functional as F
from kornia import create_meshgrid
import time
import json
from . import data_utils
import glob
from torch.utils.data... | 30,712 | 39.358739 | 184 | py |
pointnerf | pointnerf-master/data/nerf_synth_ft_dataset.py | from models.mvs.mvs_utils import read_pfm
import os
import numpy as np
import cv2
from PIL import Image
import torch
from torchvision import transforms as T
import torchvision.transforms.functional as F
from kornia import create_meshgrid
import time
import json
from torch.utils.data import Dataset, DataLoader
import t... | 26,636 | 39.055639 | 174 | py |
pointnerf | pointnerf-master/data/dtu_dataset.py | from models.mvs.mvs_utils import read_pfm
import os
import numpy as np
import cv2
from PIL import Image
import torch
from torchvision import transforms as T
import torchvision.transforms.functional as F
from torch.utils.data import Dataset, DataLoader
import torch
import os
from PIL import Image
import h5py
from da... | 28,325 | 41.595489 | 174 | py |
pointnerf | pointnerf-master/data/fitplane.py | from skspatial.objects import Plane
from skspatial.objects import Points
from skspatial.plotting import plot_3d
from plyfile import PlyData, PlyElement
import matplotlib.pyplot as plt
import numpy as np
# points = Points([[0, 0, 0], [1, 3, 5], [-5, 6, 3], [3, 6, 7], [-2, 6, 7]])
# plydata = PlyData.read("/home/xharlie... | 3,495 | 37 | 181 | py |
pointnerf | pointnerf-master/data/base_dataset.py | import torch.utils.data as data
from PIL import Image
class BaseDataset(data.Dataset):
def __init__(self):
super(BaseDataset, self).__init__()
def name(self):
return self.__class__.__name__
@staticmethod
def modify_commandline_options(parser, is_train):
return parser
def... | 440 | 20 | 53 | py |
pointnerf | pointnerf-master/data/download-scannet.py | #!/usr/bin/env python
# Downloads ScanNet public data release
# Run with ./download-scannet.py (or python download-scannet.py on Windows)
# -*- coding: utf-8 -*-
import argparse
import os
import urllib.request #(for python3)
import urllib
import tempfile
BASE_URL = 'http://kaldir.vc.in.tum.de/scannet/'
TOS_URL = BASE_... | 12,182 | 51.064103 | 318 | py |
pointnerf | pointnerf-master/data/dtu_ft_dataset.py | from models.mvs.mvs_utils import read_pfm
import os
import numpy as np
import cv2
from PIL import Image
import torch
from torchvision import transforms as T
import torchvision.transforms.functional as F
from kornia import create_meshgrid
import time
import itertools
import random
from torch.utils.data import Dataset, D... | 40,122 | 41.912299 | 174 | py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.