id int64 0 190k | prompt stringlengths 21 13.4M | docstring stringlengths 1 12k ⌀ |
|---|---|---|
18,227 | import datetime
import sys
import logging
import urllib
import urlparse
from tornado import template
import tornado.httpserver
import tornado.ioloop
import tornado.web
import tornado.wsgi
import tornado.escape
import tornado.options
import os
The provided code snippet includes necessary dependencies for implementing t... | attempts to add spaces in a SQLi so it renders nicely on the webpage |
18,228 | import datetime
import sys
import logging
import urllib
import urlparse
from tornado import template
import tornado.httpserver
import tornado.ioloop
import tornado.web
import tornado.wsgi
import tornado.escape
import tornado.options
def chunks(l, n):
import os
def breakify(s):
output = ""
for c in chunks(s, 20... | null |
18,229 | import datetime
import sys
import logging
import urllib
import urlparse
try:
import libinjection
except:
pass
from tornado import template
import tornado.httpserver
import tornado.ioloop
import tornado.web
import tornado.wsgi
import tornado.escape
import tornado.options
def print_token(tok):
"""
prints ... | null |
18,230 | import sys
import re
import libinjection
import urllib
import urlparse
logre = re.compile(r' /diagnostics\?([^ ]+) HTTP')
notsqli = set([
'1ov',
'UEvEv',
'v',
'Uv',
'Uv,',
'UoEvE',
'1v',
'sov',
'1nn',
'UonnE',
'no1',
'Evk',
'E1k',
'E11k',
'Ek',
'Uv,Ev',
'UvEvk',
'UvEv,',
'Uvon'
])
The provided code snippet includes ne... | ...GET /diagnostics?id=%22union+select HTTP/1.1 |
18,231 | import sys
import logging
import urllib
import tornado.httpserver
import tornado.ioloop
import tornado.web
import libinjection
import os
def boring(arg):
if arg == '':
return True
if arg == 'foo':
return True
if arg == 'NULL':
return True
try:
float(arg)
retur... | null |
18,232 | import datetime
import json
import sys
from urlparse import *
import urllib
import libinjection
from tornado import template
from tornado.escape import *
import re
import calendar
def chunks(l, n):
"""
Yield successive n-sized chunks from l.
"""
for i in xrange(0, len(l), n):
yield l[i:i+n]
def... | null |
18,233 | import datetime
import json
import sys
from urlparse import *
import urllib
import libinjection
from tornado import template
from tornado.escape import *
import re
import calendar
def parse_apache(line):
mo = apachelogre.match(line)
if not mo:
return None
(time_iso, timestamp) = parse_date(mo.group(... | null |
18,234 | import os
import re
import sys
def load_files(path):
file_contents = {}
for root, _, files in os.walk(path):
for file in files:
if file.endswith(".lua"):
p = os.path.join(root.replace(path, ""), file).lstrip("/")
with open(os.path.join(root, file)) as f:
... | null |
18,235 | import os
import re
import sys
token = "[a-zA-Z0-9_]"
def find_cdefs(files):
cdefs = {
"funcs": {},
"types": {},
}
for path, lines in files.items():
start = False
for i in range(len(lines)):
line = lines[i]
if "ffi.cdef" in line:
star... | null |
18,236 | import os
import re
import sys
token = "[a-zA-Z0-9_]"
ignore_list = [
"OSSL_PARAM_(?:set|get)_",
"PEM_read_bio_",
"fake_openssl_",
"(?:d2i|i2d)_(?:PUBKEY|PrivateKey)_bio",
"_(?:gettable|settable)_params",
"_(?:get|set)_params",
"_do_all_(?:sorted|provided)",
"_get0_name",
]
def check_cd... | null |
18,237 | import os
import re
import sys
token = "[a-zA-Z0-9_]"
def display(unused, undefined):
for name, tokens in unused.items():
if len(tokens) == 0:
continue
print(f"Unused {name} ({len(tokens)}):")
for token, path in tokens.items():
print(f" {token} on {path}")
for... | null |
18,238 | types = {
"BASIC_CONSTRAINTS": {
"ca": "ca_bool_int",
"pathlen": "ASN1_INTEGER",
},
}
getter_conv_tmpl = {
"ca_bool_int": "ctx.{k} == 0xFF",
"ASN1_INTEGER": "tonumber(C.ASN1_INTEGER_get(ctx.{k}))",
}
c2t_assign_locals = '''
local {k} = {conv}'''
c2t_return_table = '''
{k} = {k},'... | null |
18,239 | types = {
"BASIC_CONSTRAINTS": {
"ca": "ca_bool_int",
"pathlen": "ASN1_INTEGER",
},
}
setter_conv_tmpl = {
"ca_bool_int": '''
toset.{k} = cfg_lower.{k} and 0xFF or 0''',
"ASN1_INTEGER": '''
local {k} = cfg_lower.{k} and tonumber(cfg_lower.{k})
if {k} then
C.ASN1_INTEGER_free(to... | null |
18,240 | from base64 import b64encode
from io import BytesIO
from os.path import join
from typing import List, Optional
from qrcode.main import QRCode
def check_settings(settings: dict, check: str) -> bool:
return any(setting["context"] == check for setting in settings.values()) | null |
18,241 | from contextlib import suppress
from os import _exit, getenv, listdir, sep, urandom
from os.path import basename, dirname, join
from secrets import choice
from string import ascii_letters, digits
from sys import path as sys_path, modules as sys_modules
from pathlib import Path
from bs4 import BeautifulSoup
from copy im... | null |
18,242 | from contextlib import suppress
from os import _exit, getenv, listdir, sep, urandom
from os.path import basename, dirname, join
from secrets import choice
from string import ascii_letters, digits
from sys import path as sys_path, modules as sys_modules
from pathlib import Path
from bs4 import BeautifulSoup
from copy im... | Set the Content-Security-Policy header to prevent XSS attacks. |
18,243 | from contextlib import suppress
from os import _exit, getenv, listdir, sep, urandom
from os.path import basename, dirname, join
from secrets import choice
from string import ascii_letters, digits
from sys import path as sys_path, modules as sys_modules
from pathlib import Path
from bs4 import BeautifulSoup
from copy im... | null |
18,244 | from contextlib import suppress
from os import _exit, getenv, listdir, sep, urandom
from os.path import basename, dirname, join
from secrets import choice
from string import ascii_letters, digits
from sys import path as sys_path, modules as sys_modules
from pathlib import Path
from bs4 import BeautifulSoup
from copy im... | It takes a CSRFError exception as an argument, and returns a Flask response :param e: The exception object :return: A template with the error message and a 401 status code. |
18,245 | from contextlib import suppress
from os import _exit, getenv, listdir, sep, urandom
from os.path import basename, dirname, join
from secrets import choice
from string import ascii_letters, digits
from sys import path as sys_path, modules as sys_modules
from pathlib import Path
from bs4 import BeautifulSoup
from copy im... | null |
18,246 | from contextlib import suppress
from os import _exit, getenv, listdir, sep, urandom
from os.path import basename, dirname, join
from secrets import choice
from string import ascii_letters, digits
from sys import path as sys_path, modules as sys_modules
from pathlib import Path
from bs4 import BeautifulSoup
from copy im... | null |
18,247 | from contextlib import suppress
from os import _exit, getenv, listdir, sep, urandom
from os.path import basename, dirname, join
from secrets import choice
from string import ascii_letters, digits
from sys import path as sys_path, modules as sys_modules
from pathlib import Path
from bs4 import BeautifulSoup
from copy im... | null |
18,248 | from contextlib import suppress
from os import _exit, getenv, listdir, sep, urandom
from os.path import basename, dirname, join
from secrets import choice
from string import ascii_letters, digits
from sys import path as sys_path, modules as sys_modules
from pathlib import Path
from bs4 import BeautifulSoup
from copy im... | null |
18,249 | from contextlib import suppress
from os import _exit, getenv, listdir, sep, urandom
from os.path import basename, dirname, join
from secrets import choice
from string import ascii_letters, digits
from sys import path as sys_path, modules as sys_modules
from pathlib import Path
from bs4 import BeautifulSoup
from copy im... | null |
18,250 | from contextlib import suppress
from os import _exit, getenv, listdir, sep, urandom
from os.path import basename, dirname, join
from secrets import choice
from string import ascii_letters, digits
from sys import path as sys_path, modules as sys_modules
from pathlib import Path
from bs4 import BeautifulSoup
from copy im... | It returns the home page :return: The home.html template is being rendered with the following variables: check_version: a boolean indicating whether the local version is the same as the remote version remote_version: the remote version version: the local version instances_number: the number of instances services_number... |
18,251 | from contextlib import suppress
from os import _exit, getenv, listdir, sep, urandom
from os.path import basename, dirname, join
from secrets import choice
from string import ascii_letters, digits
from sys import path as sys_path, modules as sys_modules
from pathlib import Path
from bs4 import BeautifulSoup
from copy im... | null |
18,252 | from contextlib import suppress
from os import _exit, getenv, listdir, sep, urandom
from os.path import basename, dirname, join
from secrets import choice
from string import ascii_letters, digits
from sys import path as sys_path, modules as sys_modules
from pathlib import Path
from bs4 import BeautifulSoup
from copy im... | null |
18,253 | from contextlib import suppress
from os import _exit, getenv, listdir, sep, urandom
from os.path import basename, dirname, join
from secrets import choice
from string import ascii_letters, digits
from sys import path as sys_path, modules as sys_modules
from pathlib import Path
from bs4 import BeautifulSoup
from copy im... | null |
18,254 | from contextlib import suppress
from os import _exit, getenv, listdir, sep, urandom
from os.path import basename, dirname, join
from secrets import choice
from string import ascii_letters, digits
from sys import path as sys_path, modules as sys_modules
from pathlib import Path
from bs4 import BeautifulSoup
from copy im... | null |
18,255 | from contextlib import suppress
from os import _exit, getenv, listdir, sep, urandom
from os.path import basename, dirname, join
from secrets import choice
from string import ascii_letters, digits
from sys import path as sys_path, modules as sys_modules
from pathlib import Path
from bs4 import BeautifulSoup
from copy im... | null |
18,256 | from contextlib import suppress
from os import _exit, getenv, listdir, sep, urandom
from os.path import basename, dirname, join
from secrets import choice
from string import ascii_letters, digits
from sys import path as sys_path, modules as sys_modules
from pathlib import Path
from bs4 import BeautifulSoup
from copy im... | null |
18,257 | from contextlib import suppress
from os import _exit, getenv, listdir, sep, urandom
from os.path import basename, dirname, join
from secrets import choice
from string import ascii_letters, digits
from sys import path as sys_path, modules as sys_modules
from pathlib import Path
from bs4 import BeautifulSoup
from copy im... | null |
18,258 | from contextlib import suppress
from os import _exit, getenv, listdir, sep, urandom
from os.path import basename, dirname, join
from secrets import choice
from string import ascii_letters, digits
from sys import path as sys_path, modules as sys_modules
from pathlib import Path
from bs4 import BeautifulSoup
from copy im... | null |
18,259 | from contextlib import suppress
from os import _exit, getenv, listdir, sep, urandom
from os.path import basename, dirname, join
from secrets import choice
from string import ascii_letters, digits
from sys import path as sys_path, modules as sys_modules
from pathlib import Path
from bs4 import BeautifulSoup
from copy im... | null |
18,260 | from contextlib import suppress
from os import _exit, getenv, listdir, sep, urandom
from os.path import basename, dirname, join
from secrets import choice
from string import ascii_letters, digits
from sys import path as sys_path, modules as sys_modules
from pathlib import Path
from bs4 import BeautifulSoup
from copy im... | null |
18,261 | from contextlib import suppress
from os import _exit, getenv, listdir, sep, urandom
from os.path import basename, dirname, join
from secrets import choice
from string import ascii_letters, digits
from sys import path as sys_path, modules as sys_modules
from pathlib import Path
from bs4 import BeautifulSoup
from copy im... | null |
18,262 | from contextlib import suppress
from os import _exit, getenv, listdir, sep, urandom
from os.path import basename, dirname, join
from secrets import choice
from string import ascii_letters, digits
from sys import path as sys_path, modules as sys_modules
from pathlib import Path
from bs4 import BeautifulSoup
from copy im... | null |
18,263 | from contextlib import suppress
from os import _exit, getenv, listdir, sep, urandom
from os.path import basename, dirname, join
from secrets import choice
from string import ascii_letters, digits
from sys import path as sys_path, modules as sys_modules
from pathlib import Path
from bs4 import BeautifulSoup
from copy im... | null |
18,264 | from contextlib import suppress
from os import _exit, getenv, listdir, sep, urandom
from os.path import basename, dirname, join
from secrets import choice
from string import ascii_letters, digits
from sys import path as sys_path, modules as sys_modules
from pathlib import Path
from bs4 import BeautifulSoup
from copy im... | null |
18,265 | from glob import glob
from os import listdir, replace, sep, walk
from os.path import basename, dirname, join
from pathlib import Path
from re import compile as re_compile
from shutil import rmtree, move as shutil_move
from typing import Any, Dict, List, Tuple
from utils import path_to_dict
def generate_custom_configs(... | null |
18,266 | from argparse import ArgumentParser
from copy import deepcopy
from glob import glob
from hashlib import sha256
from io import BytesIO
from json import load as json_load
from os import _exit, chmod, environ, getenv, getpid, listdir, sep, walk
from os.path import basename, dirname, join, normpath
from pathlib import Path... | null |
18,267 | from argparse import ArgumentParser
from copy import deepcopy
from glob import glob
from hashlib import sha256
from io import BytesIO
from json import load as json_load
from os import _exit, chmod, environ, getenv, getpid, listdir, sep, walk
from os.path import basename, dirname, join, normpath
from pathlib import Path... | null |
18,268 | from argparse import ArgumentParser
from copy import deepcopy
from glob import glob
from hashlib import sha256
from io import BytesIO
from json import load as json_load
from os import _exit, chmod, environ, getenv, getpid, listdir, sep, walk
from os.path import basename, dirname, join, normpath
from pathlib import Path... | null |
18,269 | from argparse import ArgumentParser
from copy import deepcopy
from glob import glob
from hashlib import sha256
from io import BytesIO
from json import load as json_load
from os import _exit, chmod, environ, getenv, getpid, listdir, sep, walk
from os.path import basename, dirname, join, normpath
from pathlib import Path... | null |
18,270 | from argparse import ArgumentParser
from copy import deepcopy
from glob import glob
from hashlib import sha256
from io import BytesIO
from json import load as json_load
from os import _exit, chmod, environ, getenv, getpid, listdir, sep, walk
from os.path import basename, dirname, join, normpath
from pathlib import Path... | null |
18,271 | from argparse import ArgumentParser
from copy import deepcopy
from glob import glob
from hashlib import sha256
from io import BytesIO
from json import load as json_load
from os import _exit, chmod, environ, getenv, getpid, listdir, sep, walk
from os.path import basename, dirname, join, normpath
from pathlib import Path... | null |
18,272 | from argparse import ArgumentParser
from copy import deepcopy
from glob import glob
from hashlib import sha256
from io import BytesIO
from json import load as json_load
from os import _exit, chmod, environ, getenv, getpid, listdir, sep, walk
from os.path import basename, dirname, join, normpath
from pathlib import Path... | null |
18,273 | from argparse import ArgumentParser
from copy import deepcopy
from glob import glob
from hashlib import sha256
from io import BytesIO
from json import load as json_load
from os import _exit, chmod, environ, getenv, getpid, listdir, sep, walk
from os.path import basename, dirname, join, normpath
from pathlib import Path... | null |
18,274 | from os import _exit, getenv, sep
from os.path import join
from signal import SIGINT, SIGTERM, signal
from sys import exit as sys_exit, path as sys_path
from traceback import format_exc
from pathlib import Path
from logger import setup_logger
from SwarmController import SwarmController
from IngressController import In... | null |
18,275 | import fileinput, string, sys
def regexp_char(char, evasion):
def regexp_str(str, evasion):
# By convention, if the line starts with ' char, copy the rest
# verbatim.
if str[0] == "'":
return str[1:]
result = ''
for i, char in enumerate(str):
if i > 0:
result += evasion... | null |
18,276 | import argparse
args = parser.parse_args()
def commonprefix(m):
def flatten(dict):
def set(strings, index, flags):
def prepare(s, offset):
def run():
strings = args.strings
r = ""
r += set(strings, 0, "^")
c = ""
d = {}
# Only find common string if we have more than one
if len(strings) >... | null |
18,277 | from os import getenv, sep
from pathlib import Path
from requests import request as requests_request, ReadTimeout
from typing import Literal, Optional, Tuple, Union
def request(method: Union[Literal["POST"], Literal["GET"]], url: str, _id: Optional[str] = None) -> Tuple[bool, Optional[int], Union[str, dict]]:
data ... | null |
18,278 | from os import getenv, sep
from pathlib import Path
from requests import request as requests_request, ReadTimeout
from typing import Literal, Optional, Tuple, Union
def request(method: Union[Literal["POST"], Literal["GET"]], url: str, _id: Optional[str] = None) -> Tuple[bool, Optional[int], Union[str, dict]]:
data ... | null |
18,279 | from hashlib import sha256
from io import BytesIO
from os import getenv, listdir, chmod, _exit, sep
from os.path import basename, dirname, join, normpath
from pathlib import Path
from stat import S_IEXEC
from sys import exit as sys_exit, path as sys_path
from threading import Lock
from uuid import uuid4
from glob impor... | null |
18,280 | from contextlib import suppress
from ipaddress import ip_address, ip_network
from os import _exit, getenv, sep
from os.path import join, normpath
from pathlib import Path
from re import IGNORECASE, compile as re_compile
from sys import exit as sys_exit, path as sys_path
from traceback import format_exc
from typing impo... | null |
18,281 | from os import getenv, sep
from os.path import join, normpath
from pathlib import Path
from sys import exit as sys_exit, path as sys_path
from traceback import format_exc
from base64 import b64decode
from jobs import cache_file, cache_hash, file_hash
from Database import Database
from logger import setup_logger
logge... | null |
18,282 | from contextlib import suppress
from ipaddress import ip_address, ip_network
from os import _exit, getenv, sep
from os.path import join, normpath
from pathlib import Path
from re import IGNORECASE, compile as re_compile
from sys import exit as sys_exit, path as sys_path
from traceback import format_exc
from typing impo... | null |
18,283 | from os import _exit, environ, getenv, sep
from os.path import join
from pathlib import Path
from subprocess import DEVNULL, STDOUT, run, PIPE
from sys import exit as sys_exit, path as sys_path
from traceback import format_exc
from tarfile import open as tar_open
from io import BytesIO
from shutil import rmtree
from re... | null |
18,284 | from os import _exit, environ, getenv, sep
from os.path import join
from pathlib import Path
from subprocess import DEVNULL, STDOUT, run, PIPE
from sys import exit as sys_exit, path as sys_path
from traceback import format_exc
from tarfile import open as tar_open
from io import BytesIO
from shutil import rmtree
from re... | null |
18,285 | from contextlib import suppress
from ipaddress import ip_address, ip_network
from os import _exit, getenv, sep
from os.path import join, normpath
from pathlib import Path
from sys import exit as sys_exit, path as sys_path
from traceback import format_exc
from requests import get
from Database import Database
from logg... | null |
18,286 | from datetime import timedelta
from os import getenv, sep
from os.path import join
from pathlib import Path
from subprocess import DEVNULL, STDOUT, run
from sys import exit as sys_exit, path as sys_path
from threading import Lock
from traceback import format_exc
from typing import Tuple
from cryptography import x509
fr... | null |
18,288 | from dotenv import dotenv_values
from os import getenv, sep
from os.path import join
from pathlib import Path
from redis import StrictRedis
from sys import path as sys_path
from typing import Optional, Tuple
from API import API
from ApiCaller import ApiCaller
from logger import setup_logger
def format_remaining_time... | null |
18,289 | from os import getegid, geteuid
from pathlib import Path
from stat import (
S_IRGRP,
S_IROTH,
S_IRUSR,
S_IWGRP,
S_IWOTH,
S_IWUSR,
S_IXGRP,
S_IXOTH,
S_IXUSR,
)
from typing import List
def has_permissions(path: str, need_permissions: List[str]) -> bool:
uid = geteuid()
gid = g... | null |
18,290 | from argparse import ArgumentParser
from os import R_OK, X_OK, access, environ, getenv, sep
from os.path import join, normpath
from pathlib import Path
from re import compile as re_compile
from sys import exit as sys_exit, path as sys_path
from time import sleep
from traceback import format_exc
from typing import Any
f... | null |
18,291 | from contextlib import suppress
from datetime import datetime
from hashlib import sha512
from inspect import getsourcefile
from io import BufferedReader
from json import dumps, loads
from os.path import basename, normpath
from pathlib import Path
from sys import _getframe
from threading import Lock
from traceback impor... | null |
18,292 | from contextlib import suppress
from datetime import datetime
from hashlib import sha512
from inspect import getsourcefile
from io import BufferedReader
from json import dumps, loads
from os.path import basename, normpath
from pathlib import Path
from sys import _getframe
from threading import Lock
from traceback impor... | null |
18,293 | from contextlib import suppress
from datetime import datetime
from hashlib import sha512
from inspect import getsourcefile
from io import BufferedReader
from json import dumps, loads
from os.path import basename, normpath
from pathlib import Path
from sys import _getframe
from threading import Lock
from traceback impor... | null |
18,294 | from contextlib import suppress
from datetime import datetime
from hashlib import sha512
from inspect import getsourcefile
from io import BufferedReader
from json import dumps, loads
from os.path import basename, normpath
from pathlib import Path
from sys import _getframe
from threading import Lock
from traceback impor... | null |
18,295 | from logging import (
CRITICAL,
DEBUG,
ERROR,
INFO,
WARNING,
Logger,
_nameToLevel,
addLevelName,
basicConfig,
getLogger,
setLoggerClass,
)
from os import getenv
from typing import Optional, Union
default_level = _nameToLevel.get(getenv("LOG_LEVEL", "INFO").upper(), INFO)
getL... | Set up local logger |
18,296 | import logging
import os
import types
from functools import reduce
import numpy as np
logger = logging.getLogger(__name__)
def environ(backend):
os.environ["SOFA_BACKEND"] = backend
from .models import sbert, veco, SbertConfig, SbertTokenizer, SbertTokenizerFast, SbertModel, SbertForSequenceClassification
... | Run a classsification task with transformers code. Support regression/single_label/multi_label tasks :param config_args: :param pretrain_model_path: The local dir of pretrained model :param train_file_path: The local dir or path of train files :param task_type: The task type, support: - regression: a regression task(MS... |
18,297 | import logging
import os
import types
from functools import reduce
from typing import Optional, List, Union
import importlib
logger = logging.getLogger(__name__)
def environ(backend):
os.environ["SOFA_BACKEND"] = backend
from .models import sbert, veco, SbertConfig, SbertTokenizer, SbertTokenizerFast, SbertMod... | Run a classsification task with transformers code. Support regression/single_label/multi_label tasks :param config_args: :param pretrain_model_path: The local dir of pretrained model :param train_file_path: The local dir of train file :param first_sequence: Way to get the first sentense, should be "FunctionType" Will b... |
18,298 | import logging
import os
import types
from functools import reduce
import numpy as np
import torch
from torch import nn
logger = logging.getLogger(__name__)
class TextGenerator:
"""
Uses a model to translate a batch of sentences.
Args:
model (:obj:`onmt.modules.NMTModel`):
NMT model to use ... | TODO Run a generation task with transformers code. :param pretrain_model_path: The local dir of pretrained model :param output_dir: The output directory where the model predictions and checkpoints will be written :param task_type: The task type, only support generation currently :param train_file_path: The local dir of... |
18,299 | import torch
import deepspeed
import random
import os
import numpy as np
from sofa.utils import mpu
The provided code snippet includes necessary dependencies for implementing the `set_random_seed` function. Write a Python function `def set_random_seed(seed)` to solve the following problem:
Set random seed for reproduc... | Set random seed for reproducability. |
18,300 | import torch
import deepspeed
import random
import os
import numpy as np
from sofa.utils import mpu
def set_deepspeed_activation_checkpointing(args):
deepspeed.checkpointing.configure(mpu, deepspeed_config=args.deepspeed_config, num_checkpoints=args.num_layers)
mpu.checkpoint = deepspeed.checkpointing.checkpo... | Initialize torch.distributed. |
18,301 | import math
import torch
import torch.utils.checkpoint
from packaging import version
from torch import nn
from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss
from ...utils.activations import ACT2FN, gelu
from ...utils.file_utils import (
add_code_sample_docstrings,
add_start_docstrings,
add_st... | Replace non-padding symbols with their position numbers. Position numbers begin at padding_idx+1. Padding symbols are ignored. This is modified from fairseq's `utils.make_positions`. Args: x: torch.Tensor x: Returns: torch.Tensor |
18,302 | import json
import os
from functools import lru_cache
from typing import TYPE_CHECKING, List, Optional, Tuple
import regex as re
from ...utils.tokenization_utils import AddedToken, PreTrainedTokenizer
from ...utils import logging
The provided code snippet includes necessary dependencies for implementing the `bytes_to_... | Returns list of utf-8 byte and a mapping to unicode strings. We specifically avoids mapping to whitespace/control characters the bpe code barfs on. The reversible bpe codes work on unicode strings. This means you need a large # of unicode characters in your vocab if you want to avoid UNKs. When you're at something like... |
18,303 | import json
import os
from functools import lru_cache
from typing import TYPE_CHECKING, List, Optional, Tuple
import regex as re
from ...utils.tokenization_utils import AddedToken, PreTrainedTokenizer
from ...utils import logging
The provided code snippet includes necessary dependencies for implementing the `get_pairs... | Return set of symbol pairs in a word. Word is represented as tuple of symbols (symbols being variable-length strings). |
18,304 | import os
import json
import torch
import random
import logging
import h5py
import torch.distributed as dist
from torch.utils.data import Dataset, Subset
from multiprocessing import Pool
from .tokenization_plug import BertTokenizer
from .data_plug import get_train_val_test_data_clean
from sofa.utils import mpu
from .da... | null |
18,305 | import os
import json
import torch
import random
import logging
import h5py
import torch.distributed as dist
from torch.utils.data import Dataset, Subset
from multiprocessing import Pool
from .tokenization_plug import BertTokenizer
from .data_plug import get_train_val_test_data_clean
from sofa.utils import mpu
from .da... | null |
18,306 | import os
import json
import torch
import random
import logging
import h5py
import torch.distributed as dist
from torch.utils.data import Dataset, Subset
from multiprocessing import Pool
from .tokenization_plug import BertTokenizer
from .data_plug import get_train_val_test_data_clean
from sofa.utils import mpu
from .da... | null |
18,307 | import os
import json
import torch
import random
import logging
import h5py
import torch.distributed as dist
from torch.utils.data import Dataset, Subset
from multiprocessing import Pool
from .tokenization_plug import BertTokenizer
from .data_plug import get_train_val_test_data_clean
from sofa.utils import mpu
from .da... | null |
18,308 | from __future__ import absolute_import, division, print_function, unicode_literals
import collections
import os
import six
import unicodedata
from io import open
from ...utils import cached_path
from ...utils.tokenization_utils import PreTrainedTokenizer, _is_control, _is_punctuation, _is_whitespace
from ...utils.file_... | Loads a vocabulary file into a dictionary. |
18,309 | from __future__ import absolute_import, division, print_function, unicode_literals
import collections
import os
import six
import unicodedata
from io import open
from ...utils import cached_path
from ...utils.tokenization_utils import PreTrainedTokenizer, _is_control, _is_punctuation, _is_whitespace
from ...utils.file_... | Runs basic whitespace cleaning and splitting on a piece of text. |
18,310 | from __future__ import absolute_import, division, print_function, unicode_literals
import collections
import os
import six
import unicodedata
from io import open
from ...utils import cached_path
from ...utils.tokenization_utils import PreTrainedTokenizer, _is_control, _is_punctuation, _is_whitespace
from ...utils.file_... | Checks whether `chars` is a whitespace character. |
18,311 | from __future__ import absolute_import, division, print_function, unicode_literals
import collections
import os
import six
import unicodedata
from io import open
from ...utils import cached_path
from ...utils.tokenization_utils import PreTrainedTokenizer, _is_control, _is_punctuation, _is_whitespace
from ...utils.file_... | Checks whether `chars` is a control character. |
18,312 | from __future__ import absolute_import, division, print_function, unicode_literals
import collections
import os
import six
import unicodedata
from io import open
from ...utils import cached_path
from ...utils.tokenization_utils import PreTrainedTokenizer, _is_control, _is_punctuation, _is_whitespace
from ...utils.file_... | Checks whether `chars` is a punctuation character. |
18,313 | from __future__ import absolute_import, division, print_function, unicode_literals
import collections
import os
import six
import unicodedata
from io import open
from ...utils import cached_path
from ...utils.tokenization_utils import PreTrainedTokenizer, _is_control, _is_punctuation, _is_whitespace
from ...utils.file_... | Returns text encoded in a way suitable for print or `tf.logging`. |
18,314 | import os
import json
import torch
import random
import collections
import logging
import h5py
import copy
import torch.distributed as dist
from torch.utils.data import Dataset, Subset
from multiprocessing import Pool
from itertools import repeat
import multiprocessing as mp
from .tokenization_plug import BertTokenizer... | Load the data on rank zero and boradcast number of tokens to all GPUS. |
18,315 | import os
import json
import torch
import random
import collections
import logging
import h5py
import copy
import torch.distributed as dist
from torch.utils.data import Dataset, Subset
from multiprocessing import Pool
from itertools import repeat
import multiprocessing as mp
from .tokenization_plug import BertTokenizer... | null |
18,316 | import os
import json
import torch
import random
import collections
import logging
import h5py
import copy
import torch.distributed as dist
from torch.utils.data import Dataset, Subset
from multiprocessing import Pool
from itertools import repeat
import multiprocessing as mp
from .tokenization_plug import BertTokenizer... | null |
18,317 | import os
import json
import torch
import random
import collections
import logging
import h5py
import copy
import torch.distributed as dist
from torch.utils.data import Dataset, Subset
from multiprocessing import Pool
from itertools import repeat
import multiprocessing as mp
from .tokenization_plug import BertTokenizer... | makes training/val/test |
18,318 | import os
import json
import torch
import random
import collections
import logging
import h5py
import copy
import torch.distributed as dist
from torch.utils.data import Dataset, Subset
from multiprocessing import Pool
from itertools import repeat
import multiprocessing as mp
from .tokenization_plug import BertTokenizer... | null |
18,319 | import os
import json
import torch
import random
import collections
import logging
import h5py
import copy
import torch.distributed as dist
from torch.utils.data import Dataset, Subset
from multiprocessing import Pool
from itertools import repeat
import multiprocessing as mp
from .tokenization_plug import BertTokenizer... | Creates `TrainingInstance`s for a single document. |
18,320 | import os
import json
import torch
import random
import collections
import logging
import h5py
import copy
import torch.distributed as dist
from torch.utils.data import Dataset, Subset
from multiprocessing import Pool
from itertools import repeat
import multiprocessing as mp
from .tokenization_plug import BertTokenizer... | null |
18,321 | import os
import json
import torch
import random
import collections
import logging
import h5py
import copy
import torch.distributed as dist
from torch.utils.data import Dataset, Subset
from multiprocessing import Pool
from itertools import repeat
import multiprocessing as mp
from .tokenization_plug import BertTokenizer... | null |
18,322 | from __future__ import absolute_import, division, print_function, unicode_literals
import os
import copy
import json
import math
import logging
import tarfile
import tempfile
import shutil
import torch
from torch import nn
import torch.nn.functional as F
from torch.nn import CrossEntropyLoss
from .configuration_plug im... | null |
18,323 | from __future__ import absolute_import, division, print_function, unicode_literals
import os
import copy
import json
import math
import logging
import tarfile
import tempfile
import shutil
import torch
from torch import nn
import torch.nn.functional as F
from torch.nn import CrossEntropyLoss
from .configuration_plug im... | Init method based on N(0, sigma/sqrt(2*num_layers). |
18,324 | from __future__ import absolute_import, division, print_function, unicode_literals
import os
import copy
import json
import math
import logging
import tarfile
import tempfile
import shutil
import torch
from torch import nn
import torch.nn.functional as F
from torch.nn import CrossEntropyLoss
from .configuration_plug im... | Load tf checkpoints in a pytorch model |
18,325 | from __future__ import absolute_import, division, print_function, unicode_literals
import os
import copy
import json
import math
import logging
import tarfile
import tempfile
import shutil
import torch
from torch import nn
import torch.nn.functional as F
from torch.nn import CrossEntropyLoss
from .configuration_plug im... | Implementation of the gelu activation function. For information: OpenAI GPT's gelu is slightly different (and gives slightly different results): 0.5 * x * (1 + torch.tanh(math.sqrt(2 / math.pi) * (x + 0.044715 * torch.pow(x, 3)))) |
18,326 | from __future__ import absolute_import, division, print_function, unicode_literals
import os
import copy
import json
import math
import logging
import tarfile
import tempfile
import shutil
import torch
from torch import nn
import torch.nn.functional as F
from torch.nn import CrossEntropyLoss
from .configuration_plug im... | null |
18,327 | import collections
import os
import unicodedata
from typing import List, Optional, Tuple
from ...utils.tokenization_utils import PreTrainedTokenizer, _is_control, _is_punctuation, _is_whitespace
from ...utils.file_utils import logging
The provided code snippet includes necessary dependencies for implementing the `load... | Loads a vocabulary file into a dictionary. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.