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 |
|---|---|---|---|---|---|---|
nixpkgs | nixpkgs-master/pkgs/development/interpreters/python/tests/test_nix_pythonprefix/typeddep/setup.py | from setuptools import setup
setup(**{
'name': 'typeddep',
'version': '1.3.3.7',
'description': 'Minimal repro to test mypy and site prefixes with Nix',
'long_description': None,
'author': 'adisbladis',
'author_email': '[email protected]',
'maintainer': None,
'maintainer_email': None... | 494 | 25.052632 | 75 | py |
nixpkgs | nixpkgs-master/pkgs/development/interpreters/python/tests/test_nix_pythonprefix/typeddep/typeddep/util.py | def echo(s: str) -> str:
return s
| 38 | 12 | 24 | py |
nixpkgs | nixpkgs-master/pkgs/development/interpreters/python/tests/test_nix_pythonprefix/typeddep/typeddep/__init__.py | 0 | 0 | 0 | py | |
nixpkgs | nixpkgs-master/pkgs/development/interpreters/python/tests/test_environments/test_python.py | """
Python interpreter and environment tests.
These need to be executed with the standard library unittest.
Third party test runners such as pytest cannot be used because
that would interfere with the tests.
"""
import platform
import sys
import unittest
import site
ENV = "@env@"
INTERPRETER = "@interpreter@"
PYTHO... | 1,669 | 28.821429 | 113 | py |
nixpkgs | nixpkgs-master/pkgs/development/libraries/ndi/update.py | #!/usr/bin/env nix-shell
#! nix-shell -i python -p "python3.withPackages (ps: with ps; [ ps.absl-py ps.requests ])"
import hashlib
import io
import json
import os.path
import tarfile
import requests
from absl import app, flags
BASE_NAME = "Install_NDI_SDK_v5_Linux"
NDI_SDK_URL = f"https://downloads.ndi.tv/SDK/NDI_SD... | 2,046 | 25.24359 | 90 | py |
nixpkgs | nixpkgs-master/pkgs/development/libraries/libxcrypt/check_passthru_matches.py | import tarfile
import sys
def process_columns(line: list[str]) -> tuple[str, list[str]]:
match line:
case [name, h_prefix, nrbytes, flags]:
return (h_prefix, flags.lower().split(","))
case other:
raise Exception("Unsupported hashes.conf line format", other)
def find_tar_f... | 2,448 | 33.492958 | 177 | py |
nixpkgs | nixpkgs-master/pkgs/development/node-packages/remove-attr.py | #!/usr/bin/env nix-shell
#!nix-shell -i python3 -p
import collections.abc
import fileinput
import json
import os.path
import re
import sys
def remove(attr):
with open(os.path.join(os.path.dirname(__file__), 'node-packages.json'), 'r+') as node_packages_json:
packages = json.load(node_packages_json)
... | 1,813 | 31.981818 | 138 | py |
nixpkgs | nixpkgs-master/pkgs/development/compilers/llvm/update-git.py | #! /usr/bin/env nix-shell
#! nix-shell -i python3 -p python3 nix
import csv
import fileinput
import json
import os
import re
import subprocess
import sys
from codecs import iterdecode
from datetime import datetime
from urllib.request import urlopen, Request
DEFAULT_NIX = os.path.join(os.path.dirname(os.path.abspath... | 3,611 | 39.58427 | 163 | py |
nixpkgs | nixpkgs-master/pkgs/development/compilers/semeru-bin/generate-sources.py | #!/usr/bin/env nix-shell
#!nix-shell --pure -i python3 -p "python3.withPackages (ps: with ps; [ requests ])"
import json
import re
import requests
import sys
feature_versions = (8, 11, 16, 17)
oses = ("mac", "linux")
types = ("jre", "jdk")
impls = ("openj9")
arch_to_nixos = {
"x64": ("x86_64",),
"aarch64": (... | 3,152 | 35.662791 | 335 | py |
nixpkgs | nixpkgs-master/pkgs/development/compilers/adoptopenjdk-bin/generate-sources.py | #!/usr/bin/env nix-shell
#!nix-shell --pure -i python3 -p "python3.withPackages (ps: with ps; [ requests ])"
import json
import re
import requests
import sys
# openjdk15 is only for bootstrapping openjdk
releases = ("openjdk8", "openjdk11", "openjdk13", "openjdk14", "openjdk15", "openjdk16", "openjdk17")
oses = ("mac... | 2,313 | 32.536232 | 116 | py |
nixpkgs | nixpkgs-master/pkgs/development/compilers/temurin-bin/generate-sources.py | #!/usr/bin/env nix-shell
#!nix-shell --pure -i python3 -p "python3.withPackages (ps: with ps; [ requests ])"
import json
import re
import requests
import sys
feature_versions = (8, 11, 16, 17, 18, 19, 20)
oses = ("mac", "linux", "alpine-linux")
types = ("jre", "jdk")
impls = ("hotspot")
arch_to_nixos = {
"x64": ... | 2,347 | 31.164384 | 145 | py |
nixpkgs | nixpkgs-master/maintainers/scripts/pluginupdate.py | # python library used to update plugins:
# - pkgs/applications/editors/vim/plugins/update.py
# - pkgs/applications/editors/kakoune/plugins/update.py
# - maintainers/scripts/update-luarocks-packages
# format:
# $ nix run nixpkgs.python3Packages.black -c black update.py
# type-check:
# $ nix run nixpkgs.python3Packages.... | 24,750 | 31.782781 | 105 | py |
nixpkgs | nixpkgs-master/maintainers/scripts/update.py | from __future__ import annotations
from typing import Dict, Generator, List, Optional, Tuple
import argparse
import asyncio
import contextlib
import json
import os
import re
import subprocess
import sys
import tempfile
class CalledProcessError(Exception):
process: asyncio.subprocess.Process
class UpdateFailedExce... | 10,275 | 40.435484 | 255 | py |
nixpkgs | nixpkgs-master/maintainers/scripts/remove-old-aliases.py | #!/usr/bin/env nix-shell
#!nix-shell -i python3 -p "python3.withPackages(ps: with ps; [ ])" nix
"""
A program to remove old aliases or convert old aliases to throws
Example usage:
./maintainers/scripts/remove-old-aliases.py --year 2018 --file ./pkgs/top-level/aliases.nix
Check this file with mypy after every change!
$... | 6,845 | 31.140845 | 91 | py |
nixpkgs | nixpkgs-master/maintainers/scripts/hydra-eval-failures.py | #!/usr/bin/env nix-shell
#!nix-shell -i python3 -p "python3.withPackages(ps: with ps; [ requests pyquery click ])"
# To use, just execute this script with --help to display help.
import subprocess
import json
import sys
import click
import requests
from pyquery import PyQuery as pq
def map_dict (f, d):
for k,v ... | 3,168 | 27.044248 | 108 | py |
nixpkgs | nixpkgs-master/maintainers/scripts/doc/escape-code-markup.py | #! /usr/bin/env nix-shell
#! nix-shell -I nixpkgs=channel:nixos-unstable -i python3 -p python3 -p python3.pkgs.lxml
"""
Pandoc will strip any markup within code elements so
let’s escape them so that they can be handled manually.
"""
import lxml.etree as ET
import re
import sys
def replace_element_by_text(el: ET.Elem... | 2,973 | 29.346939 | 94 | py |
nixpkgs | nixpkgs-master/maintainers/scripts/doc/replace-xrefs-by-empty-links.py | #! /usr/bin/env nix-shell
#! nix-shell -I nixpkgs=channel:nixos-unstable -i python3 -p python3 -p python3.pkgs.lxml
"""
Pandoc will try to resolve xrefs and replace them with regular links.
let’s replace them with links with empty labels which MyST
and our pandoc filters recognize as cross-references.
"""
import lxml... | 928 | 27.151515 | 89 | py |
nixpkgs | nixpkgs-master/nixos/modules/services/misc/taskserver/helper-tool.py | import grp
import json
import pwd
import os
import re
import string
import subprocess
import sys
from contextlib import contextmanager
from shutil import rmtree
from tempfile import NamedTemporaryFile
import click
IS_AUTO_CONFIG = @isAutoConfig@ # NOQA
CERTTOOL_COMMAND = "@certtool@"
CERT_BITS = "@certBits@"
CLIENT_... | 19,986 | 28.008708 | 79 | py |
nixpkgs | nixpkgs-master/nixos/modules/services/x11/display-managers/set-session.py | #!/usr/bin/env python
import gi, argparse, os, logging, sys
gi.require_version("AccountsService", "1.0")
from gi.repository import AccountsService, GLib
from ordered_set import OrderedSet
def get_session_file(session):
system_data_dirs = GLib.get_system_data_dirs()
session_dirs = OrderedSet(
os.pat... | 2,758 | 29.655556 | 112 | py |
nixpkgs | nixpkgs-master/nixos/modules/virtualisation/includes-to-excludes.py |
# Convert a list of strings to a regex that matches everything but those strings
# ... and it had to be a POSIX regex; no negative lookahead :(
# This is a workaround for erofs supporting only exclude regex, not an include list
import sys
import re
from collections import defaultdict
# We can configure this script t... | 2,465 | 27.344828 | 263 | py |
nixpkgs | nixpkgs-master/nixos/modules/system/boot/loader/systemd-boot/systemd-boot-builder.py | #! @python3@/bin/python3 -B
import argparse
import shutil
import os
import sys
import errno
import subprocess
import glob
import tempfile
import errno
import warnings
import ctypes
libc = ctypes.CDLL("libc.so.6")
import re
import datetime
import glob
import os.path
from typing import NamedTuple, List, Optional
from pac... | 14,083 | 40.181287 | 142 | py |
nixpkgs | nixpkgs-master/nixos/tests/spark/spark_sample.py | from pyspark.sql import Row, SparkSession
from pyspark.sql import functions as F
from pyspark.sql.functions import udf
from pyspark.sql.types import *
from pyspark.sql.functions import explode
def explode_col(weight):
return int(weight//10) * [10.0] + ([] if weight%10==0 else [weight%10])
spark = SparkSession.bui... | 1,325 | 31.341463 | 88 | py |
nixpkgs | nixpkgs-master/nixos/tests/google-oslogin/server.py | #!/usr/bin/env python3
import json
import sys
import time
import os
import hashlib
import base64
from http.server import BaseHTTPRequestHandler, HTTPServer
from urllib.parse import urlparse, parse_qs
from typing import Dict
SNAKEOIL_PUBLIC_KEY = os.environ['SNAKEOIL_PUBLIC_KEY']
MOCKUSER="mockuser_nixos_org"
MOCKADMI... | 4,983 | 33.136986 | 154 | py |
nixpkgs | nixpkgs-master/nixos/tests/pam/test_chfn.py | expected_lines = {
"account required pam_unix.so",
"account sufficient @@pam_krb5@@/lib/security/pam_krb5.so",
"auth [default=die success=done] @@pam_ccreds@@/lib/security/pam_ccreds.so action=validate use_first_pass",
"auth [default=ignore success=1 service_err=reset] @@pam_krb5@@/lib/security/pam_krb5... | 1,474 | 51.678571 | 111 | py |
nixpkgs | nixpkgs-master/nixos/lib/test-script-prepend.py | # This file contains type hints that can be prepended to Nix test scripts so they can be type
# checked.
from test_driver.driver import Driver
from test_driver.vlan import VLan
from test_driver.machine import Machine
from test_driver.logger import Logger
from typing import Callable, Iterator, ContextManager, Optional,... | 1,380 | 31.116279 | 93 | py |
nixpkgs | nixpkgs-master/nixos/lib/make-options-doc/mergeJSON.py | import collections
import json
import os
import sys
from typing import Any, Dict, List
JSON = Dict[str, Any]
class Key:
def __init__(self, path: List[str]):
self.path = path
def __hash__(self):
result = 0
for id in self.path:
result ^= hash(id)
return result
def... | 3,606 | 33.352381 | 129 | py |
nixpkgs | nixpkgs-master/nixos/lib/test-driver/setup.py | from setuptools import setup, find_packages
setup(
name="nixos-test-driver",
version='1.1',
packages=find_packages(),
package_data={"test_driver": ["py.typed"]},
entry_points={
"console_scripts": [
"nixos-test-driver=test_driver:main",
"generate-driver-symbols=test_driver:generate_driver_symb... | 338 | 21.6 | 67 | py |
nixpkgs | nixpkgs-master/nixos/lib/test-driver/test_driver/machine.py | from contextlib import _GeneratorContextManager, nullcontext
from pathlib import Path
from queue import Queue
from typing import Any, Callable, Dict, Iterable, List, Optional, Tuple
import base64
import io
import os
import queue
import re
import select
import shlex
import shutil
import socket
import subprocess
import s... | 36,389 | 32.725672 | 93 | py |
nixpkgs | nixpkgs-master/nixos/lib/test-driver/test_driver/driver.py | from contextlib import contextmanager
from pathlib import Path
from typing import Any, Dict, Iterator, List, Union, Optional, Callable, ContextManager
import os
import re
import tempfile
from test_driver.logger import rootlog
from test_driver.machine import Machine, NixStartScript, retry
from test_driver.vlan import V... | 7,887 | 32.423729 | 94 | py |
nixpkgs | nixpkgs-master/nixos/lib/test-driver/test_driver/polling_condition.py | from typing import Callable, Optional
from math import isfinite
import time
from .logger import rootlog
class PollingConditionFailed(Exception):
pass
class PollingCondition:
condition: Callable[[], bool]
seconds_interval: float
description: Optional[str]
last_called: float
entry_count: int... | 2,711 | 28.16129 | 93 | py |
nixpkgs | nixpkgs-master/nixos/lib/test-driver/test_driver/logger.py | from colorama import Style, Fore
from contextlib import contextmanager
from typing import Any, Dict, Iterator
from queue import Queue, Empty
from xml.sax.saxutils import XMLGenerator
import codecs
import os
import sys
import time
import unicodedata
class Logger:
def __init__(self) -> None:
self.logfile = ... | 3,294 | 30.682692 | 86 | py |
nixpkgs | nixpkgs-master/nixos/lib/test-driver/test_driver/__init__.py | from pathlib import Path
import argparse
import ptpython.repl
import os
import time
from test_driver.logger import rootlog
from test_driver.driver import Driver
class EnvDefault(argparse.Action):
"""An argpars Action that takes values from the specified
environment variable as the flags default value.
""... | 4,097 | 31.267717 | 99 | py |
nixpkgs | nixpkgs-master/nixos/lib/test-driver/test_driver/vlan.py | from pathlib import Path
import io
import os
import pty
import subprocess
from test_driver.logger import rootlog
class VLan:
"""This class handles a VLAN that the run-vm scripts identify via its
number handles. The network's lifetime equals the object's lifetime.
"""
nr: int
socket_dir: Path
... | 1,951 | 29.984127 | 80 | py |
DeeBERT | DeeBERT-master/setup.py | """
Simple check list from AllenNLP repo: https://github.com/allenai/allennlp/blob/master/setup.py
To create the package for pypi.
1. Change the version in __init__.py, setup.py as well as docs/source/conf.py.
2. Commit these changes with the message: "Release: VERSION"
3. Add a tag in git to mark the release: "git... | 2,923 | 39.054795 | 183 | py |
DeeBERT | DeeBERT-master/hubconf.py | from transformers import (
AutoTokenizer, AutoConfig, AutoModel, AutoModelWithLMHead, AutoModelForSequenceClassification, AutoModelForQuestionAnswering
)
from transformers.file_utils import add_start_docstrings
dependencies = ['torch', 'tqdm', 'boto3', 'requests', 'regex', 'sentencepiece', 'sacremoses']
@add_star... | 6,489 | 56.433628 | 189 | py |
DeeBERT | DeeBERT-master/examples/run_lm_finetuning.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... | 28,845 | 50.881295 | 165 | py |
DeeBERT | DeeBERT-master/examples/utils_squad_evaluate.py | """ Official evaluation script for SQuAD version 2.0.
Modified by XLNet authors to update `find_best_threshold` scripts for SQuAD V2.0
In addition to basic functionality, we also compute additional statistics and
plot precision-recall curves if an additional na_prob.json file is provided.
This file is expected to ... | 12,493 | 36.746224 | 107 | py |
DeeBERT | DeeBERT-master/examples/run_squad.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... | 31,570 | 54.001742 | 151 | py |
DeeBERT | DeeBERT-master/examples/run_highway_glue.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... | 33,078 | 51.423138 | 158 | py |
DeeBERT | DeeBERT-master/examples/utils_multiple_choice.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... | 15,268 | 36.701235 | 116 | py |
DeeBERT | DeeBERT-master/examples/run_glue.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... | 28,140 | 52.398482 | 158 | py |
DeeBERT | DeeBERT-master/examples/benchmarks.py | # coding=utf-8
# Copyright 2018 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 copy of the License at
#
# http://www.a... | 23,631 | 48.439331 | 138 | py |
DeeBERT | DeeBERT-master/examples/run_summarization_finetuning.py | # coding=utf-8
# Copyright 2019 The HuggingFace Inc. team.
# Copyright (c) 2019 The HuggingFace Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.a... | 15,727 | 30.902637 | 120 | py |
DeeBERT | DeeBERT-master/examples/run_bertology.py | #!/usr/bin/env python3
# Copyright 2018 CMU 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 requir... | 18,901 | 51.798883 | 177 | py |
DeeBERT | DeeBERT-master/examples/utils_summarization_test.py | # coding=utf-8
# Copyright 2019 HuggingFace Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | 5,178 | 36.80292 | 98 | py |
DeeBERT | DeeBERT-master/examples/run_generation.py | #!/usr/bin/env python3
# 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 c... | 13,112 | 49.241379 | 167 | py |
DeeBERT | DeeBERT-master/examples/run_ner.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... | 28,786 | 53.009381 | 184 | py |
DeeBERT | DeeBERT-master/examples/utils_summarization.py | from collections import deque
import os
import torch
from torch.utils.data import Dataset
# ------------
# Data loading
# ------------
class CNNDailyMailDataset(Dataset):
""" Abstracts the dataset used to train seq2seq models.
CNN/Daily News:
The CNN/Daily News raw datasets are downloaded from [1]. T... | 6,022 | 31.556757 | 88 | py |
DeeBERT | DeeBERT-master/examples/run_tf_glue.py | import os
import tensorflow as tf
import tensorflow_datasets
from transformers import BertTokenizer, TFBertForSequenceClassification, BertConfig, glue_convert_examples_to_features, BertForSequenceClassification, glue_processors
# script parameters
BATCH_SIZE = 32
EVAL_BATCH_SIZE = BATCH_SIZE * 2
USE_XLA = False
USE_AM... | 3,978 | 41.329787 | 166 | py |
DeeBERT | DeeBERT-master/examples/test_examples.py | # coding=utf-8
# Copyright 2018 HuggingFace Inc..
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | 4,166 | 36.205357 | 88 | py |
DeeBERT | DeeBERT-master/examples/__init__.py | 0 | 0 | 0 | py | |
DeeBERT | DeeBERT-master/examples/run_multiple_choice.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... | 29,296 | 50.945035 | 168 | py |
DeeBERT | DeeBERT-master/examples/utils_ner.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... | 9,181 | 42.107981 | 109 | py |
DeeBERT | DeeBERT-master/examples/utils_squad.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 co... | 42,376 | 40.627701 | 112 | py |
DeeBERT | DeeBERT-master/examples/contrib/run_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,742 | 42.785714 | 111 | py |
DeeBERT | DeeBERT-master/examples/contrib/run_swag.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... | 31,683 | 45.731563 | 154 | py |
DeeBERT | DeeBERT-master/examples/contrib/run_openai_gpt.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... | 14,471 | 48.731959 | 132 | py |
DeeBERT | DeeBERT-master/examples/contrib/run_camembert.py | from pathlib import Path
import tarfile
import urllib.request
import torch
from transformers.tokenization_camembert import CamembertTokenizer
from transformers.modeling_camembert import CamembertForMaskedLM
def fill_mask(masked_input, model, tokenizer, topk=5):
# Adapted from https://github.com/pytorch/fairseq/... | 2,015 | 40.142857 | 114 | py |
DeeBERT | DeeBERT-master/examples/distillation/grouped_batch_sampler.py | # coding=utf-8
# Copyright 2019-present, the HuggingFace Inc. 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.org/licenses/LICENSE-2.0
#
# Un... | 4,368 | 40.216981 | 125 | py |
DeeBERT | DeeBERT-master/examples/distillation/utils.py | # coding=utf-8
# Copyright 2019-present, the HuggingFace Inc. 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.org/licenses/LICENSE-2.0
#
# Un... | 4,308 | 32.146154 | 104 | py |
DeeBERT | DeeBERT-master/examples/distillation/lm_seqs_dataset.py | # coding=utf-8
# Copyright 2019-present, the HuggingFace Inc. 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.org/licenses/LICENSE-2.0
#
# Un... | 5,453 | 34.881579 | 111 | py |
DeeBERT | DeeBERT-master/examples/distillation/run_squad_w_distillation.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... | 33,733 | 55.129784 | 151 | py |
DeeBERT | DeeBERT-master/examples/distillation/train.py | # coding=utf-8
# Copyright 2019-present, 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 a... | 13,598 | 45.731959 | 135 | py |
DeeBERT | DeeBERT-master/examples/distillation/distiller.py | # coding=utf-8
# Copyright 2019-present, the HuggingFace Inc. 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.org/licenses/LICENSE-2.0
#
# Un... | 25,933 | 46.848708 | 163 | py |
DeeBERT | DeeBERT-master/examples/distillation/scripts/token_counts.py | # coding=utf-8
# Copyright 2019-present, 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 a... | 2,062 | 38.673077 | 129 | py |
DeeBERT | DeeBERT-master/examples/distillation/scripts/extract.py | # coding=utf-8
# Copyright 2019-present, 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 a... | 4,326 | 47.077778 | 158 | py |
DeeBERT | DeeBERT-master/examples/distillation/scripts/extract_distilbert.py | # coding=utf-8
# Copyright 2019-present, 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 a... | 4,255 | 50.277108 | 158 | py |
DeeBERT | DeeBERT-master/examples/distillation/scripts/binarized_data.py | # coding=utf-8
# Copyright 2019-present, 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 a... | 3,630 | 38.043011 | 140 | py |
DeeBERT | DeeBERT-master/templates/adding_a_new_model/modeling_xxx.py | # coding=utf-8
# Copyright 2018 XXX 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 applicable law or agreed ... | 34,579 | 51.473445 | 151 | py |
DeeBERT | DeeBERT-master/templates/adding_a_new_model/tokenization_xxx.py | # coding=utf-8
# Copyright 2018 XXX 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 applicable law or agreed... | 9,578 | 42.739726 | 117 | py |
DeeBERT | DeeBERT-master/templates/adding_a_new_model/configuration_xxx.py | # coding=utf-8
# Copyright 2010, XXX 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 applicable law or agreed... | 5,273 | 39.259542 | 128 | py |
DeeBERT | DeeBERT-master/templates/adding_a_new_model/convert_xxx_original_tf_checkpoint_to_pytorch.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,565 | 37.878788 | 100 | py |
DeeBERT | DeeBERT-master/templates/adding_a_new_model/modeling_tf_xxx.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... | 27,575 | 53.605941 | 193 | py |
DeeBERT | DeeBERT-master/templates/adding_a_new_model/tests/tokenization_xxx_test.py | # coding=utf-8
# Copyright 2018 XXX 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 applicable law or agreed... | 2,092 | 35.086207 | 90 | py |
DeeBERT | DeeBERT-master/templates/adding_a_new_model/tests/modeling_tf_xxx_test.py | # coding=utf-8
# Copyright 2018 XXX 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 applicable law or agreed... | 11,411 | 43.404669 | 160 | py |
DeeBERT | DeeBERT-master/templates/adding_a_new_model/tests/modeling_xxx_test.py | # coding=utf-8
# Copyright 2018 XXX 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 applicable law or agreed... | 11,628 | 44.425781 | 160 | py |
DeeBERT | DeeBERT-master/templates/adding_a_new_example_script/utils_xxx.py |
# coding=utf-8
# Copyright 2018 XXX. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | 41,415 | 40.582329 | 112 | py |
DeeBERT | DeeBERT-master/templates/adding_a_new_example_script/run_xxx.py | # coding=utf-8
# Copyright 2018 XXX. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | 30,654 | 53.741071 | 151 | py |
DeeBERT | DeeBERT-master/docs/source/conf.py | # -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# http://www.sphinx-doc.org/en/master/config
# -- Path setup ------------------------------------------------------------... | 5,609 | 28.68254 | 79 | py |
DeeBERT | DeeBERT-master/transformers/modeling_encoder_decoder.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... | 15,827 | 49.893891 | 472 | py |
DeeBERT | DeeBERT-master/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
#
# ... | 7,300 | 47.673333 | 120 | py |
DeeBERT | DeeBERT-master/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 |
DeeBERT | DeeBERT-master/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... | 7,658 | 44.052941 | 134 | py |
DeeBERT | DeeBERT-master/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 |
DeeBERT | DeeBERT-master/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,085 | 53.507692 | 135 | py |
DeeBERT | DeeBERT-master/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,830 | 50.822967 | 296 | py |
DeeBERT | DeeBERT-master/transformers/modeling_tf_pytorch_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... | 12,356 | 41.610345 | 166 | py |
DeeBERT | DeeBERT-master/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... | 39,452 | 49.710797 | 201 | py |
DeeBERT | DeeBERT-master/transformers/configuration_camembert.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,222 | 34.970588 | 103 | py |
DeeBERT | DeeBERT-master/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 |
DeeBERT | DeeBERT-master/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,964 | 31.777778 | 133 | py |
DeeBERT | DeeBERT-master/transformers/modeling_tf_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... | 32,228 | 49.834385 | 193 | py |
DeeBERT | DeeBERT-master/transformers/modeling_tf_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... | 36,425 | 45.820051 | 193 | py |
DeeBERT | DeeBERT-master/transformers/tokenization_camembert.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... | 7,409 | 45.898734 | 124 | py |
DeeBERT | DeeBERT-master/transformers/modeling_tf_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,704 | 70.970588 | 472 | py |
DeeBERT | DeeBERT-master/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 |
DeeBERT | DeeBERT-master/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... | 44,706 | 51.596471 | 472 | py |
DeeBERT | DeeBERT-master/transformers/modeling_highway_bert.py | import torch
from torch import nn
from torch.nn import CrossEntropyLoss, MSELoss
from .modeling_bert import BertLayer, BertLayerNorm, BertPreTrainedModel
def entropy(x):
# x: torch.Tensor, logits BEFORE softmax
x = torch.softmax(x, dim=-1) # softmax normalized prob distribution
return -torc... | 22,285 | 48.414634 | 150 | py |
DeeBERT | DeeBERT-master/transformers/modeling_tf_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,118 | 49.535235 | 193 | py |
DeeBERT | DeeBERT-master/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... | 67,826 | 52.239403 | 187 | py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.