code
stringlengths
81
54k
code_codestyle
int64
0
721
style_context
stringlengths
91
41.9k
style_context_codestyle
int64
0
699
label
int64
0
1
from ...configuration_utils import PretrainedConfig from ...utils import logging SCREAMING_SNAKE_CASE__ : Dict = logging.get_logger(__name__) SCREAMING_SNAKE_CASE__ : Any = { "google/fnet-base": "https://huggingface.co/google/fnet-base/resolve/main/config.json", "google/fnet-large...
720
import os import socket from contextlib import contextmanager import torch from ..commands.config.default import write_basic_config # noqa: F401 from ..state import PartialState from .dataclasses import DistributedType from .imports import is_deepspeed_available, is_tpu_available from .transformer_engine import conv...
636
0
from typing import Optional from torch import nn from .transformer_ad import TransformeraDModel, TransformeraDModelOutput class snake_case ( nn.Module ): def __init__( self : str , a_ : int = 16 , a_ : int = 88 , a_ : Optional[int] = None , a_ : int ...
721
from __future__ import annotations def _a ( lowercase__ : list[int | float] , lowercase__ : int , lowercase__ : int ): '''simple docstring''' if len(lowercase__ ) == 0: raise ValueError('find_max() arg is an empty sequence' ) if ( left >= ...
636
0
import itertools import os import random import tempfile import unittest import numpy as np from transformers import TvltFeatureExtractor, is_datasets_available from transformers.testing_utils import check_json_file_has_correct_format, require_torch, require_torchaudio from transformers.utils.import_utils import is_t...
700
# Copyright 2023 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
636
0
import os from pathlib import Path import numpy as np import pytest from pack_dataset import pack_data_dir from parameterized import parameterized from save_len_file import save_len_file from torch.utils.data import DataLoader from transformers import AutoTokenizer from transformers.models.mbart.modeling_mbart import...
701
import unittest import numpy as np import requests from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if is_torch_available(): ...
636
0
def _a ( lowercase__ : Tuple , lowercase__ : int , lowercase__ : List[Any]=False ): '''simple docstring''' if isinstance(lowercase__ , lowercase__ ) and isinstance(lowercase__ , lowercase__ ): SCREAMING_SNAKE_CASE__ : List[Any] = len(set_a.i...
702
import heapq as hq import math from collections.abc import Iterator class snake_case : def __init__( self : str , a_ : str )-> Any: """simple docstring""" SCREAMING_SNAKE_CASE__ : List[str] = str(id_ ) SCREAMING_SNAKE_CASE__ : Any =...
636
0
def _a ( lowercase__ : Optional[Any] , lowercase__ : Any , lowercase__ : List[str] , lowercase__ : str , lowercase__ : Dict , lowercase__ : Union[str, Any] ): '''simple docstring''' if index == r: for j in range(lowercase__ ): ...
703
def _a ( lowercase__ : int , lowercase__ : int ): '''simple docstring''' return int((input_a, input_a).count(0 ) != 0 ) def _a ( ): '''simple docstring''' assert nand_gate(0 , 0 ) == 1 assert nand_gate(0 , 1 ) == 1 asser...
636
0
# Copyright 2023 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by a...
704
from math import factorial, radians def _a ( lowercase__ : float , lowercase__ : int = 18 , lowercase__ : int = 10 ): '''simple docstring''' SCREAMING_SNAKE_CASE__ : Optional[Any] = angle_in_degrees - ((angle_in_degrees // 360.0) * 360.0) # Convert...
636
0
from ..utils import DummyObject, requires_backends class snake_case ( metaclass=UpperCamelCase_ ): lowercase_ = ['onnx'] def __init__( self : str , *a_ : Tuple , **a_ : Dict )-> Union[str, Any]: """simple docstring""" requires_backen...
705
import math def _a ( lowercase__ : int ): '''simple docstring''' assert isinstance(lowercase__ , lowercase__ ) and ( number >= 0 ), "'number' must been an int and positive" if 1 < number < 4: # 2 and 3 are primes return True elif...
636
0
import doctest import glob import importlib import inspect import os import re from contextlib import contextmanager from functools import wraps from unittest.mock import patch import numpy as np import pytest from absl.testing import parameterized import datasets from datasets import load_metric fr...
706
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, torch_device, ) from transformers.utils import ...
636
0
def _a ( lowercase__ : int = 10**9 ): '''simple docstring''' SCREAMING_SNAKE_CASE__ : Optional[int] = 1 SCREAMING_SNAKE_CASE__ : List[str] = 2 SCREAMING_SNAKE_CASE__ : Optional[int] = 0 SCREAMING_SNAKE_CASE__ : Optional[An...
707
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 ...test_modeling_common import ModelTeste...
636
0
from collections import OrderedDict from typing import Any, Mapping, Optional, Union from ...configuration_utils import PretrainedConfig from ...feature_extraction_utils import FeatureExtractionMixin from ...onnx import OnnxConfig from ...onnx.utils import compute_effective_axis_dimension from ...tokenization_uti...
708
import itertools import random import unittest import numpy as np from transformers import BatchFeature, SpeechTaFeatureExtractor from transformers.testing_utils import require_torch from transformers.utils.import_utils import is_torch_available from ...test_sequence_feature_extraction_common import SequenceFeatureE...
636
0
from ...configuration_utils import PretrainedConfig from ...utils import logging SCREAMING_SNAKE_CASE__ : str = logging.get_logger(__name__) SCREAMING_SNAKE_CASE__ : Any = { "EleutherAI/gpt-neox-20b": "https://huggingface.co/EleutherAI/gpt-neox-20b/resolve/main/config.json", # See...
709
import math import sys def _a ( lowercase__ : str ): '''simple docstring''' SCREAMING_SNAKE_CASE__ : Optional[Any] = '' try: with open(lowercase__ , 'rb' ) as binary_file: SCREAMING_SNAKE_CASE__ : Tuple = binary_file.read() ...
636
0
def _a ( lowercase__ : int , lowercase__ : int ): '''simple docstring''' return int((input_a, input_a).count(0 ) != 0 ) def _a ( ): '''simple docstring''' assert nand_gate(0 , 0 ) == 1 assert nand_gate(0 , 1 ) == 1 asser...
710
def _a ( lowercase__ : Optional[int] ): '''simple docstring''' SCREAMING_SNAKE_CASE__ : Optional[int] = [] SCREAMING_SNAKE_CASE__ : List[Any] = set({'(', '[', '{'} ) SCREAMING_SNAKE_CASE__ : Optional[int] = set({')', ']', '}'} ) SCREAMING_SNAKE...
636
0
SCREAMING_SNAKE_CASE__ : int = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" def _a ( ): '''simple docstring''' SCREAMING_SNAKE_CASE__ : List[Any] = input('Enter message: ' ) SCREAMING_SNAKE_CASE__ : Tuple = input('Enter key [alphanumeric]: ' ) SCREAMING_SN...
711
import unittest from transformers import PegasusTokenizer, PegasusTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, require_torch, slow from transformers.utils import cached_property from ...test_tokenization_common import TokenizerTesterMixin SCREAMING_S...
636
0
import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING SCREAMING_SNAKE_CASE__ : List[str] = logging.get_logger(__name__) SCREAMING_SNAKE_CASE__ : Optional[int] = { "ut/deta": "https://huggingface.co/ut/...
712
def _a ( lowercase__ : int = 1_00_00_00 ): '''simple docstring''' SCREAMING_SNAKE_CASE__ : str = [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 , lowercase__ ...
636
0
import random import unittest import numpy as np import transformers from transformers import is_flax_available, is_torch_available from transformers.testing_utils import is_pt_flax_cross_test, require_flax if is_flax_available(): import os import jax.numpy as jnp from jax import jit from ...
713
import argparse import json from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ( BertTokenizer, ViltConfig, ViltForImageAndTextRetrieval, ViltForImagesAndTextClassification, ViltForMaskedLM, ViltForQu...
636
0
def _a ( lowercase__ : Tuple , lowercase__ : str , lowercase__ : str , lowercase__ : Dict ): '''simple docstring''' if height >= 1: move_tower(height - 1 , lowercase__ , lowercase__ , lowercase__ ) move_disk(lowercase__ ...
714
from dataclasses import dataclass from typing import Tuple import numpy as np import torch @dataclass class snake_case : lowercase_ = 42 # [batch_size x 3] lowercase_ = 42 # [batch_size x 3] lowercase_ = 42 # [batch_size x 3] lowercase_ = 42 # [batch_size x 3] lowercase...
636
0
import argparse import json import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ViTImageProcessor, ViTMSNConfig, ViTMSNModel from transformers.image_utils import IMAGENET_DEFAULT_MEAN, IMAGENET_DEFAULT_STD torch.set_grad_enabled(False) def ...
715
import requests SCREAMING_SNAKE_CASE__ : int = "https://newsapi.org/v1/articles?source=bbc-news&sortBy=top&apiKey=" def _a ( lowercase__ : str ): '''simple docstring''' SCREAMING_SNAKE_CASE__ : Optional[Any] = requests.get(_NEWS_API + bbc_news_api_key ).j...
636
0
import operator as op def _a ( lowercase__ : List[str] ): '''simple docstring''' SCREAMING_SNAKE_CASE__ : Union[str, Any] = [] SCREAMING_SNAKE_CASE__ : List[Any] = lambda lowercase__ , lowercase__ : int(x / y ) # noqa: E731 integer division operat...
716
import argparse import json from dataclasses import dataclass, field from functools import partial from pathlib import Path from typing import Callable, Dict, List, Tuple import timm import torch import torch.nn as nn from classy_vision.models.regnet import RegNet, RegNetParams, RegNetYaagf, RegNetYaagf, RegNetYaaagf ...
636
0
'''simple docstring''' from __future__ import annotations def _a ( lowercase__ : list[int | float] , lowercase__ : int , lowercase__ : int ): '''simple docstring''' if len(lowercase__ ) == 0: raise ValueError('find_max() arg is an empty sequence' )...
717
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 ( UpperCamelCase_ ): lowercase_ = ['i...
636
0
import math import torch from torch import nn from ..configuration_utils import ConfigMixin, register_to_config from .attention_processor import Attention from .embeddings import get_timestep_embedding from .modeling_utils import ModelMixin class snake_case ( UpperCamelCase_ , UpperCamelCase_ ...
718
class snake_case ( UpperCamelCase_ ): pass class snake_case ( UpperCamelCase_ ): pass class snake_case : def __init__( self : Union[str, Any] )-> Tuple: """simple docstring""" SCREAMING_SNAKE_CASE__ : int = ...
636
0
from math import ceil def _a ( lowercase__ : int = 10_01 ): '''simple docstring''' SCREAMING_SNAKE_CASE__ : Dict = 1 for i in range(1 , int(ceil(n / 2.0 ) ) ): SCREAMING_SNAKE_CASE__ : List[Any] = 2 * i + 1 SCREAMING_SNAKE_CASE__ ...
719
from packaging import version from .import_utils import is_accelerate_available if is_accelerate_available(): import accelerate def _a ( lowercase__ : List[str] ): '''simple docstring''' if not is_accelerate_available(): return method SCREAMING_SNAKE_CASE...
636
0
from typing import Dict, List, Optional, Tuple, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, flip_channel_order, get_resize_output_image_size, rescale, resize, to_channel_dimension_...
720
import os import socket from contextlib import contextmanager import torch from ..commands.config.default import write_basic_config # noqa: F401 from ..state import PartialState from .dataclasses import DistributedType from .imports import is_deepspeed_available, is_tpu_available from .transformer_engine import conv...
636
0
import os from typing import Any, Callable, Dict, List, Optional, Tuple, Union import torch from torch import nn from ...models.controlnet import ControlNetModel, ControlNetOutput from ...models.modeling_utils import ModelMixin from ...utils import logging SCREAMING_SNAKE_CASE__ : List[str] = logging....
721
from __future__ import annotations def _a ( lowercase__ : list[int | float] , lowercase__ : int , lowercase__ : int ): '''simple docstring''' if len(lowercase__ ) == 0: raise ValueError('find_max() arg is an empty sequence' ) if ( left >= ...
636
0
import pickle import shutil import tempfile import unittest from transformers import SPIECE_UNDERLINE, XLMRobertaTokenizer, XLMRobertaTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from transformers.utils import cached_property from ...test_tokeniza...
700
# Copyright 2023 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
636
0
def _a ( lowercase__ : int , lowercase__ : int ) -> Tuple: '''simple docstring''' if a < 0 or b < 0: raise ValueError('the value of both inputs must be positive' ) SCREAMING_SNAKE_CASE__ : int = str(bin(lowercase__ ) )[2:] # remove the leading "0b...
701
import unittest import numpy as np import requests from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if is_torch_available(): ...
636
0
import warnings from ...configuration_utils import PretrainedConfig from ...utils import logging SCREAMING_SNAKE_CASE__ : List[str] = logging.get_logger(__name__) SCREAMING_SNAKE_CASE__ : Union[str, Any] = { "RUCAIBox/mvp": "https://huggingface.co/RUCAIBox/mvp/resolve/main/config.jso...
702
import heapq as hq import math from collections.abc import Iterator class snake_case : def __init__( self : str , a_ : str )-> Any: """simple docstring""" SCREAMING_SNAKE_CASE__ : List[str] = str(id_ ) SCREAMING_SNAKE_CASE__ : Any =...
636
0
import warnings from ...utils import logging from .image_processing_videomae import VideoMAEImageProcessor SCREAMING_SNAKE_CASE__ : int = logging.get_logger(__name__) class snake_case ( UpperCamelCase_ ): def __init__( self : List[Any] , *a_ : Optional[int] ...
703
def _a ( lowercase__ : int , lowercase__ : int ): '''simple docstring''' return int((input_a, input_a).count(0 ) != 0 ) def _a ( ): '''simple docstring''' assert nand_gate(0 , 0 ) == 1 assert nand_gate(0 , 1 ) == 1 asser...
636
0
def _a ( lowercase__ : int ): '''simple docstring''' if number < 0: raise ValueError('number must not be negative' ) return number & (number - 1) == 0 if __name__ == "__main__": import doctest doctest.testmod()
704
from math import factorial, radians def _a ( lowercase__ : float , lowercase__ : int = 18 , lowercase__ : int = 10 ): '''simple docstring''' SCREAMING_SNAKE_CASE__ : Optional[Any] = angle_in_degrees - ((angle_in_degrees // 360.0) * 360.0) # Convert...
636
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available SCREAMING_SNAKE_CASE__ : str = { "configuration_timesformer": ["TIMESFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP", "TimesformerConfig"], } try: if not is_torch_available(): ...
705
import math def _a ( lowercase__ : int ): '''simple docstring''' assert isinstance(lowercase__ , lowercase__ ) and ( number >= 0 ), "'number' must been an int and positive" if 1 < number < 4: # 2 and 3 are primes return True elif...
636
0
from __future__ import annotations def _a ( lowercase__ : int , lowercase__ : int ): '''simple docstring''' SCREAMING_SNAKE_CASE__ : list[list[int]] = [] create_all_state(1 , lowercase__ , lowercase__ , [] , lowercase...
706
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, torch_device, ) from transformers.utils import ...
636
0
import json import os from typing import Optional import numpy as np from ...feature_extraction_utils import BatchFeature from ...processing_utils import ProcessorMixin from ...utils import logging from ...utils.hub import get_file_from_repo from ..auto import AutoTokenizer SCREAMING_SNAKE_CASE__ : ...
707
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 ...test_modeling_common import ModelTeste...
636
0
import unittest from transformers import AutoTokenizer, NystromformerConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, ids_tensor, random_attention_mask fr...
708
import itertools import random import unittest import numpy as np from transformers import BatchFeature, SpeechTaFeatureExtractor from transformers.testing_utils import require_torch from transformers.utils.import_utils import is_torch_available from ...test_sequence_feature_extraction_common import SequenceFeatureE...
636
0
import re import string from collections import Counter import sacrebleu import sacremoses from packaging import version import datasets SCREAMING_SNAKE_CASE__ : Any = "\n@inproceedings{xu-etal-2016-optimizing,\n title = {Optimizing Statistical Machine Translation for Text Simplification},\n aut...
709
import math import sys def _a ( lowercase__ : str ): '''simple docstring''' SCREAMING_SNAKE_CASE__ : Optional[Any] = '' try: with open(lowercase__ , 'rb' ) as binary_file: SCREAMING_SNAKE_CASE__ : Tuple = binary_file.read() ...
636
0
import warnings from contextlib import contextmanager from ...processing_utils import ProcessorMixin class snake_case ( UpperCamelCase_ ): lowercase_ = 'Speech2TextFeatureExtractor' lowercase_ = 'Speech2TextTokenizer' def __init__( self : Union[str, Any] , a_ ...
710
def _a ( lowercase__ : Optional[int] ): '''simple docstring''' SCREAMING_SNAKE_CASE__ : Optional[int] = [] SCREAMING_SNAKE_CASE__ : List[Any] = set({'(', '[', '{'} ) SCREAMING_SNAKE_CASE__ : Optional[int] = set({')', ']', '}'} ) SCREAMING_SNAKE...
636
0
import contextlib from multiprocessing import Pool, RLock from tqdm.auto import tqdm from ..utils import experimental, logging SCREAMING_SNAKE_CASE__ : Any = logging.get_logger(__name__) class snake_case : lowercase_ = None @experimental def _a ( lowercase__ : ...
711
import unittest from transformers import PegasusTokenizer, PegasusTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, require_torch, slow from transformers.utils import cached_property from ...test_tokenization_common import TokenizerTesterMixin SCREAMING_S...
636
0
import requests SCREAMING_SNAKE_CASE__ : int = "https://newsapi.org/v1/articles?source=bbc-news&sortBy=top&apiKey=" def _a ( lowercase__ : str ): '''simple docstring''' SCREAMING_SNAKE_CASE__ : Optional[Any] = requests.get(_NEWS_API +...
712
def _a ( lowercase__ : int = 1_00_00_00 ): '''simple docstring''' SCREAMING_SNAKE_CASE__ : str = [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 , lowercase__ ...
636
0
import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import BertTokenizer, BertTokenizerFast from transformers.models.bert.tokenization_bert import VOCAB_FILES_NAMES from transformers.testing_utils import require_vision from transformers.utils import F...
713
import argparse import json from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ( BertTokenizer, ViltConfig, ViltForImageAndTextRetrieval, ViltForImagesAndTextClassification, ViltForMaskedLM, ViltForQu...
636
0
import argparse import json import os import sys import tempfile import unittest from argparse import Namespace from dataclasses import dataclass, field from enum import Enum from pathlib import Path from typing import List, Literal, Optional import yaml from transformers import HfArgumentParser, TrainingArgume...
714
from dataclasses import dataclass from typing import Tuple import numpy as np import torch @dataclass class snake_case : lowercase_ = 42 # [batch_size x 3] lowercase_ = 42 # [batch_size x 3] lowercase_ = 42 # [batch_size x 3] lowercase_ = 42 # [batch_size x 3] lowercase...
636
0
import unittest from transformers import MODEL_FOR_VISUAL_QUESTION_ANSWERING_MAPPING, is_vision_available from transformers.pipelines import pipeline from transformers.testing_utils import ( is_pipeline_test, nested_simplify, require_tf, require_torch, require_vision, slow, ) from .test_pipeli...
715
import requests SCREAMING_SNAKE_CASE__ : int = "https://newsapi.org/v1/articles?source=bbc-news&sortBy=top&apiKey=" def _a ( lowercase__ : str ): '''simple docstring''' SCREAMING_SNAKE_CASE__ : Optional[Any] = requests.get(_NEWS_API + bbc_news_api_key ).j...
636
0
from collections import OrderedDict from typing import TYPE_CHECKING, Any, Mapping, Optional from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...onnx.utils import compute_effective_axis_dimension from ...utils import logging if TYPE_CHECKING: ...
716
import argparse import json from dataclasses import dataclass, field from functools import partial from pathlib import Path from typing import Callable, Dict, List, Tuple import timm import torch import torch.nn as nn from classy_vision.models.regnet import RegNet, RegNetParams, RegNetYaagf, RegNetYaagf, RegNetYaaagf ...
636
0
'''simple docstring''' import unittest from transformers import AutoTokenizer, FalconConfig, 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 ...test_mo...
717
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 ( UpperCamelCase_ ): lowercase_ = ['i...
636
0
from __future__ import annotations class snake_case : def __init__( self : Any , a_ : int )-> None: """simple docstring""" SCREAMING_SNAKE_CASE__ : List[Any] = data SCREAMING_SNAKE_CASE__ : Node | None = None SCREAMING_SNAKE_CA...
718
class snake_case ( UpperCamelCase_ ): pass class snake_case ( UpperCamelCase_ ): pass class snake_case : def __init__( self : Union[str, Any] )-> Tuple: """simple docstring""" SCREAMING_SNAKE_CASE__ : int = ...
636
0
from __future__ import annotations from collections.abc import Iterator class snake_case : def __init__( self : Union[str, Any] , a_ : int )-> None: """simple docstring""" SCREAMING_SNAKE_CASE__ : Tuple = value SCREAMING_SNAKE_CASE__ : ...
719
from packaging import version from .import_utils import is_accelerate_available if is_accelerate_available(): import accelerate def _a ( lowercase__ : List[str] ): '''simple docstring''' if not is_accelerate_available(): return method SCREAMING_SNAKE_CASE...
636
0
import argparse import json import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from torchvision import transforms from transformers import BitImageProcessor, FocalNetConfig, FocalNetForImageClassification from transformers.image_utils import IMAGENET_DEFAULT_MEAN, IMAGENET_...
720
import os import socket from contextlib import contextmanager import torch from ..commands.config.default import write_basic_config # noqa: F401 from ..state import PartialState from .dataclasses import DistributedType from .imports import is_deepspeed_available, is_tpu_available from .transformer_engine import conv...
636
0
from sklearn.metrics import fa_score import datasets SCREAMING_SNAKE_CASE__ : Optional[Any] = "\nThe F1 score is the harmonic mean of the precision and recall. It can be computed with the equation:\nF1 = 2 * (precision * recall) / (precision + recall)\n" SCREAMING_SNAKE_CASE__ : Any = "...
721
from __future__ import annotations def _a ( lowercase__ : list[int | float] , lowercase__ : int , lowercase__ : int ): '''simple docstring''' if len(lowercase__ ) == 0: raise ValueError('find_max() arg is an empty sequence' ) if ( left >= ...
636
0
def _a ( lowercase__ : int , lowercase__ : List[Any] ): '''simple docstring''' print('\nThe shortest path matrix using Floyd Warshall algorithm\n' ) for i in range(lowercase__ ): for j in range(lowercase__ ): if dist[i][j] != float('inf' ): ...
700
# Copyright 2023 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
636
0
import json import os import re import sys import urllib.request import requests from bsa import BeautifulSoup SCREAMING_SNAKE_CASE__ : Tuple = { "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36" " (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36 Edge/18.19582" }...
701
import unittest import numpy as np import requests from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if is_torch_available(): ...
636
0
import math def _a ( lowercase__ : int ): '''simple docstring''' assert isinstance(lowercase__ , lowercase__ ) and ( number >= 0 ), "'number' must been an int and positive" if 1 < number < 4: # 2 and 3 are primes return True elif...
702
import heapq as hq import math from collections.abc import Iterator class snake_case : def __init__( self : str , a_ : str )-> Any: """simple docstring""" SCREAMING_SNAKE_CASE__ : List[str] = str(id_ ) SCREAMING_SNAKE_CASE__ : Any =...
636
0
import datetime import platform import subprocess from typing import Optional, Tuple, Union import numpy as np def _a ( lowercase__ : bytes , lowercase__ : int ): '''simple docstring''' SCREAMING_SNAKE_CASE__ : List[Any] = f'''{sampling_rate}''' SCREAMING_...
703
def _a ( lowercase__ : int , lowercase__ : int ): '''simple docstring''' return int((input_a, input_a).count(0 ) != 0 ) def _a ( ): '''simple docstring''' assert nand_gate(0 , 0 ) == 1 assert nand_gate(0 , 1 ) == 1 asser...
636
0
import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch if is_torch_available(): import torch from transformers.activations import gelu_new, gelu_python, get_activation @require_torch class snake_case ( unittest.TestCas...
704
from math import factorial, radians def _a ( lowercase__ : float , lowercase__ : int = 18 , lowercase__ : int = 10 ): '''simple docstring''' SCREAMING_SNAKE_CASE__ : Optional[Any] = angle_in_degrees - ((angle_in_degrees // 360.0) * 360.0) # Convert...
636
0
from __future__ import annotations import numpy as np def _a ( lowercase__ : np.ndarray ): '''simple docstring''' __A : Any = np.shape(lowercase__ ) if rows != columns: __A : Dict = ( '\'table\' has to be of square shaped array but...
705
import math def _a ( lowercase__ : int ): '''simple docstring''' assert isinstance(lowercase__ , lowercase__ ) and ( number >= 0 ), "'number' must been an int and positive" if 1 < number < 4: # 2 and 3 are primes return True elif...
636
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_tokenizers_available, is_torch_available, ) SCREAMING_SNAKE_CASE__ : Optional[int] = { "configuration_mobilebert": [ "MOBILEBERT_PRETRAIN...
706
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, torch_device, ) from transformers.utils import ...
636
0
from ....configuration_utils import PretrainedConfig from ....utils import logging SCREAMING_SNAKE_CASE__ : Tuple = logging.get_logger(__name__) SCREAMING_SNAKE_CASE__ : List[Any] = { "CarlCochet/trajectory-transformer-halfcheetah-medium-v2": ( "https://huggingface.co/...
707
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 ...test_modeling_common import ModelTeste...
636
0
import numpy as np from matplotlib import pyplot as plt from sklearn.datasets import load_iris from sklearn.metrics import ConfusionMatrixDisplay from sklearn.model_selection import train_test_split from xgboost import XGBClassifier def _a ( lowercase__ : dict ): '''simple docstri...
708
import itertools import random import unittest import numpy as np from transformers import BatchFeature, SpeechTaFeatureExtractor from transformers.testing_utils import require_torch from transformers.utils.import_utils import is_torch_available from ...test_sequence_feature_extraction_common import SequenceFeatureE...
636
0
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_configuration_common import ConfigTester...
709
import math import sys def _a ( lowercase__ : str ): '''simple docstring''' SCREAMING_SNAKE_CASE__ : Optional[Any] = '' try: with open(lowercase__ , 'rb' ) as binary_file: SCREAMING_SNAKE_CASE__ : Tuple = binary_file.read() ...
636
0
from math import pow def _a ( lowercase__ : int , lowercase__ : int , lowercase__ : int , lowercase__ : int , lowercase__ : int , ): '''simple docstring''' if current_sum == needed_sum: # If the sum of the powers is equal to needed_...
710
def _a ( lowercase__ : Optional[int] ): '''simple docstring''' SCREAMING_SNAKE_CASE__ : Optional[int] = [] SCREAMING_SNAKE_CASE__ : List[Any] = set({'(', '[', '{'} ) SCREAMING_SNAKE_CASE__ : Optional[int] = set({')', ']', '}'} ) SCREAMING_SNAKE...
636
0
import unittest from transformers import PegasusTokenizer, PegasusTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, require_torch, slow from transformers.utils import cached_property from ...test_tokenization_common import TokenizerTesterMixin SCREAMING_S...
711
import unittest from transformers import PegasusTokenizer, PegasusTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, require_torch, slow from transformers.utils import cached_property from ...test_tokenization_common import TokenizerTesterMixin SCREAMING_S...
636
0
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 SCREAMING_SNAKE_CASE__ : Optional[Any] = get_logger(__name__) SCREAMING_SNAKE_CASE__ : List[Any] = r"\n Args:\n ...
712
def _a ( lowercase__ : int = 1_00_00_00 ): '''simple docstring''' SCREAMING_SNAKE_CASE__ : str = [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 , lowercase__ ...
636
0
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/facebook/musicgen-small/resolve/main/compression_stat...
713
import argparse import json from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ( BertTokenizer, ViltConfig, ViltForImageAndTextRetrieval, ViltForImagesAndTextClassification, ViltForMaskedLM, ViltForQu...
636
0
import os from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils import AddedToken from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiece_available(): from .tokenization_xlnet imp...
714
from dataclasses import dataclass from typing import Tuple import numpy as np import torch @dataclass class snake_case : lowercase_ = 42 # [batch_size x 3] lowercase_ = 42 # [batch_size x 3] lowercase_ = 42 # [batch_size x 3] lowercase_ = 42 # [batch_size x 3] lowercase...
636
0
import tempfile import unittest import numpy as np import transformers from transformers import GPTaTokenizer, GPTJConfig, is_flax_available, is_torch_available from transformers.testing_utils import is_pt_flax_cross_test, require_flax, tooslow from ...generation.test_flax_utils import FlaxGenerationTesterMixin from...
715
import requests SCREAMING_SNAKE_CASE__ : int = "https://newsapi.org/v1/articles?source=bbc-news&sortBy=top&apiKey=" def _a ( lowercase__ : str ): '''simple docstring''' SCREAMING_SNAKE_CASE__ : Optional[Any] = requests.get(_NEWS_API + bbc_news_api_key ).j...
636
0
import timeit import numpy as np import datasets from datasets.arrow_writer import ArrowWriter from datasets.features.features import _ArrayXD def _a ( lowercase__ : Optional[int] ): '''simple docstring''' def wrapper(*lowercase__ : str , **lowercase__ : List[str...
716
import argparse import json from dataclasses import dataclass, field from functools import partial from pathlib import Path from typing import Callable, Dict, List, Tuple import timm import torch import torch.nn as nn from classy_vision.models.regnet import RegNet, RegNetParams, RegNetYaagf, RegNetYaagf, RegNetYaaagf ...
636
0
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices SCREAMING_SNAKE_CASE__ : List[str] = logging.get_logger(__name__) class snake_case (...
717
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 ( UpperCamelCase_ ): lowercase_ = ['i...
636
0
import copy import os from collections import OrderedDict from typing import TYPE_CHECKING, Any, Dict, Mapping, Optional, Union if TYPE_CHECKING: from ...processing_utils import ProcessorMixin from ...utils import TensorType from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from .....
718
class snake_case ( UpperCamelCase_ ): pass class snake_case ( UpperCamelCase_ ): pass class snake_case : def __init__( self : Union[str, Any] )-> Tuple: """simple docstring""" SCREAMING_SNAKE_CASE__ : int = ...
636
0
from math import factorial, radians def _a ( lowercase__ : float , lowercase__ : int = 18 , lowercase__ : int = 10 ): '''simple docstring''' SCREAMING_SNAKE_CASE__ : Optional[Any] = angle_in_degrees - ((angle_in_degrees // 360.0) * 360.0) # Convert...
719
from packaging import version from .import_utils import is_accelerate_available if is_accelerate_available(): import accelerate def _a ( lowercase__ : List[str] ): '''simple docstring''' if not is_accelerate_available(): return method SCREAMING_SNAKE_CASE...
636
0
class snake_case ( UpperCamelCase_ ): pass class snake_case ( UpperCamelCase_ ): pass class snake_case : def __init__( self : Union[str, Any] )-> Tuple: """simple docstring""" SCREAMING_SNAKE_CASE__ : int = ...
720
import os import socket from contextlib import contextmanager import torch from ..commands.config.default import write_basic_config # noqa: F401 from ..state import PartialState from .dataclasses import DistributedType from .imports import is_deepspeed_available, is_tpu_available from .transformer_engine import conv...
636
0
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging SCREAMING_SNAKE_CASE__ : Tuple = logging.get_logger(__name__) SCREAMING_SNAKE_CASE__ : Optional[Any] = { "fac...
721
from __future__ import annotations def _a ( lowercase__ : list[int | float] , lowercase__ : int , lowercase__ : int ): '''simple docstring''' if len(lowercase__ ) == 0: raise ValueError('find_max() arg is an empty sequence' ) if ( left >= ...
636
0
"""simple docstring""" def _snake_case ( _snake_case : int ): if upper_limit < 0: raise ValueError('''Limit for the Catalan sequence must be ≥ 0''' ) lowerCAmelCase : Tuple = [0] * (upper_limit + 1) # Base case: C(0) = C(1) = 1 lowerCAmel...
637
"""simple docstring""" from __future__ import annotations from PIL import Image # Define glider example snake_case__ : int = [ [0, 1, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0, 0, 0], [1, 1, 1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0...
637
1
"""simple docstring""" import unittest from transformers import SqueezeBertConfig, is_torch_available from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import Mo...
637
"""simple docstring""" from __future__ import annotations class snake_case_: def __init__( self : int , UpperCamelCase_ : str , UpperCamelCase_ : str ): lowerCAmelCase, lowerCAmelCase : List[str] = text, pattern lowerCAmelCas...
637
1
"""simple docstring""" from __future__ import annotations from collections.abc import Iterable, Iterator from dataclasses import dataclass snake_case__ : Union[str, Any] = (3, 9, -11, 0, 7, 5, 1, -1) snake_case__ : Union[str, Any] = (4, 6, 2, 0, 8, 10, 3, -2) @dataclass class ...
637
"""simple docstring""" from __future__ import annotations from typing import Any class snake_case_( a__ ): pass class snake_case_: def __init__( self : Any , UpperCamelCase_ : Any ): lowerCAmelCase : Any = data lowerCAmelCa...
637
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available snake_case__ : List[Any] = {'''configuration_glpn''': ['''GLPN_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''GLPNConfig''']} try: if not is...
637
"""simple docstring""" from torch import nn class snake_case_( nn.Module ): def __init__( self : int , UpperCamelCase_ : int , UpperCamelCase_ : int ): super().__init__() lowerCAmelCase : str = class_size lowerC...
637
1
"""simple docstring""" from itertools import count def _snake_case ( _snake_case : int = 50 ): lowerCAmelCase : List[Any] = [1] * min_block_length for n in count(_snake_case ): fill_count_functions.append(1 ) for block_length in range...
637
"""simple docstring""" class snake_case_: def __init__( self : Union[str, Any] , UpperCamelCase_ : str ): lowerCAmelCase : Dict = val lowerCAmelCase : str = None lowerCAmelCase : Dict = None def ...
637
1
"""simple docstring""" from __future__ import annotations import unittest import numpy as np from transformers import BlipTextConfig from transformers.testing_utils import require_tf, slow from transformers.utils import is_tf_available from ...test_configuration_common import ConfigTester from ...test_model...
637
"""simple docstring""" from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging snake_case__ : Tuple = logging.get_logger(__name__) snake_case__...
637
1
"""simple docstring""" import json import os import unittest from transformers.models.blenderbot_small.tokenization_blenderbot_small import ( VOCAB_FILES_NAMES, BlenderbotSmallTokenizer, ) from ...test_tokenization_common import TokenizerTesterMixin class snake_case_( a__ , unitte...
637
"""simple docstring""" import time import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch, torch_device from ..test_modeling_common import ids_tensor if is_torch_available(): import torch from transformers.generation import ( MaxLengthCriteri...
637
1
"""simple docstring""" import json import os import unittest from transformers import DebertaTokenizer, DebertaTokenizerFast from transformers.models.deberta.tokenization_deberta import VOCAB_FILES_NAMES from transformers.testing_utils import slow from ...test_tokenization_common import TokenizerTesterMixin ...
637
"""simple docstring""" import math from dataclasses import dataclass from typing import Optional, Tuple, Union import numpy as np import torch from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput, randn_tensor from .scheduling_utils import SchedulerMixin @datacla...
637
1
"""simple docstring""" import torch from diffusers import KDPMaDiscreteScheduler from diffusers.utils import torch_device from .test_schedulers import SchedulerCommonTest class snake_case_( a__ ): __UpperCamelCase = (KDPMaDiscreteScheduler,) __UpperCamelCase = 10 de...
637
"""simple docstring""" import unittest from parameterized import parameterized from transformers import LlamaConfig, is_torch_available, set_seed from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_comm...
637
1
"""simple docstring""" import json import os from functools import lru_cache from typing import Dict, List, Optional, Tuple, Union import regex as re from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...tokenization_utils_base import BatchEncoding, EncodedInput from ...utils import Paddin...
637
"""simple docstring""" import os import tempfile import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch if is_torch_available(): import torch from torch import nn from transformers import ( Adafactor, AdamW, get_constant_schedule, ...
637
1
"""simple docstring""" import json import os import subprocess import unittest from ast import literal_eval import pytest from parameterized import parameterized_class from . import is_sagemaker_available if is_sagemaker_available(): from sagemaker import Session, TrainingJobAnalytics from sagemaker.huggi...
637
"""simple docstring""" # Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-...
637
1
"""simple docstring""" import argparse import numpy as np import torch from transformers import SpeechTaHifiGan, SpeechTaHifiGanConfig, logging logging.set_verbosity_info() snake_case__ : Any = logging.get_logger('''transformers.models.speecht5''') def _snake_case ( _snake_ca...
637
"""simple docstring""" snake_case__ : List[Any] = '''Tobias Carryer''' from time import time class snake_case_: def __init__( self : Optional[Any] , UpperCamelCase_ : Optional[Any] , UpperCamelCase_ : Tuple , UpperCamelCase_ : Optional[int...
637
1
"""simple docstring""" import time import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch, torch_device from ..test_modeling_common import ids_tensor if is_torch_available(): import torch from transformers.generation import ( MaxLengthCriteri...
637
"""simple docstring""" import os from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils import AddedToken from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiece_available(): from .to...
637
1
"""simple docstring""" import gc import random import unittest import numpy as np import torch from transformers import CLIPImageProcessor, CLIPVisionConfig, CLIPVisionModel from diffusers import HeunDiscreteScheduler, PriorTransformer, ShapEImgaImgPipeline from diffusers.pipelines.shap_e import ShapERenderer...
637
"""simple docstring""" # using dfs for finding eulerian path traversal def _snake_case ( _snake_case : Optional[Any] , _snake_case : List[Any] , _snake_case : str , _snake_case : List[Any]=None ): lowerCAmelCase : Any = (path or []) + [u] for ...
637
1
"""simple docstring""" import enum import os from hashlib import shaaaa from typing import Optional from .. import config from .logging import get_logger snake_case__ : str = get_logger(__name__) class snake_case_( enum.Enum ): __UpperCamelCase = '''all_checks''' __...
637
"""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, BertTokenizer, ...
637
1
"""simple docstring""" import numpy as np def _snake_case ( _snake_case : np.ndarray , _snake_case : np.ndarray , _snake_case : float = 1E-12 , _snake_case : int = 100 , ): assert np.shape(_snake_case )[0] == np.shape(_snake_case )[1] # Ensure proper ...
637
"""simple docstring""" import json import os from functools import lru_cache from typing import Dict, List, Optional, Tuple, Union import regex as re from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...tokenization_utils_base import BatchEncoding, EncodedInput from ...utils import Paddin...
637
1
"""simple docstring""" from math import ceil def _snake_case ( _snake_case : int = 1001 ): lowerCAmelCase : Dict = 1 for i in range(1 , int(ceil(n / 2.0 ) ) ): lowerCAmelCase : List[str] = 2 * i + 1 lowerCAmelCase :...
637
"""simple docstring""" def _snake_case ( _snake_case : int = 4000000 ): lowerCAmelCase : int = [0, 1] lowerCAmelCase : List[str] = 0 while fib[i] <= n: fib.append(fib[i] + fib[i + 1] ) if fib[i + 2] > n: ...
637
1
"""simple docstring""" import torch from diffusers import StableDiffusionPipeline snake_case__ : Optional[Any] = '''path-to-your-trained-model''' snake_case__ : Any = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.floataa).to('''cuda''') snake_case__ : ...
637
"""simple docstring""" def _snake_case ( _snake_case : float , _snake_case : list[float] ): if discount_rate < 0: raise ValueError('''Discount rate cannot be negative''' ) if not cash_flows: raise ValueError('''Cash flows list cannot be empty'''...
637
1
"""simple docstring""" import copy import inspect import unittest import numpy as np from huggingface_hub import hf_hub_download from transformers import VideoMAEConfig from transformers.models.auto import get_values from transformers.testing_utils import require_torch, require_vision, slow, torch_device from...
637
"""simple docstring""" from __future__ import annotations def _snake_case ( _snake_case : list[int] , _snake_case : int ): if len(_snake_case ) == 0: return False lowerCAmelCase : List[Any] = len(_snake_case ) // 2 if a_list[midpoint] ...
637
1
"""simple docstring""" import os import tempfile import unittest from pathlib import Path from transformers import AutoConfig, is_tf_available from transformers.testing_utils import require_tf if is_tf_available(): import tensorflow as tf from transformers import TensorFlowBenchmark, TensorFlowBenchmarkAr...
637
"""simple docstring""" import os from collections import namedtuple import pytest from datasets import ClassLabel, Features, Sequence, Value from datasets.commands.test import TestCommand from datasets.info import DatasetInfo, DatasetInfosDict snake_case__ : Optional[Any] = namedtuple( ''...
637
1
"""simple docstring""" from __future__ import annotations import collections import pprint from pathlib import Path def _snake_case ( _snake_case : str ): return "".join(sorted(_snake_case ) ) def _snake_case ( _snake_case : str ): return word_by_...
637
"""simple docstring""" def _snake_case ( _snake_case : int , _snake_case : int ): return base * power(_snake_case , (exponent - 1) ) if exponent else 1 if __name__ == "__main__": print('''Raise base to the power of exponent using recursion...''') snake_case__ : Un...
637
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available, ) snake_case__ : Dict = {'''configuration_xlnet''': ['''...
637
"""simple docstring""" import unittest import numpy as np import timeout_decorator # noqa from transformers import BlenderbotConfig, is_flax_available from transformers.testing_utils import jax_device, require_flax, slow from ...generation.test_flax_utils import FlaxGenerationTesterMixin from ...test_modeli...
637
1
"""simple docstring""" from typing import Optional, Union import torch from torch import nn from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss from ...activations import ACTaFN from ...modeling_outputs import BaseModelOutputWithPoolingAndNoAttention, ImageClassifierOutputWithNoAttention from .....
637
"""simple docstring""" from __future__ import annotations from PIL import Image # Define glider example snake_case__ : int = [ [0, 1, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0, 0, 0], [1, 1, 1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0...
637
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, WavaVecaCTCTokenizer, WavaVeca...
637
"""simple docstring""" from __future__ import annotations class snake_case_: def __init__( self : int , UpperCamelCase_ : str , UpperCamelCase_ : str ): lowerCAmelCase, lowerCAmelCase : List[str] = text, pattern lowerCAmelCas...
637
1
"""simple docstring""" from collections.abc import Generator from math import sin def _snake_case ( _snake_case : bytes ): if len(_snake_case ) != 32: raise ValueError('''Input must be of length 32''' ) lowerCAmelCase : Any = B'''''' for i i...
637
"""simple docstring""" from __future__ import annotations from typing import Any class snake_case_( a__ ): pass class snake_case_: def __init__( self : Any , UpperCamelCase_ : Any ): lowerCAmelCase : Any = data lowerCAmelCa...
637
1
"""simple docstring""" class snake_case_: def __init__( self : Union[str, Any] , UpperCamelCase_ : str ): lowerCAmelCase : Dict = val lowerCAmelCase : str = None lowerCAmelCase : Dict = None def ...
637
"""simple docstring""" from torch import nn class snake_case_( nn.Module ): def __init__( self : int , UpperCamelCase_ : int , UpperCamelCase_ : int ): super().__init__() lowerCAmelCase : str = class_size lowerC...
637
1
"""simple docstring""" import warnings from ..trainer import Trainer from ..utils import logging snake_case__ : List[str] = logging.get_logger(__name__) class snake_case_( a__ ): def __init__( self : int , UpperCamelCase_ : Tuple=None , **UpperCa...
637
"""simple docstring""" class snake_case_: def __init__( self : Union[str, Any] , UpperCamelCase_ : str ): lowerCAmelCase : Dict = val lowerCAmelCase : str = None lowerCAmelCase : Dict = None def ...
637
1
"""simple docstring""" def _snake_case ( _snake_case : str ): lowerCAmelCase : str = '''''' 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 ( ...
637
"""simple docstring""" from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging snake_case__ : Tuple = logging.get_logger(__name__) snake_case__...
637
1
"""simple docstring""" import datasets from .evaluate import evaluate snake_case__ : List[Any] = '''\ @inproceedings{Rajpurkar2016SQuAD10, title={SQuAD: 100, 000+ Questions for Machine Comprehension of Text}, author={Pranav Rajpurkar and Jian Zhang and Konstantin Lopyrev and Percy Liang}, ...
637
"""simple docstring""" import time import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch, torch_device from ..test_modeling_common import ids_tensor if is_torch_available(): import torch from transformers.generation import ( MaxLengthCriteri...
637
1
"""simple docstring""" import unittest import numpy as np import timeout_decorator # noqa from transformers import BlenderbotConfig, is_flax_available from transformers.testing_utils import jax_device, require_flax, slow from ...generation.test_flax_utils import FlaxGenerationTesterMixin from ...test_modeli...
637
"""simple docstring""" import math from dataclasses import dataclass from typing import Optional, Tuple, Union import numpy as np import torch from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput, randn_tensor from .scheduling_utils import SchedulerMixin @datacla...
637
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available snake_case__ : List[Any] = { '''configuration_clipseg''': [ '''CLIPSEG_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''CLIPSegConfig''', ...
637
"""simple docstring""" import unittest from parameterized import parameterized from transformers import LlamaConfig, is_torch_available, set_seed from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_comm...
637
1
"""simple docstring""" from typing import List import datasets from datasets.tasks import AudioClassification from ..folder_based_builder import folder_based_builder snake_case__ : int = datasets.utils.logging.get_logger(__name__) class snake_case_( folder_based_builder.FolderBased...
637
"""simple docstring""" import os import tempfile import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch if is_torch_available(): import torch from torch import nn from transformers import ( Adafactor, AdamW, get_constant_schedule, ...
637
1