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/ernie/__init__.py | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... | 616 | 37.5625 | 74 | py |
CLUE | CLUE-master/baselines/models/ernie/create_pretraining_data.py | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... | 16,475 | 34.055319 | 80 | py |
CLUE | CLUE-master/baselines/models/roberta_wwm_large_ext/run_classifier_with_tfhub.py | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... | 11,426 | 35.27619 | 82 | py |
CLUE | CLUE-master/baselines/models/roberta_wwm_large_ext/optimization.py | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... | 6,258 | 34.765714 | 80 | py |
CLUE | CLUE-master/baselines/models/roberta_wwm_large_ext/run_squad.py | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... | 46,532 | 35.240654 | 82 | py |
CLUE | CLUE-master/baselines/models/roberta_wwm_large_ext/run_classifier.py | # -*- coding: utf-8 -*-
# @Author: bo.shi
# @Date: 2019-11-04 09:56:36
# @Last Modified by: bo.shi
# @Last Modified time: 2019-12-04 14:30:45
# coding=utf-8
# Copyright 2018 The Google AI Language Team Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in... | 36,208 | 36.213772 | 123 | py |
CLUE | CLUE-master/baselines/models/roberta_wwm_large_ext/tf_metrics.py | """
Multiclass
from:
https://github.com/guillaumegenthial/tf_metrics/blob/master/tf_metrics/__init__.py
"""
__author__ = "Guillaume Genthial"
import numpy as np
import tensorflow as tf
from tensorflow.python.ops.metrics_impl import _streaming_confusion_matrix
def precision(labels, predictions, num_classes, pos_in... | 8,188 | 37.088372 | 82 | py |
CLUE | CLUE-master/baselines/models/roberta_wwm_large_ext/tokenization.py | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... | 12,257 | 29.645 | 80 | py |
CLUE | CLUE-master/baselines/models/roberta_wwm_large_ext/modeling.py | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... | 37,922 | 37.422492 | 93 | py |
CLUE | CLUE-master/baselines/models/roberta_wwm_large_ext/extract_features.py | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... | 13,898 | 32.092857 | 82 | py |
CLUE | CLUE-master/baselines/models/roberta_wwm_large_ext/modeling_test.py | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... | 9,191 | 32.064748 | 78 | py |
CLUE | CLUE-master/baselines/models/roberta_wwm_large_ext/conlleval.py | # Python version of the evaluation script from CoNLL'00-
# Originates from: https://github.com/spyysalo/conlleval.py
# Intentional differences:
# - accept any space as delimiter by default
# - optional file argument (default STDIN)
# - option to set boundary (-b argument)
# - LaTeX output (-l argument) not supported
... | 10,196 | 32.99 | 83 | py |
CLUE | CLUE-master/baselines/models/roberta_wwm_large_ext/optimization_test.py | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... | 1,721 | 34.142857 | 76 | py |
CLUE | CLUE-master/baselines/models/roberta_wwm_large_ext/run_ner.py | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... | 33,820 | 39.024852 | 227 | py |
CLUE | CLUE-master/baselines/models/roberta_wwm_large_ext/tokenization_test.py | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... | 4,589 | 32.26087 | 80 | py |
CLUE | CLUE-master/baselines/models/roberta_wwm_large_ext/run_pretraining.py | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... | 18,667 | 36.789474 | 82 | py |
CLUE | CLUE-master/baselines/models/roberta_wwm_large_ext/__init__.py | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... | 616 | 37.5625 | 74 | py |
CLUE | CLUE-master/baselines/models/roberta_wwm_large_ext/create_pretraining_data.py | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... | 16,475 | 34.055319 | 80 | py |
CLUE | CLUE-master/baselines/models/albert/optimization.py | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... | 11,793 | 38.313333 | 120 | py |
CLUE | CLUE-master/baselines/models/albert/optimization_finetuning.py | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... | 6,323 | 35.137143 | 84 | py |
CLUE | CLUE-master/baselines/models/albert/run_classifier.py | # -*- coding: utf-8 -*-
# @Author: bo.shi
# @Date: 2019-11-04 09:56:36
# @Last Modified by: bo.shi
# @Last Modified time: 2019-12-04 14:29:04
# coding=utf-8
# Copyright 2018 The Google AI Language Team Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in... | 37,966 | 37.081244 | 201 | py |
CLUE | CLUE-master/baselines/models/albert/bert_utils.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import collections
import copy
import json
import math
import re
import six
import tensorflow as tf
def get_shape_list(tensor, expected_rank=None, name=None):
"""Returns a list of the shape of tensor, preferr... | 4,562 | 30.6875 | 76 | py |
CLUE | CLUE-master/baselines/models/albert/tokenization.py | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... | 13,166 | 31.753731 | 861 | py |
CLUE | CLUE-master/baselines/models/albert/modeling.py | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... | 50,600 | 39.000791 | 225 | py |
CLUE | CLUE-master/baselines/models/albert/run_pretraining.py | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... | 19,745 | 38.334661 | 203 | py |
CLUE | CLUE-master/baselines/models/albert/test_changes.py | # coding=utf-8
import tensorflow as tf
from modeling import embedding_lookup_factorized,transformer_model
import os
"""
测试albert主要的改进点:词嵌入的因式分解、层间参数共享、段落间连贯性
test main change of albert from bert
"""
batch_size = 2048
sequence_length = 512
vocab_size = 30000
hidden_size = 1024
num_attention_heads = int(hidden_size / 64... | 3,008 | 33.193182 | 182 | py |
CLUE | CLUE-master/baselines/models/albert/create_pretraining_data.py | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... | 37,627 | 52.146893 | 5,072 | py |
CLUE | CLUE-master/baselines/models/albert/resources/create_pretraining_data_roberta.py | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... | 25,201 | 39.003175 | 137 | py |
CLUE | CLUE-master/baselines/models/roberta/optimization.py | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... | 7,512 | 35.828431 | 156 | py |
CLUE | CLUE-master/baselines/models/roberta/optimization_finetuning.py | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... | 6,323 | 35.137143 | 84 | py |
CLUE | CLUE-master/baselines/models/roberta/run_classifier.py | # -*- coding: utf-8 -*-
# @Author: bo.shi
# @Date: 2019-11-04 09:56:36
# @Last Modified by: bo.shi
# @Last Modified time: 2019-12-04 14:30:31
# coding=utf-8
# Copyright 2018 The Google AI Language Team Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in... | 42,511 | 37.472398 | 139 | py |
CLUE | CLUE-master/baselines/models/roberta/tf_metrics.py | """
Multiclass
from:
https://github.com/guillaumegenthial/tf_metrics/blob/master/tf_metrics/__init__.py
"""
__author__ = "Guillaume Genthial"
import numpy as np
import tensorflow as tf
from tensorflow.python.ops.metrics_impl import _streaming_confusion_matrix
def precision(labels, predictions, num_classes, pos_in... | 8,188 | 37.088372 | 82 | py |
CLUE | CLUE-master/baselines/models/roberta/tokenization.py | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... | 13,166 | 31.753731 | 861 | py |
CLUE | CLUE-master/baselines/models/roberta/modeling.py | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... | 37,962 | 37.463019 | 96 | py |
CLUE | CLUE-master/baselines/models/roberta/conlleval.py | # Python version of the evaluation script from CoNLL'00-
# Originates from: https://github.com/spyysalo/conlleval.py
# Intentional differences:
# - accept any space as delimiter by default
# - optional file argument (default STDIN)
# - option to set boundary (-b argument)
# - LaTeX output (-l argument) not supported
... | 10,196 | 32.99 | 83 | py |
CLUE | CLUE-master/baselines/models/roberta/run_ner.py | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... | 33,812 | 39.015385 | 227 | py |
CLUE | CLUE-master/baselines/models/roberta/run_pretraining.py | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... | 19,471 | 38.022044 | 203 | py |
CLUE | CLUE-master/baselines/models/roberta/create_pretraining_data.py | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... | 25,134 | 38.896825 | 131 | py |
CLUE | CLUE-master/baselines/models/bert_wwm_ext/run_classifier_with_tfhub.py | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... | 11,426 | 35.27619 | 82 | py |
CLUE | CLUE-master/baselines/models/bert_wwm_ext/optimization.py | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... | 6,258 | 34.765714 | 80 | py |
CLUE | CLUE-master/baselines/models/bert_wwm_ext/run_squad.py | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... | 46,532 | 35.240654 | 82 | py |
CLUE | CLUE-master/baselines/models/bert_wwm_ext/run_classifier.py | # -*- coding: utf-8 -*-
# @Author: bo.shi
# @Date: 2019-11-04 09:56:36
# @Last Modified by: bo.shi
# @Last Modified time: 2019-12-04 14:30:10
# coding=utf-8
# Copyright 2018 The Google AI Language Team Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in... | 36,156 | 36.313725 | 123 | py |
CLUE | CLUE-master/baselines/models/bert_wwm_ext/tf_metrics.py | """
Multiclass
from:
https://github.com/guillaumegenthial/tf_metrics/blob/master/tf_metrics/__init__.py
"""
__author__ = "Guillaume Genthial"
import numpy as np
import tensorflow as tf
from tensorflow.python.ops.metrics_impl import _streaming_confusion_matrix
def precision(labels, predictions, num_classes, pos_in... | 8,188 | 37.088372 | 82 | py |
CLUE | CLUE-master/baselines/models/bert_wwm_ext/tokenization.py | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... | 12,257 | 29.645 | 80 | py |
CLUE | CLUE-master/baselines/models/bert_wwm_ext/modeling.py | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... | 37,922 | 37.422492 | 93 | py |
CLUE | CLUE-master/baselines/models/bert_wwm_ext/extract_features.py | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... | 13,898 | 32.092857 | 82 | py |
CLUE | CLUE-master/baselines/models/bert_wwm_ext/modeling_test.py | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... | 9,191 | 32.064748 | 78 | py |
CLUE | CLUE-master/baselines/models/bert_wwm_ext/conlleval.py | # Python version of the evaluation script from CoNLL'00-
# Originates from: https://github.com/spyysalo/conlleval.py
# Intentional differences:
# - accept any space as delimiter by default
# - optional file argument (default STDIN)
# - option to set boundary (-b argument)
# - LaTeX output (-l argument) not supported
... | 10,196 | 32.99 | 83 | py |
CLUE | CLUE-master/baselines/models/bert_wwm_ext/optimization_test.py | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... | 1,721 | 34.142857 | 76 | py |
CLUE | CLUE-master/baselines/models/bert_wwm_ext/run_ner.py | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... | 33,811 | 39.014201 | 227 | py |
CLUE | CLUE-master/baselines/models/bert_wwm_ext/tokenization_test.py | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... | 4,589 | 32.26087 | 80 | py |
CLUE | CLUE-master/baselines/models/bert_wwm_ext/run_pretraining.py | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... | 18,667 | 36.789474 | 82 | py |
CLUE | CLUE-master/baselines/models/bert_wwm_ext/__init__.py | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... | 616 | 37.5625 | 74 | py |
CLUE | CLUE-master/baselines/models/bert_wwm_ext/create_pretraining_data.py | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... | 16,475 | 34.055319 | 80 | py |
CLUE | CLUE-master/baselines/models/bert/run_classifier_with_tfhub.py | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... | 11,426 | 35.27619 | 82 | py |
CLUE | CLUE-master/baselines/models/bert/optimization.py | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... | 6,258 | 34.765714 | 80 | py |
CLUE | CLUE-master/baselines/models/bert/run_squad.py | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... | 46,532 | 35.240654 | 82 | py |
CLUE | CLUE-master/baselines/models/bert/run_classifier.py | # -*- coding: utf-8 -*-
# @Author: bo.shi
# @Date: 2019-11-04 09:56:36
# @Last Modified by: bo.shi
# @Last Modified time: 2019-12-04 14:29:38
# coding=utf-8
# Copyright 2018 The Google AI Language Team Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in... | 36,213 | 36.218911 | 123 | py |
CLUE | CLUE-master/baselines/models/bert/tf_metrics.py | """
Multiclass
from:
https://github.com/guillaumegenthial/tf_metrics/blob/master/tf_metrics/__init__.py
"""
__author__ = "Guillaume Genthial"
import numpy as np
import tensorflow as tf
from tensorflow.python.ops.metrics_impl import _streaming_confusion_matrix
def precision(labels, predictions, num_classes, pos_in... | 8,188 | 37.088372 | 82 | py |
CLUE | CLUE-master/baselines/models/bert/tokenization.py | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... | 12,257 | 29.645 | 80 | py |
CLUE | CLUE-master/baselines/models/bert/modeling.py | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... | 37,922 | 37.422492 | 93 | py |
CLUE | CLUE-master/baselines/models/bert/extract_features.py | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... | 13,898 | 32.092857 | 82 | py |
CLUE | CLUE-master/baselines/models/bert/modeling_test.py | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... | 9,191 | 32.064748 | 78 | py |
CLUE | CLUE-master/baselines/models/bert/conlleval.py | # Python version of the evaluation script from CoNLL'00-
# Originates from: https://github.com/spyysalo/conlleval.py
# Intentional differences:
# - accept any space as delimiter by default
# - optional file argument (default STDIN)
# - option to set boundary (-b argument)
# - LaTeX output (-l argument) not supported
... | 10,196 | 32.99 | 83 | py |
CLUE | CLUE-master/baselines/models/bert/optimization_test.py | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... | 1,721 | 34.142857 | 76 | py |
CLUE | CLUE-master/baselines/models/bert/run_ner.py | # -*- coding: utf-8 -*-
# @Author: bo.shi
# @Date: 2019-11-06 17:40:44
# @Last Modified by: bo.shi
# @Last Modified time: 2019-11-07 10:28:29
# coding=utf-8
# Copyright 2018 The Google AI Language Team Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in... | 34,013 | 38.875733 | 227 | py |
CLUE | CLUE-master/baselines/models/bert/tokenization_test.py | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... | 4,589 | 32.26087 | 80 | py |
CLUE | CLUE-master/baselines/models/bert/run_pretraining.py | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... | 18,667 | 36.789474 | 82 | py |
CLUE | CLUE-master/baselines/models/bert/__init__.py | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... | 616 | 37.5625 | 74 | py |
CLUE | CLUE-master/baselines/models/bert/create_pretraining_data.py | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... | 16,475 | 34.055319 | 80 | py |
CLUE | CLUE-master/baselines/models/copa_sh/eval_copa.py | #coding:utf-8
import sys
test_file=sys.argv[1]
predict_label = []
tmp = []
for line in open(test_file, 'r').readlines():
ss = line.strip().split('\t')
if len(ss) == 2:
tmp.append(ss[1])
else:
print ('wrong format!!!: ' + line.strip())
i = 0
while(i < len(tmp)-1):
if tmp[i] >= tmp[i+1]:... | 1,117 | 22.787234 | 69 | py |
CLUE | CLUE-master/baselines/models/copa_sh/convert_test.py | #coding:utf-8
import sys
import json
test_file=sys.argv[1]
predict_label = []
tmp = []
for line in open(test_file, 'r').readlines():
ss = line.strip().split('\t')
if len(ss) == 2:
tmp.append(ss[1])
else:
print ('wrong format!!!: ' + line.strip())
i = 0
while(i < len(tmp)-1):
if tmp[i] ... | 633 | 19.451613 | 56 | py |
CLUE | CLUE-master/baselines/models_pytorch/classifier_pytorch/download_clue_data.py | """ Script for downloading all CLUE data.
For licence information, see the original dataset information links
available from: https://www.cluebenchmarks.com/
Example usage:
python download_clue_data.py --data_dir data --tasks all
"""
import os
import sys
import argparse
import urllib.request
import zipfile
TASKS = ... | 2,787 | 35.207792 | 96 | py |
CLUE | CLUE-master/baselines/models_pytorch/classifier_pytorch/run_classifier.py | # -*- coding: utf-8 -*-
# @Author: bo.shi
# @Date: 2019-12-30 19:26:53
# @Last Modified by: bo.shi
# @Last Modified time: 2019-12-31 19:49:36
""" Finetuning the library models for sequence classification on CLUE (Bert, ERNIE, XLNet, RoBERTa)."""
from __future__ import absolute_import, division, print_function
imp... | 31,505 | 54.273684 | 152 | py |
CLUE | CLUE-master/baselines/models_pytorch/classifier_pytorch/convert_albert_original_tf_checkpoint_to_pytorch.py | """Convert ALBERT checkpoint."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import argparse
import torch
from transformers.modeling_albert import BertConfig, AlbertForPreTraining, load_tf_weights_in_albert
import logging
logging.basicConfig(level=log... | 2,388 | 40.189655 | 110 | py |
CLUE | CLUE-master/baselines/models_pytorch/classifier_pytorch/convert_ernie_original_pad_checkpoint_to_pytorch.py | #!/usr/bin/env python
# encoding: utf-8
"""
File Description: https://github.com/nghuyong/ERNIE-Pytorch
Author: nghuyong
Mail: nghuyong@163.com
Created Time: 2020/7/14
"""
import collections
import os
import json
import shutil
import paddle.fluid.dygraph as D
import torch
from paddle import fluid
# downloading paddle... | 5,179 | 52.958333 | 118 | py |
CLUE | CLUE-master/baselines/models_pytorch/classifier_pytorch/convert_bert_original_tf_checkpoint_to_pytorch.py | """Convert BERT checkpoint."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import argparse
import torch
from transformers import BertConfig, BertForPreTraining, load_tf_weights_in_bert
import logging
logging.basicConfig(level=logging.INFO)
def conver... | 1,972 | 36.942308 | 101 | py |
CLUE | CLUE-master/baselines/models_pytorch/classifier_pytorch/convert_xlnet_original_tf_checkpoint_to_pytorch.py | """Convert XLNET checkpoint."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import argparse
import torch
from transformers import (CONFIG_NAME, WEIGHTS_NAME,
XLNetConfig,
XLNetLMHeadModel,
... | 2,480 | 39.016129 | 104 | py |
CLUE | CLUE-master/baselines/models_pytorch/classifier_pytorch/tools/common.py | import os
import random
import torch
import numpy as np
import json
import pickle
import torch.nn as nn
from collections import OrderedDict
from pathlib import Path
import logging
logger = logging.getLogger()
def print_config(config):
info = "Running with the following configs:\n"
for k, v in config.items():
... | 11,484 | 28.677003 | 128 | py |
CLUE | CLUE-master/baselines/models_pytorch/classifier_pytorch/tools/progressbar.py | import time
class ProgressBar(object):
'''
custom progress bar
Example:
>>> pbar = ProgressBar(n_total=30,desc='Training')
>>> step = 2
>>> pbar(step=step)
'''
def __init__(self, n_total,width=30,desc = 'Training'):
self.width = width
self.n_total = n_total
... | 2,021 | 32.7 | 90 | py |
CLUE | CLUE-master/baselines/models_pytorch/classifier_pytorch/metrics/__init__.py | 0 | 0 | 0 | py | |
CLUE | CLUE-master/baselines/models_pytorch/classifier_pytorch/metrics/clue_compute_metrics.py | import csv
import sys
import logging
logger = logging.getLogger(__name__)
try:
from scipy.stats import pearsonr, spearmanr
from sklearn.metrics import matthews_corrcoef, f1_score
_has_sklearn = True
except (AttributeError, ImportError) as e:
logger.warning("To use data.metrics please install scikit-le... | 1,775 | 30.714286 | 117 | py |
CLUE | CLUE-master/baselines/models_pytorch/classifier_pytorch/processors/utils.py | import csv
import sys
import copy
import json
class InputExample(object):
"""
A single training/test example for simple sequence classification.
Args:
guid: Unique id for the example.
text_a: string. The untokenized text of the first sequence. For single
sequence tasks, only this s... | 3,595 | 33.247619 | 98 | py |
CLUE | CLUE-master/baselines/models_pytorch/classifier_pytorch/processors/clue.py | # -*- coding: utf-8 -*-
# @Author: bo.shi
# @Date: 2019-12-30 19:26:53
# @Last Modified by: bo.shi
# @Last Modified time: 2020-01-01 11:39:23
""" CLUE processors and helpers """
import logging
import os
import torch
from .utils import DataProcessor, InputExample, InputFeatures
logger = logging.getLogger(__name__)... | 20,143 | 38.114563 | 130 | py |
CLUE | CLUE-master/baselines/models_pytorch/classifier_pytorch/processors/__init__.py | from .utils import InputExample, InputFeatures, DataProcessor
from .clue import (clue_output_modes, clue_processors, clue_tasks_num_labels,
clue_convert_examples_to_features, collate_fn, xlnet_collate_fn)
| 225 | 44.2 | 83 | py |
CLUE | CLUE-master/baselines/models_pytorch/classifier_pytorch/transformers/tokenization_roberta.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
#
# ... | 6,476 | 44.93617 | 119 | py |
CLUE | CLUE-master/baselines/models_pytorch/classifier_pytorch/transformers/configuration_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... | 8,112 | 43.576923 | 121 | py |
CLUE | CLUE-master/baselines/models_pytorch/classifier_pytorch/transformers/optimization.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... | 8,635 | 44.452632 | 130 | py |
CLUE | CLUE-master/baselines/models_pytorch/classifier_pytorch/transformers/configuration_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... | 6,805 | 38.80117 | 110 | py |
CLUE | CLUE-master/baselines/models_pytorch/classifier_pytorch/transformers/__main__.py | # coding: utf8
def main():
import sys
if (len(sys.argv) < 4 or len(sys.argv) > 6) or sys.argv[1] not in ["bert", "gpt", "transfo_xl", "gpt2", "xlnet", "xlm"]:
print(
"This command line utility let you convert original (author released) model checkpoint to pytorch.\n"
"It should be used a... | 7,082 | 53.484615 | 135 | py |
CLUE | CLUE-master/baselines/models_pytorch/classifier_pytorch/transformers/configuration_utils.py | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team.
# Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a cop... | 10,772 | 50.793269 | 296 | py |
CLUE | CLUE-master/baselines/models_pytorch/classifier_pytorch/transformers/modeling_distilbert.py | # coding=utf-8
# Copyright 2019-present, the HuggingFace Inc. team, The Google AI Language Team and Facebook, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.or... | 34,864 | 49.237752 | 201 | py |
CLUE | CLUE-master/baselines/models_pytorch/classifier_pytorch/transformers/tokenization_xlm.py | # coding=utf-8
# Copyright 2019 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
#
# ... | 37,149 | 43.544365 | 185 | py |
CLUE | CLUE-master/baselines/models_pytorch/classifier_pytorch/transformers/tokenization_ctrl.py | # coding=utf-8
# Copyright 2018 Salesforce 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
#
# Unless require... | 7,065 | 36.585106 | 133 | py |
CLUE | CLUE-master/baselines/models_pytorch/classifier_pytorch/transformers/configuration_bert.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... | 6,684 | 56.62931 | 181 | py |
CLUE | CLUE-master/baselines/models_pytorch/classifier_pytorch/transformers/modeling_utils.py | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team.
# Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a cop... | 43,409 | 52.06846 | 472 | py |
CLUE | CLUE-master/baselines/models_pytorch/classifier_pytorch/transformers/modeling_bert.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... | 59,643 | 50.864348 | 187 | py |
CLUE | CLUE-master/baselines/models_pytorch/classifier_pytorch/transformers/tokenization_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... | 7,496 | 58.976 | 372 | py |
CLUE | CLUE-master/baselines/models_pytorch/classifier_pytorch/transformers/configuration_distilbert.py | # coding=utf-8
# Copyright 2019-present, the HuggingFace Inc. team, The Google AI Language Team and Facebook, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.or... | 3,568 | 38.655556 | 152 | py |
CLUE | CLUE-master/baselines/models_pytorch/classifier_pytorch/transformers/modeling_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... | 33,126 | 48.965309 | 148 | py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.