code
stringlengths
82
54.1k
code_codestyle
int64
0
699
style_context
stringlengths
111
35.6k
style_context_codestyle
int64
0
699
label
int64
0
1
'''simple docstring''' from typing import Any class snake_case : """simple docstring""" def __init__( self , UpperCamelCase ): """simple docstring""" lowerCamelCase_ = data lowerCamelCase_ = None d...
675
'''simple docstring''' import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING a_ : Optional[int] = logging.get_logger(__name__) a_ : Dict = { """SenseTime/deformable-detr""": """h...
675
1
'''simple docstring''' import time import warnings from abc import ABC from copy import deepcopy from typing import Optional import torch from ..utils import add_start_docstrings, logging a_ : List[str] = logging.get_logger(__name__) a_ : Tuple = R"...
675
'''simple docstring''' import argparse import pytorch_lightning as pl import torch from torch import nn from transformers import LongformerForQuestionAnswering, LongformerModel class snake_case ( pl.LightningModule ): """simple docstring""" def __init...
675
1
'''simple docstring''' import itertools import json import linecache import os import pickle import re import socket import string from collections import Counter from logging import getLogger from pathlib import Path from typing import Callable, Dict, Iterable, List import git import torch fro...
675
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available a_ : Optional[Any] = { """configuration_ctrl""": ["""CTRL_PRETRAINED_CONFIG_ARCHIVE_MAP""", """CTRLConfig"""], """...
675
1
'''simple docstring''' from __future__ import annotations import unittest from transformers import is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, ids_tensor, rand...
675
'''simple docstring''' import unittest from transformers import GPTSwaTokenizer from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from ...test_tokenization_common import TokenizerTesterMixin a_ : Any = get_tests_dir("""fixture...
675
1
'''simple docstring''' def __snake_case ( UpperCAmelCase_ : int ): # bit count represents no. of bits in the gray code if bit_count < 0: raise ValueError("The given input must be positive" ) # get the generated string sequence lowerCamelCase_ = gray_code_sequence_string(Upp...
675
'''simple docstring''' import warnings from typing import List import numpy as np from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding from ...utils import is_flax_available, is_tf_available, is_torch_available class snake_case ( l...
675
1
'''simple docstring''' import unittest from datasets import load_dataset from transformers.pipelines import pipeline from transformers.testing_utils import is_pipeline_test, nested_simplify, require_torch, slow @is_pipeline_test @require_torch class snake_case ( unittest.TestCa...
675
'''simple docstring''' import os import sys import unittest a_ : Optional[Any] = os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))) sys.path.append(os.path.join(git_repo_path, """utils""")) import check_dummies # noqa: E402 from check_dummies import c...
675
1
'''simple docstring''' import inspect import unittest import warnings from transformers import DeiTConfig from transformers.models.auto import get_values from transformers.testing_utils import ( require_accelerate, require_torch, require_torch_gpu, require_vision, slow, tor...
675
'''simple docstring''' from ..utils import DummyObject, requires_backends class snake_case ( metaclass=lowercase ): """simple docstring""" _lowerCamelCase = ["onnx"] def __init__( self , *UpperCamelCase , **Up...
675
1
'''simple docstring''' import argparse import json from collections import OrderedDict from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ( ConditionalDetrConfig, ConditionalDetrForObjectDetectio...
675
'''simple docstring''' from __future__ import annotations import unittest import numpy as np from transformers import LayoutLMConfig, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common impor...
675
1
'''simple docstring''' from random import shuffle import tensorflow as tf from numpy import array def __snake_case ( UpperCAmelCase_ : Optional[Any] , UpperCAmelCase_ : List[str] ): lowerCamelCase_ = int(UpperCAmelCase_ ) assert noofclusters < len(UpperCAmelCa...
675
'''simple docstring''' import argparse from collections import defaultdict import yaml a_ : int = """docs/source/en/_toctree.yml""" def __snake_case ( UpperCAmelCase_ : Optional[int] ): lowerCamelCase_ = defaultdict(UpperCAmelCase_ ) lowerCamel...
675
1
'''simple docstring''' from arguments import InitializationArguments from transformers import AutoConfig, AutoModelForCausalLM, AutoTokenizer, HfArgumentParser # Configuration a_ : Optional[int] = HfArgumentParser(InitializationArguments) a_ : str = parser.pa...
675
'''simple docstring''' import fire from torch.utils.data import DataLoader from tqdm import tqdm from transformers import AutoTokenizer from utils import SeqaSeqDataset, pickle_save def __snake_case ( UpperCAmelCase_ : List[Any] , UpperCAmelCase_ : Dict , UpperCAmelCase_ ...
675
1
'''simple docstring''' from math import isqrt, loga def __snake_case ( UpperCAmelCase_ : int ): lowerCamelCase_ = [True] * max_number for i in range(2 , isqrt(max_number - 1 ) + 1 ): if is_prime[i]: for j in range(i**2 , UpperCAmelCase_ , ...
675
'''simple docstring''' def __snake_case ( UpperCAmelCase_ : str ): lowerCamelCase_ = "" for ch in key: if ch == " " or ch not in key_no_dups and ch.isalpha(): key_no_dups += ch return key_no_dups def __snake_case ( UpperCAmelCase_ : str ): lowerCamelCase_ ...
675
1
'''simple docstring''' def __snake_case ( UpperCAmelCase_ : int , UpperCAmelCase_ : float , UpperCAmelCase_ : float ): return round(float(moles / volume ) * nfactor ) def __snake_case ( UpperCAmelCase_ : float , UpperCAmelCase_ : float , ...
675
'''simple docstring''' import json import os import unittest from transformers import OpenAIGPTTokenizer, OpenAIGPTTokenizerFast from transformers.models.openai.tokenization_openai import VOCAB_FILES_NAMES from transformers.testing_utils import require_ftfy, require_spacy, require_tokenizers from ......
675
1
'''simple docstring''' import warnings from typing import List import numpy as np from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding from ...utils import is_flax_available, is_tf_available, is_torch_available class snake_case ( l...
675
'''simple docstring''' import json from typing import List, Optional, Tuple from tokenizers import normalizers from tokenizers.pre_tokenizers import BertPreTokenizer, PreTokenizer from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_roformer i...
675
1
'''simple docstring''' import tempfile import unittest from make_student import create_student_by_copying_alternating_layers from transformers import AutoConfig from transformers.file_utils import cached_property from transformers.testing_utils import require_torch a_ : List[Any] ...
675
'''simple docstring''' import inspect import unittest from huggingface_hub import hf_hub_download from transformers import ConvNextConfig, UperNetConfig from transformers.testing_utils import require_torch, require_torch_multi_gpu, require_vision, slow, torch_device from transformers.utils import is_t...
675
1
'''simple docstring''' import inspect import unittest from transformers import RegNetConfig, is_flax_available from transformers.testing_utils import require_flax, slow from transformers.utils import cached_property, is_vision_available from ...test_configuration_common import ConfigTester from ...te...
675
'''simple docstring''' from arguments import InitializationArguments from transformers import AutoConfig, AutoModelForCausalLM, AutoTokenizer, HfArgumentParser # Configuration a_ : Optional[int] = HfArgumentParser(InitializationArguments) a_ : str = parser.pa...
675
1
'''simple docstring''' from __future__ import annotations import random # Maximum size of the population. Bigger could be faster but is more memory expensive. a_ : Optional[int] = 200 # Number of elements selected in every generation of evolution. The selection takes # place from...
675
'''simple docstring''' # Lint as: python3 import os import re import urllib.parse from pathlib import Path from typing import Callable, List, Optional, Union from zipfile import ZipFile from ..utils.file_utils import cached_path, hf_github_url from ..utils.logging import get_logger from ..utils.vers...
675
1
'''simple docstring''' import time from contextlib import contextmanager from pathlib import Path import pytest import requests from huggingface_hub.hf_api import HfApi, HfFolder a_ : Optional[int] = """__DUMMY_TRANSFORMERS_USER__""" a_ : Optional[Any] = "...
675
'''simple docstring''' import os def __snake_case ( UpperCAmelCase_ : str = "matrix.txt" ): with open(os.path.join(os.path.dirname(UpperCAmelCase_ ) , UpperCAmelCase_ ) ) as in_file: lowerCamelCase_ = in_file.read() lowerCamelCase_ = [[int(Upp...
675
1
'''simple docstring''' from typing import List, Optional, Union import torch from ...models import UNetaDConditionModel, VQModel from ...pipelines import DiffusionPipeline from ...pipelines.pipeline_utils import ImagePipelineOutput from ...schedulers import DDPMScheduler from ...utils import ( i...
675
'''simple docstring''' import inspect import os import unittest import torch import accelerate from accelerate import debug_launcher from accelerate.test_utils import ( execute_subprocess_async, require_cpu, require_huggingface_suite, require_multi_gpu, require_single_gpu, )...
675
1
'''simple docstring''' import os import time from dataclasses import dataclass, field from enum import Enum from typing import Dict, List, Optional, Union import torch from filelock import FileLock from torch.utils.data import Dataset from ...models.auto.modeling_auto import MODEL_FOR_QUESTION_ANSW...
675
'''simple docstring''' from collections import defaultdict from pathlib import Path import pandas as pd from rouge_cli import calculate_rouge_path from utils import calculate_rouge a_ : Any = [ """Prosecutor: \"No videos were used in the crash investigation\" German paper...
675
1
'''simple docstring''' import argparse import json import os import fairseq import torch from fairseq.data import Dictionary # Register SEW's fairseq modules from sew_asapp import tasks # noqa: F401 from transformers import ( SEWConfig, SEWForCTC, SEWModel, WavaVecaCTCTokeniz...
675
'''simple docstring''' import argparse import torch from transformers import ( EncodecConfig, EncodecFeatureExtractor, EncodecModel, logging, ) # checkpoints downloaded from: # https://dl.fbaipublicfiles.com/encodec/v0/encodec_24khz-d7cc33bc.th # https://huggingface.co/faceboo...
675
1
'''simple docstring''' import inspect import os import unittest import torch import accelerate from accelerate import debug_launcher from accelerate.test_utils import ( execute_subprocess_async, require_cpu, require_huggingface_suite, require_multi_gpu, require_single_gpu, )...
675
'''simple docstring''' from typing import Optional import pyspark from .. import Features, NamedSplit from ..download import DownloadMode from ..packaged_modules.spark.spark import Spark from .abc import AbstractDatasetReader class snake_case ( lowercase ): """...
675
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available a_ : Union[str, Any] = {"""configuration_vit_msn""": ["""VIT_MSN_PRETRAINED_CONFIG_ARCHIVE_MAP""", """ViTMSNConfig"""]} try: if not ...
675
'''simple docstring''' def __snake_case ( ): lowerCamelCase_ = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] lowerCamelCase_ = 6 lowerCamelCase_ = 1 lowerCamelCase_ = 1901 lowerCamelCase_ = 0 while year < 2001: day += 7 if (year % 4 == 0 an...
675
1
'''simple docstring''' import os import shutil import sys import tempfile import unittest from pathlib import Path import pytest import transformers from transformers import ( BERT_PRETRAINED_CONFIG_ARCHIVE_MAP, GPT2_PRETRAINED_CONFIG_ARCHIVE_MAP, AutoTokenizer, BertConfig, ...
675
'''simple docstring''' import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING a_ : Optional[int] = logging.get_logger(__name__) a_ : Dict = { """SenseTime/deformable-detr""": """h...
675
1
'''simple docstring''' import copy from dataclasses import dataclass from pathlib import Path from typing import Dict, Optional, Union @dataclass class snake_case : """simple docstring""" _lowerCamelCase = None _lowerCamelCase = Fal...
675
'''simple docstring''' import argparse import pytorch_lightning as pl import torch from torch import nn from transformers import LongformerForQuestionAnswering, LongformerModel class snake_case ( pl.LightningModule ): """simple docstring""" def __init...
675
1
'''simple docstring''' def __snake_case ( UpperCAmelCase_ : int = 1000000 ): lowerCamelCase_ = [i - 1 for i in range(limit + 1 )] for i in range(2 , limit + 1 ): if phi[i] == i - 1: for j in range(2 * i , limit + 1 , UpperCAmelCase_ ): p...
675
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available a_ : Optional[Any] = { """configuration_ctrl""": ["""CTRL_PRETRAINED_CONFIG_ARCHIVE_MAP""", """CTRLConfig"""], """...
675
1
'''simple docstring''' import json import os import unittest from transformers import OpenAIGPTTokenizer, OpenAIGPTTokenizerFast from transformers.models.openai.tokenization_openai import VOCAB_FILES_NAMES from transformers.testing_utils import require_ftfy, require_spacy, require_tokenizers from ......
675
'''simple docstring''' import unittest from transformers import GPTSwaTokenizer from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from ...test_tokenization_common import TokenizerTesterMixin a_ : Any = get_tests_dir("""fixture...
675
1
'''simple docstring''' import functools import operator from ...configuration_utils import PretrainedConfig from ...utils import logging a_ : Tuple = logging.get_logger(__name__) a_ : str = { """asapp/sew-d-tiny-100k""": """https://huggingface.co/asap...
675
'''simple docstring''' import warnings from typing import List import numpy as np from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding from ...utils import is_flax_available, is_tf_available, is_torch_available class snake_case ( l...
675
1
'''simple docstring''' import argparse from pathlib import Path import requests import torch from PIL import Image from transformers import ( RobertaTokenizer, TrOCRConfig, TrOCRForCausalLM, TrOCRProcessor, VisionEncoderDecoderModel, ViTConfig, ViTImageProcessor, ...
675
'''simple docstring''' import os import sys import unittest a_ : Optional[Any] = os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))) sys.path.append(os.path.join(git_repo_path, """utils""")) import check_dummies # noqa: E402 from check_dummies import c...
675
1
'''simple docstring''' import re import time from typing import Optional import IPython.display as disp from ..trainer_callback import TrainerCallback from ..trainer_utils import IntervalStrategy, has_length def __snake_case ( UpperCAmelCase_ : List[Any] ): lowerCamelCase_ =...
675
'''simple docstring''' from ..utils import DummyObject, requires_backends class snake_case ( metaclass=lowercase ): """simple docstring""" _lowerCamelCase = ["onnx"] def __init__( self , *UpperCamelCase , **Up...
675
1
'''simple docstring''' from typing import Dict, Optional import numpy as np import datasets a_ : Optional[Any] = """ IoU is the area of overlap between the predicted segmentation and the ground truth divided by the area of union between the predicted segmentation and the ground ...
675
'''simple docstring''' from __future__ import annotations import unittest import numpy as np from transformers import LayoutLMConfig, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common impor...
675
1
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging a_ : Dict = logging.get_logger(__name__) a_ : Any = { """uw-madison/mra-base-512-4""": """https://huggingface.co/uw-madison/mra-base-512-4/resolve/main...
675
'''simple docstring''' import argparse from collections import defaultdict import yaml a_ : int = """docs/source/en/_toctree.yml""" def __snake_case ( UpperCAmelCase_ : Optional[int] ): lowerCamelCase_ = defaultdict(UpperCAmelCase_ ) lowerCamel...
675
1
'''simple docstring''' from typing import TYPE_CHECKING from ....utils import _LazyModule a_ : str = {"""tokenization_tapex""": ["""TapexTokenizer"""]} if TYPE_CHECKING: from .tokenization_tapex import TapexTokenizer else: import sys a_ : Dict...
675
'''simple docstring''' import fire from torch.utils.data import DataLoader from tqdm import tqdm from transformers import AutoTokenizer from utils import SeqaSeqDataset, pickle_save def __snake_case ( UpperCAmelCase_ : List[Any] , UpperCAmelCase_ : Dict , UpperCAmelCase_ ...
675
1
'''simple docstring''' import json import os from typing import Dict, List, Optional, Tuple import regex as re from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging a_ : List[Any] = logging.get_logger(__name__) a_ : List[Any] ...
675
'''simple docstring''' def __snake_case ( UpperCAmelCase_ : str ): lowerCamelCase_ = "" for ch in key: if ch == " " or ch not in key_no_dups and ch.isalpha(): key_no_dups += ch return key_no_dups def __snake_case ( UpperCAmelCase_ : str ): lowerCamelCase_ ...
675
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available a_ : Optional[Any] = { """configuration_ctrl""": ["""CTRL_PRETRAINED_CONFIG_ARCHIVE_MAP""", """CTRLConfig"""], """...
675
'''simple docstring''' import json import os import unittest from transformers import OpenAIGPTTokenizer, OpenAIGPTTokenizerFast from transformers.models.openai.tokenization_openai import VOCAB_FILES_NAMES from transformers.testing_utils import require_ftfy, require_spacy, require_tokenizers from ......
675
1
'''simple docstring''' def __snake_case ( UpperCAmelCase_ : str ): assert column_title.isupper() lowerCamelCase_ = 0 lowerCamelCase_ = len(UpperCAmelCase_ ) - 1 lowerCamelCase_ = 0 while index >= 0: lowerCamelCase_ = (ord(column_title[index] ) -...
675
'''simple docstring''' import json from typing import List, Optional, Tuple from tokenizers import normalizers from tokenizers.pre_tokenizers import BertPreTokenizer, PreTokenizer from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_roformer i...
675
1
'''simple docstring''' import os import random import sys from . import cryptomath_module as cryptomath from . import rabin_miller a_ : List[str] = 3 def __snake_case ( UpperCAmelCase_ : int ): print("Generating primitive root of p" ) while True: lo...
675
'''simple docstring''' import inspect import unittest from huggingface_hub import hf_hub_download from transformers import ConvNextConfig, UperNetConfig from transformers.testing_utils import require_torch, require_torch_multi_gpu, require_vision, slow, torch_device from transformers.utils import is_t...
675
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) a_ : Optional[int] = {"""configuration_encoder_decoder""": ["""EncoderDeco...
675
'''simple docstring''' from arguments import InitializationArguments from transformers import AutoConfig, AutoModelForCausalLM, AutoTokenizer, HfArgumentParser # Configuration a_ : Optional[int] = HfArgumentParser(InitializationArguments) a_ : str = parser.pa...
675
1
'''simple docstring''' import argparse import json import pickle from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import MaskFormerConfig, MaskFormerForInstanceSegmentation, MaskFormerImageProcessor, SwinConfig...
675
'''simple docstring''' # Lint as: python3 import os import re import urllib.parse from pathlib import Path from typing import Callable, List, Optional, Union from zipfile import ZipFile from ..utils.file_utils import cached_path, hf_github_url from ..utils.logging import get_logger from ..utils.vers...
675
1
'''simple docstring''' from dataclasses import dataclass from typing import Dict, Optional, Tuple, Union import torch import torch.nn as nn from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput, apply_forward_hook from .attention_processor import AttentionPr...
675
'''simple docstring''' import os def __snake_case ( UpperCAmelCase_ : str = "matrix.txt" ): with open(os.path.join(os.path.dirname(UpperCAmelCase_ ) , UpperCAmelCase_ ) ) as in_file: lowerCamelCase_ = in_file.read() lowerCamelCase_ = [[int(Upp...
675
1
'''simple docstring''' from argparse import ArgumentParser from ..pipelines import Pipeline, PipelineDataFormat, get_supported_tasks, pipeline from ..utils import logging from . import BaseTransformersCLICommand a_ : Dict = logging.get_logger(__name__) # pylint: disable=invalid-...
675
'''simple docstring''' import inspect import os import unittest import torch import accelerate from accelerate import debug_launcher from accelerate.test_utils import ( execute_subprocess_async, require_cpu, require_huggingface_suite, require_multi_gpu, require_single_gpu, )...
675
1
'''simple docstring''' import fire from torch.utils.data import DataLoader from tqdm import tqdm from transformers import AutoTokenizer from utils import SeqaSeqDataset, pickle_save def __snake_case ( UpperCAmelCase_ : List[Any] , UpperCAmelCase_ : Dict , UpperCAmelCase_ ...
675
'''simple docstring''' from collections import defaultdict from pathlib import Path import pandas as pd from rouge_cli import calculate_rouge_path from utils import calculate_rouge a_ : Any = [ """Prosecutor: \"No videos were used in the crash investigation\" German paper...
675
1
'''simple docstring''' from __future__ import annotations a_ : List[Any] = [True] * 1000001 a_ : Optional[int] = 2 while i * i <= 1000000: if seive[i]: for j in range(i * i, 1000001, i): a_ : Any = False ...
675
'''simple docstring''' import argparse import torch from transformers import ( EncodecConfig, EncodecFeatureExtractor, EncodecModel, logging, ) # checkpoints downloaded from: # https://dl.fbaipublicfiles.com/encodec/v0/encodec_24khz-d7cc33bc.th # https://huggingface.co/faceboo...
675
1
'''simple docstring''' import warnings from typing import List, Optional, Union from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType class snake_ca...
675
'''simple docstring''' from typing import Optional import pyspark from .. import Features, NamedSplit from ..download import DownloadMode from ..packaged_modules.spark.spark import Spark from .abc import AbstractDatasetReader class snake_case ( lowercase ): """...
675
1
'''simple docstring''' from __future__ import annotations import os import tempfile import unittest from transformers import ConvBertConfig, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common...
675
'''simple docstring''' def __snake_case ( ): lowerCamelCase_ = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] lowerCamelCase_ = 6 lowerCamelCase_ = 1 lowerCamelCase_ = 1901 lowerCamelCase_ = 0 while year < 2001: day += 7 if (year % 4 == 0 an...
675
1
'''simple docstring''' import gc import random import unittest import numpy as np import torch from PIL import Image from transformers import XLMRobertaTokenizerFast from diffusers import DDIMScheduler, KandinskyInpaintPipeline, KandinskyPriorPipeline, UNetaDConditionModel, VQModel from diffusers.p...
675
'''simple docstring''' import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING a_ : Optional[int] = logging.get_logger(__name__) a_ : Dict = { """SenseTime/deformable-detr""": """h...
675
1
'''simple docstring''' from itertools import zip_longest import requests from bsa import BeautifulSoup from pandas import DataFrame def __snake_case ( UpperCAmelCase_ : str = "laptop" ): lowerCamelCase_ = F'''https://www.amazon.in/laptop/s?k={product}''' lowerCamelCase_ ...
675
'''simple docstring''' import argparse import pytorch_lightning as pl import torch from torch import nn from transformers import LongformerForQuestionAnswering, LongformerModel class snake_case ( pl.LightningModule ): """simple docstring""" def __init...
675
1
'''simple docstring''' from __future__ import annotations from collections.abc import Generator import requests from bsa import BeautifulSoup a_ : Optional[int] = """https://www.indeed.co.in/jobs?q=mobile+app+development&l=""" def __snake_case ( UpperCAmelCase_ : s...
675
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available a_ : Optional[Any] = { """configuration_ctrl""": ["""CTRL_PRETRAINED_CONFIG_ARCHIVE_MAP""", """CTRLConfig"""], """...
675
1
'''simple docstring''' from __future__ import annotations import unittest from transformers import EsmConfig, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, float...
675
'''simple docstring''' import unittest from transformers import GPTSwaTokenizer from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from ...test_tokenization_common import TokenizerTesterMixin a_ : Any = get_tests_dir("""fixture...
675
1
'''simple docstring''' import sys a_ : Any = ( """73167176531330624919225119674426574742355349194934""" """96983520312774506326239578318016984801869478851843""" """85861560789112949495459501737958331952853208805511""" """1254069874715852386305071569329096329522744304...
675
'''simple docstring''' import warnings from typing import List import numpy as np from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding from ...utils import is_flax_available, is_tf_available, is_torch_available class snake_case ( l...
675
1
'''simple docstring''' def __snake_case ( UpperCAmelCase_ : int ): if length <= 0 or not isinstance(UpperCAmelCase_ , UpperCAmelCase_ ): raise ValueError("Length must be a positive integer." ) return [n * (2 * n - 1) for n in range(UpperCAmelCase_ )] if __name__ ==...
675
'''simple docstring''' import os import sys import unittest a_ : Optional[Any] = os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))) sys.path.append(os.path.join(git_repo_path, """utils""")) import check_dummies # noqa: E402 from check_dummies import c...
675
1
'''simple docstring''' from __future__ import annotations # This is the precision for this function which can be altered. # It is recommended for users to keep this number greater than or equal to 10. a_ : List[str] = 10 def __snake_case ( UpperCAmelCase_ : int , ...
675
'''simple docstring''' from ..utils import DummyObject, requires_backends class snake_case ( metaclass=lowercase ): """simple docstring""" _lowerCamelCase = ["onnx"] def __init__( self , *UpperCamelCase , **Up...
675
1
'''simple docstring''' def __snake_case ( ): lowerCamelCase_ = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] lowerCamelCase_ = 6 lowerCamelCase_ = 1 lowerCamelCase_ = 1901 lowerCamelCase_ = 0 while year < 2001: day += 7 if (year % 4 == 0 an...
675
'''simple docstring''' from __future__ import annotations import unittest import numpy as np from transformers import LayoutLMConfig, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common impor...
675
1
'''simple docstring''' a_ : List[str] = """Alexander Joslin""" import operator as op from .stack import Stack def __snake_case ( UpperCAmelCase_ : str ): lowerCamelCase_ = {"*": op.mul, "/": op.truediv, "+": op.add, "-": op.sub} lowerCamelCase_ ...
675
'''simple docstring''' import argparse from collections import defaultdict import yaml a_ : int = """docs/source/en/_toctree.yml""" def __snake_case ( UpperCAmelCase_ : Optional[int] ): lowerCamelCase_ = defaultdict(UpperCAmelCase_ ) lowerCamel...
675
1
'''simple docstring''' import unittest from transformers import is_torch_available from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow, torch_device if is_torch_available(): from transformers import AutoModelForSeqaSeqLM, AutoTokenizer ...
675
'''simple docstring''' import fire from torch.utils.data import DataLoader from tqdm import tqdm from transformers import AutoTokenizer from utils import SeqaSeqDataset, pickle_save def __snake_case ( UpperCAmelCase_ : List[Any] , UpperCAmelCase_ : Dict , UpperCAmelCase_ ...
675
1
'''simple docstring''' import logging import math import os from dataclasses import dataclass, field from glob import glob from typing import Optional from torch.utils.data import ConcatDataset import transformers from transformers import ( CONFIG_MAPPING, MODEL_WITH_LM_HEAD_MAPPING, ...
675
'''simple docstring''' def __snake_case ( UpperCAmelCase_ : str ): lowerCamelCase_ = "" for ch in key: if ch == " " or ch not in key_no_dups and ch.isalpha(): key_no_dups += ch return key_no_dups def __snake_case ( UpperCAmelCase_ : str ): lowerCamelCase_ ...
675
1
'''simple docstring''' from collections import OrderedDict from typing import Any, Mapping, Optional from ... import PreTrainedTokenizer from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig, OnnxConfigWithPast, OnnxSeqaSeqConfigWithPast from ...onnx.utils import compute_eff...
675
'''simple docstring''' import json import os import unittest from transformers import OpenAIGPTTokenizer, OpenAIGPTTokenizerFast from transformers.models.openai.tokenization_openai import VOCAB_FILES_NAMES from transformers.testing_utils import require_ftfy, require_spacy, require_tokenizers from ......
675
1
'''simple docstring''' from __future__ import annotations from typing import Generic, TypeVar a_ : Optional[int] = TypeVar("""T""") class snake_case ( Generic[T] ): """simple docstring""" def __init__( self , UpperCamel...
675
'''simple docstring''' import json from typing import List, Optional, Tuple from tokenizers import normalizers from tokenizers.pre_tokenizers import BertPreTokenizer, PreTokenizer from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_roformer i...
675
1
'''simple docstring''' import inspect import jax import jax.lax as lax import jax.numpy as jnp from ..utils import add_start_docstrings from ..utils.logging import get_logger a_ : int = get_logger(__name__) a_ : Union[str, Any] = R""" Args: ...
675
'''simple docstring''' import inspect import unittest from huggingface_hub import hf_hub_download from transformers import ConvNextConfig, UperNetConfig from transformers.testing_utils import require_torch, require_torch_multi_gpu, require_vision, slow, torch_device from transformers.utils import is_t...
675
1
'''simple docstring''' import argparse import torch from transformers import ( UniSpeechSatConfig, UniSpeechSatForAudioFrameClassification, UniSpeechSatForSequenceClassification, UniSpeechSatForXVector, WavaVecaFeatureExtractor, logging, ) logging.set_verbosity_info() ...
675
'''simple docstring''' from arguments import InitializationArguments from transformers import AutoConfig, AutoModelForCausalLM, AutoTokenizer, HfArgumentParser # Configuration a_ : Optional[int] = HfArgumentParser(InitializationArguments) a_ : str = parser.pa...
675
1
'''simple docstring''' import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING a_ : Optional[int] = logging.get_logger(__name__) a_ : Dict = { """SenseTime/deformable-detr""": """h...
675
'''simple docstring''' # Lint as: python3 import os import re import urllib.parse from pathlib import Path from typing import Callable, List, Optional, Union from zipfile import ZipFile from ..utils.file_utils import cached_path, hf_github_url from ..utils.logging import get_logger from ..utils.vers...
675
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available, is_vision_available, ) a_ : Tuple = { """configuration_layoutlmv2""": ["""LAYOUTLM...
675
'''simple docstring''' import os def __snake_case ( UpperCAmelCase_ : str = "matrix.txt" ): with open(os.path.join(os.path.dirname(UpperCAmelCase_ ) , UpperCAmelCase_ ) ) as in_file: lowerCamelCase_ = in_file.read() lowerCamelCase_ = [[int(Upp...
675
1
'''simple docstring''' def __snake_case ( ): return [list(range(1000 - i , -1000 - i , -1 ) ) for i in range(1000 )] a_ : Any = generate_large_matrix() a_ : Optional[Any] = ( [[4, 3, 2, -1], [3, 2, 1, -1], [1, 1, -1, -2], [...
675
'''simple docstring''' import inspect import os import unittest import torch import accelerate from accelerate import debug_launcher from accelerate.test_utils import ( execute_subprocess_async, require_cpu, require_huggingface_suite, require_multi_gpu, require_single_gpu, )...
675
1
'''simple docstring''' import qiskit def __snake_case ( UpperCAmelCase_ : int , UpperCAmelCase_ : int ): lowerCamelCase_ = qiskit.Aer.get_backend("aer_simulator" ) # Create a Quantum Circuit acting on the q register lowerCamelCase_ = qiskit.QuantumCirc...
675
'''simple docstring''' from collections import defaultdict from pathlib import Path import pandas as pd from rouge_cli import calculate_rouge_path from utils import calculate_rouge a_ : Any = [ """Prosecutor: \"No videos were used in the crash investigation\" German paper...
675
1
'''simple docstring''' import os from collections.abc import Iterator def __snake_case ( UpperCAmelCase_ : str = "." ): for dir_path, dir_names, filenames in os.walk(UpperCAmelCase_ ): lowerCamelCase_ = [d for d in dir_names if d != "scripts" and d[0] not in "._"] for ...
675
'''simple docstring''' import argparse import torch from transformers import ( EncodecConfig, EncodecFeatureExtractor, EncodecModel, logging, ) # checkpoints downloaded from: # https://dl.fbaipublicfiles.com/encodec/v0/encodec_24khz-d7cc33bc.th # https://huggingface.co/faceboo...
675
1
'''simple docstring''' from typing import Dict, Iterable, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import normalize, rescale, resize, to_channel_dimension_format, to_pil_image from ...image_utils im...
675
'''simple docstring''' from typing import Optional import pyspark from .. import Features, NamedSplit from ..download import DownloadMode from ..packaged_modules.spark.spark import Spark from .abc import AbstractDatasetReader class snake_case ( lowercase ): """...
675
1
'''simple docstring''' from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxSeqaSeqConfigWithPast from ...utils import logging a_ : Optional[int] = logging.get_logger(__name__) a_ : str = { """google/u...
675
'''simple docstring''' def __snake_case ( ): lowerCamelCase_ = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] lowerCamelCase_ = 6 lowerCamelCase_ = 1 lowerCamelCase_ = 1901 lowerCamelCase_ = 0 while year < 2001: day += 7 if (year % 4 == 0 an...
675
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available a_ : str = {"""configuration_wavlm""": ["""WAVLM_PRETRAINED_CONFIG_ARCHIVE_MAP""", """WavLMConfig"""]} try: if not is_torch_availabl...
675
'''simple docstring''' import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING a_ : Optional[int] = logging.get_logger(__name__) a_ : Dict = { """SenseTime/deformable-detr""": """h...
675
1
'''simple docstring''' import math import sys import cva import numpy as np def __snake_case ( UpperCAmelCase_ : np.ndarray , UpperCAmelCase_ : float ): # For applying gaussian function for each element in matrix. lowerCamelCase_ = math.sqrt(UpperCAmelCase_ )...
675
'''simple docstring''' import argparse import pytorch_lightning as pl import torch from torch import nn from transformers import LongformerForQuestionAnswering, LongformerModel class snake_case ( pl.LightningModule ): """simple docstring""" def __init...
675
1
'''simple docstring''' from typing import Optional import pyspark from .. import Features, NamedSplit from ..download import DownloadMode from ..packaged_modules.spark.spark import Spark from .abc import AbstractDatasetReader class snake_case ( lowercase ): """...
675
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available a_ : Optional[Any] = { """configuration_ctrl""": ["""CTRL_PRETRAINED_CONFIG_ARCHIVE_MAP""", """CTRLConfig"""], """...
675
1
'''simple docstring''' import math import unittest from transformers import BioGptConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigTester from ....
675
'''simple docstring''' import unittest from transformers import GPTSwaTokenizer from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from ...test_tokenization_common import TokenizerTesterMixin a_ : Any = get_tests_dir("""fixture...
675
1
'''simple docstring''' import collections import inspect import unittest from transformers import SwinvaConfig from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_...
675
'''simple docstring''' import warnings from typing import List import numpy as np from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding from ...utils import is_flax_available, is_tf_available, is_torch_available class snake_case ( l...
675
1
'''simple docstring''' def __snake_case ( UpperCAmelCase_ : str ): lowerCamelCase_ = 0 for ch in input_str: lowerCamelCase_ = ord(UpperCAmelCase_ ) lowerCamelCase_ = pow(2 , UpperCAmelCase_ ) # If we already turned on bit for current character's...
675
'''simple docstring''' import os import sys import unittest a_ : Optional[Any] = os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))) sys.path.append(os.path.join(git_repo_path, """utils""")) import check_dummies # noqa: E402 from check_dummies import c...
675
1
'''simple docstring''' def __snake_case ( UpperCAmelCase_ : str , UpperCAmelCase_ : str ): if len(UpperCAmelCase_ ) != len(UpperCAmelCase_ ): raise ValueError("String lengths must match!" ) lowerCamelCase_ = 0 for chara, chara in zip(UpperCAmelCase_ , ...
675
'''simple docstring''' from ..utils import DummyObject, requires_backends class snake_case ( metaclass=lowercase ): """simple docstring""" _lowerCamelCase = ["onnx"] def __init__( self , *UpperCamelCase , **Up...
675
1
'''simple docstring''' import argparse import json import os import tensorstore as ts import torch from flax import serialization from flax.traverse_util import flatten_dict, unflatten_dict from tensorflow.io import gfile from transformers.modeling_utils import dtype_byte_size from transformers.mo...
675
'''simple docstring''' from __future__ import annotations import unittest import numpy as np from transformers import LayoutLMConfig, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common impor...
675
1
'''simple docstring''' import argparse import json from typing import List from ltp import LTP from transformers import BertTokenizer def __snake_case ( UpperCAmelCase_ : List[str] ): # This defines a "chinese character" as anything in the CJK Unicode block: # https://en.wikip...
675
'''simple docstring''' import argparse from collections import defaultdict import yaml a_ : int = """docs/source/en/_toctree.yml""" def __snake_case ( UpperCAmelCase_ : Optional[int] ): lowerCamelCase_ = defaultdict(UpperCAmelCase_ ) lowerCamel...
675
1
'''simple docstring''' from string import ascii_uppercase a_ : int = {char: i for i, char in enumerate(ascii_uppercase)} a_ : Union[str, Any] = dict(enumerate(ascii_uppercase)) def __snake_case ( UpperCAmelCase_ : str , UpperCAmelCase_ : st...
675
'''simple docstring''' import fire from torch.utils.data import DataLoader from tqdm import tqdm from transformers import AutoTokenizer from utils import SeqaSeqDataset, pickle_save def __snake_case ( UpperCAmelCase_ : List[Any] , UpperCAmelCase_ : Dict , UpperCAmelCase_ ...
675
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) a_ : Dict = { """configuration_roberta_prelayernorm""": [ ""...
675
'''simple docstring''' def __snake_case ( UpperCAmelCase_ : str ): lowerCamelCase_ = "" for ch in key: if ch == " " or ch not in key_no_dups and ch.isalpha(): key_no_dups += ch return key_no_dups def __snake_case ( UpperCAmelCase_ : str ): lowerCamelCase_ ...
675
1
'''simple docstring''' import warnings from typing import List, Optional, Union from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType class snake_ca...
675
'''simple docstring''' import json import os import unittest from transformers import OpenAIGPTTokenizer, OpenAIGPTTokenizerFast from transformers.models.openai.tokenization_openai import VOCAB_FILES_NAMES from transformers.testing_utils import require_ftfy, require_spacy, require_tokenizers from ......
675
1
'''simple docstring''' import tempfile import torch from diffusers import ( DEISMultistepScheduler, DPMSolverMultistepScheduler, DPMSolverSinglestepScheduler, UniPCMultistepScheduler, ) from .test_schedulers import SchedulerCommonTest class snake_case ( low...
675
'''simple docstring''' import json from typing import List, Optional, Tuple from tokenizers import normalizers from tokenizers.pre_tokenizers import BertPreTokenizer, PreTokenizer from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_roformer i...
675
1
'''simple docstring''' import argparse import json from pathlib import Path import requests import timm import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import DeiTConfig, DeiTForImageClassificationWithTeacher, DeiTImageProcessor from transformers.ut...
675
'''simple docstring''' import inspect import unittest from huggingface_hub import hf_hub_download from transformers import ConvNextConfig, UperNetConfig from transformers.testing_utils import require_torch, require_torch_multi_gpu, require_vision, slow, torch_device from transformers.utils import is_t...
675
1
'''simple docstring''' import itertools from dataclasses import dataclass from typing import Optional import pandas as pd import pyarrow as pa import datasets from datasets.table import table_cast @dataclass class snake_case ( datasets.BuilderConfig ): """sim...
675
'''simple docstring''' from arguments import InitializationArguments from transformers import AutoConfig, AutoModelForCausalLM, AutoTokenizer, HfArgumentParser # Configuration a_ : Optional[int] = HfArgumentParser(InitializationArguments) a_ : str = parser.pa...
675
1
'''simple docstring''' from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging a_ : Dict = logging.get_logger(__name__) a_ : Dict = { ...
675
'''simple docstring''' # Lint as: python3 import os import re import urllib.parse from pathlib import Path from typing import Callable, List, Optional, Union from zipfile import ZipFile from ..utils.file_utils import cached_path, hf_github_url from ..utils.logging import get_logger from ..utils.vers...
675
1
'''simple docstring''' a_ : str = 256 # Modulus to hash a string a_ : List[str] = 1000003 def __snake_case ( UpperCAmelCase_ : str , UpperCAmelCase_ : str ): lowerCamelCase_ = len(UpperCAmelCase_ ) lowerCamelCase_ =...
675
'''simple docstring''' import os def __snake_case ( UpperCAmelCase_ : str = "matrix.txt" ): with open(os.path.join(os.path.dirname(UpperCAmelCase_ ) , UpperCAmelCase_ ) ) as in_file: lowerCamelCase_ = in_file.read() lowerCamelCase_ = [[int(Upp...
675
1
'''simple docstring''' import argparse import os from transformers.utils import direct_transformers_import # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_task_guides.py a_ : Dict = """src/transformer...
675
'''simple docstring''' import inspect import os import unittest import torch import accelerate from accelerate import debug_launcher from accelerate.test_utils import ( execute_subprocess_async, require_cpu, require_huggingface_suite, require_multi_gpu, require_single_gpu, )...
675
1
'''simple docstring''' import unittest import torch from diffusers import DDIMScheduler, DDPMScheduler, UNetaDModel from diffusers.training_utils import set_seed from diffusers.utils.testing_utils import slow a_ : int = False class snake_case ( unittest...
675
'''simple docstring''' from collections import defaultdict from pathlib import Path import pandas as pd from rouge_cli import calculate_rouge_path from utils import calculate_rouge a_ : Any = [ """Prosecutor: \"No videos were used in the crash investigation\" German paper...
675
1
'''simple docstring''' def __snake_case ( UpperCAmelCase_ : Optional[int] , UpperCAmelCase_ : Any ): lowerCamelCase_ = [0 for i in range(r + 1 )] # nc0 = 1 lowerCamelCase_ = 1 for i in range(1 , n + 1 ): # to compute current row from previous row....
675
'''simple docstring''' import argparse import torch from transformers import ( EncodecConfig, EncodecFeatureExtractor, EncodecModel, logging, ) # checkpoints downloaded from: # https://dl.fbaipublicfiles.com/encodec/v0/encodec_24khz-d7cc33bc.th # https://huggingface.co/faceboo...
675
1
'''simple docstring''' from dataclasses import dataclass from typing import Optional, Tuple, Union import torch import torch.nn as nn from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput, apply_forward_hook from .modeling_utils import ModelMixin from .vae ...
675
'''simple docstring''' from typing import Optional import pyspark from .. import Features, NamedSplit from ..download import DownloadMode from ..packaged_modules.spark.spark import Spark from .abc import AbstractDatasetReader class snake_case ( lowercase ): """...
675
1
'''simple docstring''' import math from collections.abc import Callable def __snake_case ( UpperCAmelCase_ : Callable[[float], float] , UpperCAmelCase_ : float , UpperCAmelCase_ : float ): lowerCamelCase_ = xa lowerCamelCase_ = xa while True: if...
675
'''simple docstring''' def __snake_case ( ): lowerCamelCase_ = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] lowerCamelCase_ = 6 lowerCamelCase_ = 1 lowerCamelCase_ = 1901 lowerCamelCase_ = 0 while year < 2001: day += 7 if (year % 4 == 0 an...
675
1
'''simple docstring''' import os from bleurt import score # From: git+https://github.com/google-research/bleurt.git import datasets a_ : Optional[Any] = datasets.logging.get_logger(__name__) a_ : List[str] = """\ @inproceedings{bleurt, title={BLEURT:...
675
'''simple docstring''' import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING a_ : Optional[int] = logging.get_logger(__name__) a_ : Dict = { """SenseTime/deformable-detr""": """h...
675
1
'''simple docstring''' def __snake_case ( UpperCAmelCase_ : float , UpperCAmelCase_ : float , UpperCAmelCase_ : int ): if principal <= 0: raise Exception("Principal borrowed must be > 0" ) if rate_per_annum < 0: raise Exception("Rate of interest must be >= 0" ) ...
675
'''simple docstring''' import argparse import pytorch_lightning as pl import torch from torch import nn from transformers import LongformerForQuestionAnswering, LongformerModel class snake_case ( pl.LightningModule ): """simple docstring""" def __init...
675
1
'''simple docstring''' from __future__ import annotations import unittest import numpy as np from transformers import LayoutLMConfig, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common impor...
675
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available a_ : Optional[Any] = { """configuration_ctrl""": ["""CTRL_PRETRAINED_CONFIG_ARCHIVE_MAP""", """CTRLConfig"""], """...
675
1
'''simple docstring''' from __future__ import annotations from collections.abc import Iterator from typing import Any class snake_case : """simple docstring""" def __init__( self , UpperCamelCase ): """simple docstring""" lowerCam...
675
'''simple docstring''' import unittest from transformers import GPTSwaTokenizer from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from ...test_tokenization_common import TokenizerTesterMixin a_ : Any = get_tests_dir("""fixture...
675
1
'''simple docstring''' import gc import unittest import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTextModelWithProjection, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, DDPMScheduler, PriorTransformer, StableUnCLIPPipeline, UNe...
675
'''simple docstring''' import warnings from typing import List import numpy as np from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding from ...utils import is_flax_available, is_tf_available, is_torch_available class snake_case ( l...
675
1
'''simple docstring''' import random import unittest import torch from diffusers import IFInpaintingPipeline from diffusers.utils import floats_tensor from diffusers.utils.import_utils import is_xformers_available from diffusers.utils.testing_utils import skip_mps, torch_device from ..pipeline_par...
675
'''simple docstring''' import os import sys import unittest a_ : Optional[Any] = os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))) sys.path.append(os.path.join(git_repo_path, """utils""")) import check_dummies # noqa: E402 from check_dummies import c...
675
1
'''simple docstring''' import importlib import json import os from collections import OrderedDict from typing import Dict, Optional, Union # Build the list of all image processors from ...configuration_utils import PretrainedConfig from ...dynamic_module_utils import get_class_from_dynamic_module, res...
675
'''simple docstring''' from ..utils import DummyObject, requires_backends class snake_case ( metaclass=lowercase ): """simple docstring""" _lowerCamelCase = ["onnx"] def __init__( self , *UpperCamelCase , **Up...
675
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available a_ : List[Any] = { """configuration_pix2struct""": [ """PIX2STRUCT_PRETRAINED_CONFIG_ARCHIVE_MAP""", ...
675
'''simple docstring''' from __future__ import annotations import unittest import numpy as np from transformers import LayoutLMConfig, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common impor...
675
1
'''simple docstring''' from ...configuration_utils import PretrainedConfig a_ : Optional[int] = { """google/tapas-base-finetuned-sqa""": ( """https://huggingface.co/google/tapas-base-finetuned-sqa/resolve/main/config.json""" ), """google/tapas-base-finetuned-wt...
675
'''simple docstring''' import argparse from collections import defaultdict import yaml a_ : int = """docs/source/en/_toctree.yml""" def __snake_case ( UpperCAmelCase_ : Optional[int] ): lowerCamelCase_ = defaultdict(UpperCAmelCase_ ) lowerCamel...
675
1
'''simple docstring''' import os import pickle import unittest from transformers import AutoTokenizer from transformers.models.bert.tokenization_bert import BertTokenizer from transformers.models.bert_japanese.tokenization_bert_japanese import ( VOCAB_FILES_NAMES, BertJapaneseTokenizer, C...
675
'''simple docstring''' import fire from torch.utils.data import DataLoader from tqdm import tqdm from transformers import AutoTokenizer from utils import SeqaSeqDataset, pickle_save def __snake_case ( UpperCAmelCase_ : List[Any] , UpperCAmelCase_ : Dict , UpperCAmelCase_ ...
675
1
'''simple docstring''' import os def __snake_case ( UpperCAmelCase_ : str = "matrix.txt" ): with open(os.path.join(os.path.dirname(UpperCAmelCase_ ) , UpperCAmelCase_ ) ) as in_file: lowerCamelCase_ = in_file.read() lowerCamelCase_ = [[int(Upp...
675
'''simple docstring''' def __snake_case ( UpperCAmelCase_ : str ): lowerCamelCase_ = "" for ch in key: if ch == " " or ch not in key_no_dups and ch.isalpha(): key_no_dups += ch return key_no_dups def __snake_case ( UpperCAmelCase_ : str ): lowerCamelCase_ ...
675
1
'''simple docstring''' from __future__ import annotations from math import pow, sqrt def __snake_case ( UpperCAmelCase_ : float , UpperCAmelCase_ : float , UpperCAmelCase_ : float ): if (resistance, reactance, impedance).count(0 ) != 1: raise ValueError("One...
675
'''simple docstring''' import json import os import unittest from transformers import OpenAIGPTTokenizer, OpenAIGPTTokenizerFast from transformers.models.openai.tokenization_openai import VOCAB_FILES_NAMES from transformers.testing_utils import require_ftfy, require_spacy, require_tokenizers from ......
675
1