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
def a ( lowerCamelCase_ = 50 ): '''simple docstring''' lowercase__ = [1] * (length + 1) for row_length in range(length + 1 ): for tile_length in range(2 , 5 ): for tile_start in range(row_length - tile_length + 1 ): ...
671
import argparse import re from typing import Dict import torch from datasets import Audio, Dataset, load_dataset, load_metric from transformers import AutoFeatureExtractor, pipeline def a ( lowerCamelCase_ , lowerCamelCase_ ): '''simple docstring''' lowercase__ =...
671
1
import collections from typing import List, Optional, Union from ...tokenization_utils_base import BatchEncoding from ...utils import TensorType, add_end_docstrings, add_start_docstrings, logging from ..bert.tokenization_bert import BertTokenizer A__ : Any = logging.get_logger(__name__) A__ ...
671
from functools import reduce A__ : Union[str, Any] = ( '73167176531330624919225119674426574742355349194934' '96983520312774506326239578318016984801869478851843' '85861560789112949495459501737958331952853208805511' '12540698747158523863050715693290963295227443043557' '66896648...
671
1
import logging import os import sys from dataclasses import dataclass, field from typing import Optional from seqaseq_trainer import SeqaSeqTrainer from seqaseq_training_args import SeqaSeqTrainingArguments import transformers from transformers import ( AutoConfig, AutoModelForSeqaSeqLM, AutoTokeni...
671
# DISCLAIMER: This file is strongly influenced by https://github.com/yang-song/score_sde_pytorch import math from dataclasses import dataclass from typing import Optional, Tuple, Union import torch from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput, randn_tensor f...
671
1
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 _UpperCAmelCase ( A__ ): """simple docstring""" ...
671
from collections import defaultdict from math import gcd def a ( lowerCamelCase_ = 150_0000 ): '''simple docstring''' lowercase__ = defaultdict(lowerCamelCase_ ) lowercase__ = 2 while 2 * euclid_m * (euclid_m + 1) <= limit: for eucli...
671
1
from ..utils import DummyObject, requires_backends class _UpperCAmelCase ( metaclass=A__ ): """simple docstring""" lowercase__ = ["""flax"""] def __init__( self : Any, *lowerCamelCase : Optional[Any], **lowerCamelCase : int ): ''...
671
import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_bert import BertTokenizer A__ : Dict = logging.get_logger(__name__) A__ : Dict =...
671
1
def a ( lowerCamelCase_ ): '''simple docstring''' if not all(x.isalpha() for x in string ): raise ValueError('''String must only contain alphabetic characters.''' ) lowercase__ = sorted(string.lower() ) return len(lowerCamelCase_ )...
671
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) A__ : Any = {'configuration_unispeech': ['UNISPEECH_PRETRAINED_CONFIG_ARCHIVE_MAP', 'UniSpeechConfig']} try: ...
671
1
from __future__ import annotations from scipy.special import comb # type: ignore class _UpperCAmelCase : """simple docstring""" def __init__( self : Optional[int], lowerCamelCase : list[tuple[float, float]] ): '''simple docstring''' lowercase__ ...
671
import json import os import tempfile import transformers import datasets from utils import generate_example_dataset, get_duration A__ : Dict = 50_00_00 A__ , A__ : str = os.path.split(__file__) A__ : Optional[Any] = os.path.join(RESULTS_BASEPATH, 'res...
671
1
import json import logging import math import os import sys from dataclasses import dataclass, field from typing import Optional from datasets import Dataset, load_dataset import transformers from transformers import ( CONFIG_MAPPING, MODEL_FOR_MASKED_LM_MAPPING, AutoConfig, AutoModelForMaskedL...
671
class _UpperCAmelCase : """simple docstring""" def __init__( self : Optional[int], lowerCamelCase : str = "", lowerCamelCase : bool = False ): '''simple docstring''' # Mapping from the first character of the prefix of the node lowercase...
671
1
import argparse import logging import os from pathlib import Path from typing import Any, Dict import pytorch_lightning as pl from pytorch_lightning.utilities import rank_zero_info from transformers import ( AdamW, AutoConfig, AutoModel, AutoModelForPreTraining, AutoModelForQuestionAnswerin...
671
import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import MgpstrTokenizer from transformers.models.mgp_str.tokenization_mgp_str import VOCAB_FILES_NAMES from transformers.testing_utils import require_torch, require_vision from transformers.uti...
671
1
from __future__ import annotations import unittest from transformers import RoFormerConfig, 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, random_attention_mask...
671
def a ( lowerCamelCase_ , lowerCamelCase_ , lowerCamelCase_ ): '''simple docstring''' if exponent == 1: return base if exponent % 2 == 0: lowercase__ = _modexpt(lowerCamelCase_ , exponent // 2 , lowerCamelCase_ ) % modulo_value ...
671
1
import os import tempfile from functools import partial from unittest import TestCase from unittest.mock import patch import numpy as np import pytest from datasets.arrow_dataset import Dataset from datasets.search import ElasticSearchIndex, FaissIndex, MissingIndex from .utils import require_elasticsearch, r...
671
import inspect from typing import Callable, List, Optional, Union import torch from transformers import ( CLIPImageProcessor, CLIPTextModel, CLIPTokenizer, WhisperForConditionalGeneration, WhisperProcessor, ) from diffusers import ( AutoencoderKL, DDIMScheduler, DiffusionPipelin...
671
1
import argparse import os.path as osp import re import torch from safetensors.torch import load_file, save_file # =================# # UNet Conversion # # =================# A__ : List[str] = [ # (stable-diffusion, HF Diffusers) ('time_embed.0.weight', 'time_embedding.linear_1.weight'...
671
from __future__ import annotations from collections import deque from collections.abc import Iterator from dataclasses import dataclass @dataclass class _UpperCAmelCase : """simple docstring""" lowercase__ = 42 lowercase__ = 42 class _UpperCAmelCase ...
671
1
import collections import json import math import os import re import time from fnmatch import fnmatch from typing import Dict import requests from slack_sdk import WebClient A__ : str = WebClient(token=os.environ['CI_SLACK_BOT_TOKEN']) def a ( lowerCamelCase_ ): ...
671
class _UpperCAmelCase : """simple docstring""" def __init__( self : Optional[int], lowerCamelCase : Union[str, Any] ): '''simple docstring''' # we need a list not a string, so do something to change the type lowercase__ = arr.split('''...
671
1
def a ( lowerCamelCase_ ): '''simple docstring''' if not nums: # Makes sure that the list is not empty raise ValueError('''List is empty''' ) lowercase__ = sum(lowerCamelCase_ ) / len(lowerCamelCase_ ) # Calculate the average return su...
671
from itertools import count def a ( lowerCamelCase_ = 50 ): '''simple docstring''' lowercase__ = [1] * min_block_length for n in count(lowerCamelCase_ ): fill_count_functions.append(1 ) for block_length in range(lowerCamelCase_ , ...
671
1
import re def a ( lowerCamelCase_ ): '''simple docstring''' return [char.split() for char in re.split(r'''[^ a-z A-Z 0-9 \s]''' , str_ )] def a ( lowerCamelCase_ ): '''simple docstring''' lowercase__ = split_input(str_ ...
671
import copy from typing import Any, Dict, List, Optional, Union import numpy as np import torch from ...audio_utils import mel_filter_bank, spectrogram, window_function from ...feature_extraction_sequence_utils import SequenceFeatureExtractor from ...feature_extraction_utils import BatchFeature from ...utils i...
671
1
import gc import random import unittest import numpy as np import torch from PIL import Image from diffusers import ( DDIMScheduler, KandinskyVaaControlnetImgaImgPipeline, KandinskyVaaPriorEmbaEmbPipeline, UNetaDConditionModel, VQModel, ) from diffusers.utils import floats_tensor, load_imag...
671
from __future__ import annotations from collections import deque from collections.abc import Sequence from dataclasses import dataclass from typing import Any @dataclass class _UpperCAmelCase : """simple docstring""" lowercase__ = 42 lowercase__ = None lowe...
671
1
import argparse import json import logging import os import sys from unittest.mock import patch from transformers.testing_utils import TestCasePlus, get_gpu_count, slow A__ : Dict = [ os.path.join(os.path.dirname(__file__), dirname) for dirname in [ 'text-classification', ...
671
from transformers import DistilBertTokenizer, DistilBertTokenizerFast from transformers.testing_utils import require_tokenizers, slow from ..bert.test_tokenization_bert import BertTokenizationTest @require_tokenizers class _UpperCAmelCase ( A__ ): """simple docstring""" lowercase__ ...
671
1
import inspect import unittest from transformers import YolosConfig 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 from ...test...
671
from __future__ import annotations def a ( lowerCamelCase_ ): '''simple docstring''' lowercase__ = 0.00 lowercase__ = 0 for resistor in resistors: if resistor <= 0: lowercase__ = F"""Resistor at index {index} has a n...
671
1
def a ( lowerCamelCase_=2_8123 ): '''simple docstring''' lowercase__ = [1] * (limit + 1) for i in range(2 , int(limit**0.5 ) + 1 ): sum_divs[i * i] += i for k in range(i + 1 , limit // i + 1 ): sum_divs[k * i] += ...
671
import argparse import re import requests import torch # git clone https://github.com/salesforce/BLIP.git from models.blip import blip_decoder from models.blip_itm import blip_itm from models.blip_vqa import blip_vqa from PIL import Image from torchvision import transforms from torchvision.transforms.functiona...
671
1
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__ : Any = { 'roberta-base': 'https://huggingface.co/ro...
671
import unittest import numpy as np 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(): impo...
671
1
import unittest from transformers import is_tf_available from transformers.testing_utils import require_tf if is_tf_available(): import tensorflow as tf from tensorflow.python.eager import context from tensorflow.python.framework import ops from transformers import GradientAccumul...
671
import argparse import os import re A__ : Optional[int] = 'src/transformers' # Pattern that looks at the indentation in a line. A__ : Union[str, Any] = re.compile(r'^(\s*)\S') # Pattern that matches `"key":" and puts `key` in group 0. A__ : List[str] = re.compil...
671
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_tokenizers_available, is_torch_available, ) A__ : str = { 'configuration_lxmert': ['LXMERT_PRETRAINED_CONFIG_ARCHIVE_MAP', 'LxmertConfig'], 'toke...
671
from math import sqrt def a ( lowerCamelCase_ ): '''simple docstring''' assert isinstance(lowerCamelCase_ , lowerCamelCase_ ) and ( number >= 0 ), "'number' must been an int and positive" lowercase__ = True # 0 and 1 are none primes. ...
671
1
from typing import Dict, List, Optional, Tuple, Union import torch from ...models import AutoencoderKL, TransformeraDModel from ...schedulers import KarrasDiffusionSchedulers from ...utils import randn_tensor from ..pipeline_utils import DiffusionPipeline, ImagePipelineOutput class _UpperCAmelCase ( A_...
671
import argparse import re from typing import Dict import torch from datasets import Audio, Dataset, load_dataset, load_metric from transformers import AutoFeatureExtractor, pipeline def a ( lowerCamelCase_ , lowerCamelCase_ ): '''simple docstring''' lowercase__ =...
671
1
import gc import random import tempfile import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import AutoencoderKL, DDIMScheduler, LMSDiscreteScheduler, PNDMScheduler, UNetaDConditionModel from diffusers.pipelines.stable_diffusion_s...
671
from functools import reduce A__ : Union[str, Any] = ( '73167176531330624919225119674426574742355349194934' '96983520312774506326239578318016984801869478851843' '85861560789112949495459501737958331952853208805511' '12540698747158523863050715693290963295227443043557' '66896648...
671
1
import warnings from ...utils import logging from .image_processing_beit import BeitImageProcessor A__ : Union[str, Any] = logging.get_logger(__name__) class _UpperCAmelCase ( A__ ): """simple docstring""" def __init__( self : Tuple, *lowerCamelCase : Lis...
671
# DISCLAIMER: This file is strongly influenced by https://github.com/yang-song/score_sde_pytorch import math from dataclasses import dataclass from typing import Optional, Tuple, Union import torch from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput, randn_tensor f...
671
1
def a ( lowerCamelCase_ , lowerCamelCase_ ): '''simple docstring''' if len(lowerCamelCase_ ) != len(lowerCamelCase_ ): raise ValueError('''String lengths must match!''' ) lowercase__ = 0 for chara, chara in zip(lowerCamelCase_ , ...
671
from collections import defaultdict from math import gcd def a ( lowerCamelCase_ = 150_0000 ): '''simple docstring''' lowercase__ = defaultdict(lowerCamelCase_ ) lowercase__ = 2 while 2 * euclid_m * (euclid_m + 1) <= limit: for eucli...
671
1
import os def a ( ): '''simple docstring''' lowercase__ = os.path.join(os.path.dirname(lowerCamelCase_ ) , '''num.txt''' ) with open(lowerCamelCase_ ) as file_hand: return str(sum(int(lowerCamelCase_ ) for line in file_hand ) ...
671
import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_bert import BertTokenizer A__ : Dict = logging.get_logger(__name__) A__ : Dict =...
671
1
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 SequenceF...
671
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) A__ : Any = {'configuration_unispeech': ['UNISPEECH_PRETRAINED_CONFIG_ARCHIVE_MAP', 'UniSpeechConfig']} try: ...
671
1
import inspect import unittest from datasets import load_dataset from packaging import version from transformers import BeitConfig from transformers.models.auto import get_values from transformers.testing_utils import require_torch, require_torch_multi_gpu, require_vision, slow, torch_device from transformers....
671
import json import os import tempfile import transformers import datasets from utils import generate_example_dataset, get_duration A__ : Dict = 50_00_00 A__ , A__ : str = os.path.split(__file__) A__ : Optional[Any] = os.path.join(RESULTS_BASEPATH, 'res...
671
1
import warnings warnings.warn( 'memory_utils has been reorganized to utils.memory. Import `find_executable_batchsize` from the main `__init__`: ' '`from accelerate import find_executable_batch_size` to avoid this warning.', FutureWarning, )
671
class _UpperCAmelCase : """simple docstring""" def __init__( self : Optional[int], lowerCamelCase : str = "", lowerCamelCase : bool = False ): '''simple docstring''' # Mapping from the first character of the prefix of the node lowercase...
671
1
# This script creates a super tiny model that is useful inside tests, when we just want to test that # the machinery works, without needing to the check the quality of the outcomes. # # This version creates a tiny model through reduction of a normal pre-trained model, but keeping the # full vocab, merges file, a...
671
import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import MgpstrTokenizer from transformers.models.mgp_str.tokenization_mgp_str import VOCAB_FILES_NAMES from transformers.testing_utils import require_torch, require_vision from transformers.uti...
671
1
from functools import reduce A__ : Union[str, Any] = ( '73167176531330624919225119674426574742355349194934' '96983520312774506326239578318016984801869478851843' '85861560789112949495459501737958331952853208805511' '12540698747158523863050715693290963295227443043557' '66896648...
671
def a ( lowerCamelCase_ , lowerCamelCase_ , lowerCamelCase_ ): '''simple docstring''' if exponent == 1: return base if exponent % 2 == 0: lowercase__ = _modexpt(lowerCamelCase_ , exponent // 2 , lowerCamelCase_ ) % modulo_value ...
671
1
import math def a ( lowerCamelCase_ ): '''simple docstring''' assert isinstance(lowerCamelCase_ , lowerCamelCase_ ) and ( number >= 0 ), "'number' must been an int and positive" if 1 < number < 4: # 2 and 3 are primes return True ...
671
import inspect from typing import Callable, List, Optional, Union import torch from transformers import ( CLIPImageProcessor, CLIPTextModel, CLIPTokenizer, WhisperForConditionalGeneration, WhisperProcessor, ) from diffusers import ( AutoencoderKL, DDIMScheduler, DiffusionPipelin...
671
1
import argparse import re import requests import torch # git clone https://github.com/salesforce/BLIP.git from models.blip import blip_decoder from models.blip_itm import blip_itm from models.blip_vqa import blip_vqa from PIL import Image from torchvision import transforms from torchvision.transforms.functiona...
671
from __future__ import annotations from collections import deque from collections.abc import Iterator from dataclasses import dataclass @dataclass class _UpperCAmelCase : """simple docstring""" lowercase__ = 42 lowercase__ = 42 class _UpperCAmelCase ...
671
1
def a ( lowerCamelCase_ ): '''simple docstring''' lowercase__ = set() # To detect a back edge, keep track of vertices currently in the recursion stack lowercase__ = set() return any( node not in visited and depth_first_search(lowerCamelCase_...
671
class _UpperCAmelCase : """simple docstring""" def __init__( self : Optional[int], lowerCamelCase : Union[str, Any] ): '''simple docstring''' # we need a list not a string, so do something to change the type lowercase__ = arr.split('''...
671
1
# Copyright 2021 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 ap...
671
from itertools import count def a ( lowerCamelCase_ = 50 ): '''simple docstring''' lowercase__ = [1] * min_block_length for n in count(lowerCamelCase_ ): fill_count_functions.append(1 ) for block_length in range(lowerCamelCase_ , ...
671
1
def a ( lowerCamelCase_ , lowerCamelCase_ ): '''simple docstring''' if digit_amount > 0: return round(number - int(lowerCamelCase_ ) , lowerCamelCase_ ) return number - int(lowerCamelCase_ ) if __name__ == "__main__": print(decimal_isol...
671
import copy from typing import Any, Dict, List, Optional, Union import numpy as np import torch from ...audio_utils import mel_filter_bank, spectrogram, window_function from ...feature_extraction_sequence_utils import SequenceFeatureExtractor from ...feature_extraction_utils import BatchFeature from ...utils i...
671
1
import argparse import logging import pickle import random import time import numpy as np from transformers import BertTokenizer, GPTaTokenizer, RobertaTokenizer logging.basicConfig( format='%(asctime)s - %(levelname)s - %(name)s - %(message)s', datefmt='%m/%d/%Y %H:%M:%S', level=logging.INFO ) A__ : ...
671
from __future__ import annotations from collections import deque from collections.abc import Sequence from dataclasses import dataclass from typing import Any @dataclass class _UpperCAmelCase : """simple docstring""" lowercase__ = 42 lowercase__ = None lowe...
671
1
import math def a ( lowerCamelCase_ ): '''simple docstring''' return math.sqrt(lowerCamelCase_ ) * math.sqrt(lowerCamelCase_ ) == num def a ( lowerCamelCase_ ): '''simple docstring''' lowercase__ = 0 lowercase__ ...
671
from transformers import DistilBertTokenizer, DistilBertTokenizerFast from transformers.testing_utils import require_tokenizers, slow from ..bert.test_tokenization_bert import BertTokenizationTest @require_tokenizers class _UpperCAmelCase ( A__ ): """simple docstring""" lowercase__ ...
671
1
import gc import unittest import numpy as np import torch from diffusers import ( AudioDiffusionPipeline, AutoencoderKL, DDIMScheduler, DDPMScheduler, DiffusionPipeline, Mel, UNetaDConditionModel, UNetaDModel, ) from diffusers.utils import slow, torch_device from diffusers.utils...
671
from __future__ import annotations def a ( lowerCamelCase_ ): '''simple docstring''' lowercase__ = 0.00 lowercase__ = 0 for resistor in resistors: if resistor <= 0: lowercase__ = F"""Resistor at index {index} has a n...
671
1
def a ( lowerCamelCase_ , lowerCamelCase_ , lowerCamelCase_ ): '''simple docstring''' if exponent == 1: return base if exponent % 2 == 0: lowercase__ = _modexpt(lowerCamelCase_ , exponent // 2 , lowerCamelCase_ ) % modulo_value ...
671
import argparse import re import requests import torch # git clone https://github.com/salesforce/BLIP.git from models.blip import blip_decoder from models.blip_itm import blip_itm from models.blip_vqa import blip_vqa from PIL import Image from torchvision import transforms from torchvision.transforms.functiona...
671
1
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__ : Any = False class _UpperCAmelCase ( unittest.TestCase ): """simple docstring""" ...
671
import unittest import numpy as np 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(): impo...
671
1
import json import unittest import numpy as np from huggingface_hub import hf_hub_download 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, pre...
671
import argparse import os import re A__ : Optional[int] = 'src/transformers' # Pattern that looks at the indentation in a line. A__ : Union[str, Any] = re.compile(r'^(\s*)\S') # Pattern that matches `"key":" and puts `key` in group 0. A__ : List[str] = re.compil...
671
1
import copy from typing import Any, Dict, List, Optional, Union import numpy as np import torch from ...audio_utils import mel_filter_bank, spectrogram, window_function from ...feature_extraction_sequence_utils import SequenceFeatureExtractor from ...feature_extraction_utils import BatchFeature from ...utils i...
671
from math import sqrt def a ( lowerCamelCase_ ): '''simple docstring''' assert isinstance(lowerCamelCase_ , lowerCamelCase_ ) and ( number >= 0 ), "'number' must been an int and positive" lowercase__ = True # 0 and 1 are none primes. ...
671
1
import os import numpy import onnx def a ( lowerCamelCase_ , lowerCamelCase_ ): '''simple docstring''' lowercase__ = a.name lowercase__ = b.name lowercase__ = '''''' lowercase__ = '''''' lowercase__ = ...
671
import argparse import re from typing import Dict import torch from datasets import Audio, Dataset, load_dataset, load_metric from transformers import AutoFeatureExtractor, pipeline def a ( lowerCamelCase_ , lowerCamelCase_ ): '''simple docstring''' lowercase__ =...
671
1
import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging A__ : List[str] = '▁' A__ : Tuple = {'vocab_file': 'spiece.model'} A__ :...
671
from functools import reduce A__ : Union[str, Any] = ( '73167176531330624919225119674426574742355349194934' '96983520312774506326239578318016984801869478851843' '85861560789112949495459501737958331952853208805511' '12540698747158523863050715693290963295227443043557' '66896648...
671
1
import os import textwrap import pyarrow as pa import pytest from datasets import ClassLabel, Features, Image from datasets.packaged_modules.csv.csv import Csv from ..utils import require_pil @pytest.fixture def a ( lowerCamelCase_ ): '''simple docstring''' lowercase__ ...
671
# DISCLAIMER: This file is strongly influenced by https://github.com/yang-song/score_sde_pytorch import math from dataclasses import dataclass from typing import Optional, Tuple, Union import torch from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput, randn_tensor f...
671
1
from transformers import DistilBertTokenizer, DistilBertTokenizerFast from transformers.testing_utils import require_tokenizers, slow from ..bert.test_tokenization_bert import BertTokenizationTest @require_tokenizers class _UpperCAmelCase ( A__ ): """simple docstring""" lowercase__ ...
671
from collections import defaultdict from math import gcd def a ( lowerCamelCase_ = 150_0000 ): '''simple docstring''' lowercase__ = defaultdict(lowerCamelCase_ ) lowercase__ = 2 while 2 * euclid_m * (euclid_m + 1) <= limit: for eucli...
671
1
from math import sqrt def a ( lowerCamelCase_ ): '''simple docstring''' lowercase__ = 0 for i in range(1 , int(sqrt(SCREAMING_SNAKE_CASE_ ) + 1 ) ): if n % i == 0 and i != sqrt(SCREAMING_SNAKE_CASE_ ): total += i +...
700
import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_bert import BertTokenizer A__ : Dict = logging.get_logger(__name__) A__ : Dict =...
671
0
import json from typing import List, Optional, Tuple from tokenizers import normalizers from ....tokenization_utils_fast import PreTrainedTokenizerFast from ....utils import logging from .tokenization_retribert import RetriBertTokenizer A__ : Dict = logging.get_logger(__name__) A__ : Op...
701
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) A__ : Any = {'configuration_unispeech': ['UNISPEECH_PRETRAINED_CONFIG_ARCHIVE_MAP', 'UniSpeechConfig']} try: ...
671
0
from typing import TYPE_CHECKING # rely on isort to merge the imports from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available A__ : Optional[Any] = {'configuration_mra': ['MRA_PRETRAINED_CONFIG_ARCHIVE_MAP', 'MraConfig']} try: if no...
702
import json import os import tempfile import transformers import datasets from utils import generate_example_dataset, get_duration A__ : Dict = 50_00_00 A__ , A__ : str = os.path.split(__file__) A__ : Optional[Any] = os.path.join(RESULTS_BASEPATH, 'res...
671
0
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 PoolFormerConfig, PoolFormerForImageClassification, PoolFormerImageProcessor from transformers.utils i...
703
class _UpperCAmelCase : """simple docstring""" def __init__( self : Optional[int], lowerCamelCase : str = "", lowerCamelCase : bool = False ): '''simple docstring''' # Mapping from the first character of the prefix of the node lowercase...
671
0
from collections.abc import Callable import numpy as np def a ( lowerCamelCase_ , lowerCamelCase_ , lowerCamelCase_ , lowerCamelCase_ , lowerCamelCase_ ): '''simple docstring''' lowercase__ = int(np.ceil((x_end - xa) / step_size ) ) ...
704
import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import MgpstrTokenizer from transformers.models.mgp_str.tokenization_mgp_str import VOCAB_FILES_NAMES from transformers.testing_utils import require_torch, require_vision from transformers.uti...
671
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) A__ : Tuple = { "configuration_gpt_bigcode": ["GPT_BIGCODE_PRETRAINED_CONFIG_ARCHIVE_MAP", "GPTBigCodeConfig"], } try: if not is_torch_available():...
705
def a ( lowerCamelCase_ , lowerCamelCase_ , lowerCamelCase_ ): '''simple docstring''' if exponent == 1: return base if exponent % 2 == 0: lowercase__ = _modexpt(lowerCamelCase_ , exponent // 2 , lowerCamelCase_ ) % modulo_value ...
671
0
import importlib.util import json import os import warnings from dataclasses import dataclass, field import torch from ..training_args import TrainingArguments from ..utils import cached_property, is_sagemaker_dp_enabled, logging A__ : int = logging.get_logger(__name__) def a ( )...
706
import inspect from typing import Callable, List, Optional, Union import torch from transformers import ( CLIPImageProcessor, CLIPTextModel, CLIPTokenizer, WhisperForConditionalGeneration, WhisperProcessor, ) from diffusers import ( AutoencoderKL, DDIMScheduler, DiffusionPipelin...
671
0
import logging import os import sys from dataclasses import dataclass, field from typing import Optional from seqaseq_trainer import SeqaSeqTrainer from seqaseq_training_args import SeqaSeqTrainingArguments import transformers from transformers import ( AutoConfig, AutoModelForSeqaSeqLM, AutoTokeni...
707
from __future__ import annotations from collections import deque from collections.abc import Iterator from dataclasses import dataclass @dataclass class _UpperCAmelCase : """simple docstring""" lowercase__ = 42 lowercase__ = 42 class _UpperCAmelCase ...
671
0
import argparse import json from collections import OrderedDict from functools import partial from pathlib import Path import timm import torch from huggingface_hub import hf_hub_download from transformers import LevitConfig, LevitForImageClassificationWithTeacher, LevitImageProcessor from transformers.utils i...
708
class _UpperCAmelCase : """simple docstring""" def __init__( self : Optional[int], lowerCamelCase : Union[str, Any] ): '''simple docstring''' # we need a list not a string, so do something to change the type lowercase__ = arr.split('''...
671
0
import dataclasses import json import sys import types from argparse import ArgumentDefaultsHelpFormatter, ArgumentParser, ArgumentTypeError from copy import copy from enum import Enum from inspect import isclass from pathlib import Path from typing import Any, Callable, Dict, Iterable, List, Literal, NewType, O...
709
from itertools import count def a ( lowerCamelCase_ = 50 ): '''simple docstring''' lowercase__ = [1] * min_block_length for n in count(lowerCamelCase_ ): fill_count_functions.append(1 ) for block_length in range(lowerCamelCase_ , ...
671
0
import logging import os import random import sys from dataclasses import dataclass, field from typing import Optional import datasets import numpy as np import pandas as pd from datasets import load_dataset import transformers from transformers import ( AutoConfig, BartForSequenceClassification, DataCol...
710
import copy from typing import Any, Dict, List, Optional, Union import numpy as np import torch from ...audio_utils import mel_filter_bank, spectrogram, window_function from ...feature_extraction_sequence_utils import SequenceFeatureExtractor from ...feature_extraction_utils import BatchFeature from ...utils i...
671
0
from __future__ import annotations class _UpperCAmelCase : """simple docstring""" def __init__( self : Union[str, Any], lowerCamelCase : str, lowerCamelCase : str ): '''simple docstring''' lowercase__ = text, pattern lowercas...
711
from __future__ import annotations from collections import deque from collections.abc import Sequence from dataclasses import dataclass from typing import Any @dataclass class _UpperCAmelCase : """simple docstring""" lowercase__ = 42 lowercase__ = None lowe...
671
0
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, WavaVecaFeatureExtractor, WavaVe...
712
from transformers import DistilBertTokenizer, DistilBertTokenizerFast from transformers.testing_utils import require_tokenizers, slow from ..bert.test_tokenization_bert import BertTokenizationTest @require_tokenizers class _UpperCAmelCase ( A__ ): """simple docstring""" lowercase__ ...
671
0
import argparse import json import os import pickle import shutil import numpy as np import torch from distiller import Distiller from lm_seqs_dataset import LmSeqsDataset from transformers import ( BertConfig, BertForMaskedLM, BertTokenizer, DistilBertConfig, DistilBertForMaskedLM, Dis...
713
from __future__ import annotations def a ( lowerCamelCase_ ): '''simple docstring''' lowercase__ = 0.00 lowercase__ = 0 for resistor in resistors: if resistor <= 0: lowercase__ = F"""Resistor at index {index} has a n...
671
0
import argparse import json import os from tensorflow.core.protobuf.saved_model_pba import SavedModel # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_copies.py A__ : List[str] = '.' # Internal TensorFlow ops that c...
714
import argparse import re import requests import torch # git clone https://github.com/salesforce/BLIP.git from models.blip import blip_decoder from models.blip_itm import blip_itm from models.blip_vqa import blip_vqa from PIL import Image from torchvision import transforms from torchvision.transforms.functiona...
671
0
def a ( lowerCamelCase_ , lowerCamelCase_ , lowerCamelCase_ , lowerCamelCase_ ): '''simple docstring''' global f # a global dp table for knapsack if f[i][j] < 0: if j < wt[i - 1]: lowercase__ = mf_knapsack(i - 1 , __A , __A , ...
715
import unittest import numpy as np 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(): impo...
671
0
import os from typing import List, Optional, Union from ...image_processing_utils import BatchFeature from ...image_utils import ImageInput from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import...
716
import argparse import os import re A__ : Optional[int] = 'src/transformers' # Pattern that looks at the indentation in a line. A__ : Union[str, Any] = re.compile(r'^(\s*)\S') # Pattern that matches `"key":" and puts `key` in group 0. A__ : List[str] = re.compil...
671
0
import numpy as np class _UpperCAmelCase : """simple docstring""" def __init__( self : Dict ): '''simple docstring''' lowercase__ = (0, 0) lowercase__ = None lowercase__ = 0 lowercase__ = 0 ...
717
from math import sqrt def a ( lowerCamelCase_ ): '''simple docstring''' assert isinstance(lowerCamelCase_ , lowerCamelCase_ ) and ( number >= 0 ), "'number' must been an int and positive" lowercase__ = True # 0 and 1 are none primes. ...
671
0
'''simple docstring''' import json import os from typing import Optional, Tuple from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging A__ : List[str] = logging.get_logger(__name__) A__ : Optional[int] = {"vocab_file": "vocab.json"} A__ : ...
718
import argparse import re from typing import Dict import torch from datasets import Audio, Dataset, load_dataset, load_metric from transformers import AutoFeatureExtractor, pipeline def a ( lowerCamelCase_ , lowerCamelCase_ ): '''simple docstring''' lowercase__ =...
671
0
import unittest from transformers import is_flax_available from transformers.testing_utils import require_flax, require_sentencepiece, require_tokenizers, require_torch, slow if is_flax_available(): import optax from flax.training.common_utils import onehot from transformers import AutoT...
719
from functools import reduce A__ : Union[str, Any] = ( '73167176531330624919225119674426574742355349194934' '96983520312774506326239578318016984801869478851843' '85861560789112949495459501737958331952853208805511' '12540698747158523863050715693290963295227443043557' '66896648...
671
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available A__ : Union[str, Any] = { """configuration_mobilenet_v2""": [ """MOBILENET_V2_PRETRAINED_CONFIG_ARCHIVE_MAP""", """MobileNetV2Config"""...
720
# DISCLAIMER: This file is strongly influenced by https://github.com/yang-song/score_sde_pytorch import math from dataclasses import dataclass from typing import Optional, Tuple, Union import torch from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput, randn_tensor f...
671
0
import json from typing import TYPE_CHECKING, List, Optional, Tuple from tokenizers import pre_tokenizers from ...tokenization_utils_base import BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_gpta import GPTaTokenizer ...
721
from collections import defaultdict from math import gcd def a ( lowerCamelCase_ = 150_0000 ): '''simple docstring''' lowercase__ = defaultdict(lowerCamelCase_ ) lowercase__ = 2 while 2 * euclid_m * (euclid_m + 1) <= limit: for eucli...
671
0
import argparse import copy def a ( lowerCamelCase_ ): '''simple docstring''' lowercase__ = {} with open(snake_case__ ) as f: for line in f: if line.split()[0] not in dict_of_neighbours: lowercase__ = [] ...
700
import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_bert import BertTokenizer A__ : Dict = logging.get_logger(__name__) A__ : Dict =...
671
0
from __future__ import annotations import typing from collections.abc import Iterable import numpy as np A__ : int = typing.Union[Iterable[float], Iterable[int], np.ndarray] # noqa: UP007 A__ : Any = typing.Union[np.floataa, int, float] # noqa: UP007 def a ( l...
701
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) A__ : Any = {'configuration_unispeech': ['UNISPEECH_PRETRAINED_CONFIG_ARCHIVE_MAP', 'UniSpeechConfig']} try: ...
671
0
from typing import Optional import torch import torch.utils.checkpoint from torch import Tensor, nn from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss from ...activations import ACTaFN from ...modeling_outputs import ( BackboneOutput, BaseModelOutputWithNoAttention, BaseModelOutputWi...
702
import json import os import tempfile import transformers import datasets from utils import generate_example_dataset, get_duration A__ : Dict = 50_00_00 A__ , A__ : str = os.path.split(__file__) A__ : Optional[Any] = os.path.join(RESULTS_BASEPATH, 'res...
671
0
from __future__ import annotations import inspect import unittest from typing import List, Tuple from transformers import RegNetConfig from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import cached_property, is_tf_available, is_vision_available from ...test_confi...
703
class _UpperCAmelCase : """simple docstring""" def __init__( self : Optional[int], lowerCamelCase : str = "", lowerCamelCase : bool = False ): '''simple docstring''' # Mapping from the first character of the prefix of the node lowercase...
671
0
import argparse import torch from transformers import BlenderbotConfig, BlenderbotForConditionalGeneration from transformers.utils import logging logging.set_verbosity_info() A__ : Any = logging.get_logger(__name__) A__ : List[Any] = [ ["attention", "attn"], ["encoder...
704
import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import MgpstrTokenizer from transformers.models.mgp_str.tokenization_mgp_str import VOCAB_FILES_NAMES from transformers.testing_utils import require_torch, require_vision from transformers.uti...
671
0
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 ( MobileViTConfig, MobileViTForImageClassification, MobileViTForSemanticSegmentation, MobileViTImageProcessor, ) from tran...
705
def a ( lowerCamelCase_ , lowerCamelCase_ , lowerCamelCase_ ): '''simple docstring''' if exponent == 1: return base if exponent % 2 == 0: lowercase__ = _modexpt(lowerCamelCase_ , exponent // 2 , lowerCamelCase_ ) % modulo_value ...
671
0
from abc import ABC, abstractmethod from typing import List, Optional class _UpperCAmelCase ( __a ): """simple docstring""" def __init__( self : Dict ): '''simple docstring''' self.test() def lowercase__ ( self : Optional[Any] ): ...
706
import inspect from typing import Callable, List, Optional, Union import torch from transformers import ( CLIPImageProcessor, CLIPTextModel, CLIPTokenizer, WhisperForConditionalGeneration, WhisperProcessor, ) from diffusers import ( AutoencoderKL, DDIMScheduler, DiffusionPipelin...
671
0
import torch from diffusers import DPMSolverSDEScheduler from diffusers.utils import torch_device from diffusers.utils.testing_utils import require_torchsde from .test_schedulers import SchedulerCommonTest @require_torchsde class _UpperCAmelCase ( A__ ): """simple docstring""" lowercase_...
707
from __future__ import annotations from collections import deque from collections.abc import Iterator from dataclasses import dataclass @dataclass class _UpperCAmelCase : """simple docstring""" lowercase__ = 42 lowercase__ = 42 class _UpperCAmelCase ...
671
0
from ...configuration_utils import PretrainedConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices A__ : List[str] = logging.get_logger(__name__) A__ : int = { "shi-labs/nat-mini-in1k-224": "h...
708
class _UpperCAmelCase : """simple docstring""" def __init__( self : Optional[int], lowerCamelCase : Union[str, Any] ): '''simple docstring''' # we need a list not a string, so do something to change the type lowercase__ = arr.split('''...
671
0
import unittest import torch from diffusers import VQModel from diffusers.utils import floats_tensor, torch_device from diffusers.utils.testing_utils import enable_full_determinism from .test_modeling_common import ModelTesterMixin, UNetTesterMixin enable_full_determinism() class _UpperCAmelCase ( a...
709
from itertools import count def a ( lowerCamelCase_ = 50 ): '''simple docstring''' lowercase__ = [1] * min_block_length for n in count(lowerCamelCase_ ): fill_count_functions.append(1 ) for block_length in range(lowerCamelCase_ , ...
671
0
import unittest from transformers import AutoTokenizer, is_flax_available from transformers.testing_utils import require_flax, require_sentencepiece, require_tokenizers, slow if is_flax_available(): import jax.numpy as jnp from transformers import FlaxXLMRobertaModel @require_sentencepiece @require_t...
710
import copy from typing import Any, Dict, List, Optional, Union import numpy as np import torch from ...audio_utils import mel_filter_bank, spectrogram, window_function from ...feature_extraction_sequence_utils import SequenceFeatureExtractor from ...feature_extraction_utils import BatchFeature from ...utils i...
671
0
import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, BatchEncoding, PreTrainedTokenizer from ...utils import logging A__ : str = logging.get_logger(__name__) A__ : int ...
711
from __future__ import annotations from collections import deque from collections.abc import Sequence from dataclasses import dataclass from typing import Any @dataclass class _UpperCAmelCase : """simple docstring""" lowercase__ = 42 lowercase__ = None lowe...
671
0
import unittest import numpy as np from transformers import RobertaConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_modeling_flax_common import FlaxModelTesterMixin, floats_tensor, ids_tensor, random_attention_mask if is_flax_available(): from transformers....
712
from transformers import DistilBertTokenizer, DistilBertTokenizerFast from transformers.testing_utils import require_tokenizers, slow from ..bert.test_tokenization_bert import BertTokenizationTest @require_tokenizers class _UpperCAmelCase ( A__ ): """simple docstring""" lowercase__ ...
671
0
import argparse import os import platform import numpy as np import psutil import torch from accelerate import __version__ as version from accelerate.commands.config import default_config_file, load_config_from_file from ..utils import is_npu_available, is_xpu_available def a ( lowerCamelCase_...
713
from __future__ import annotations def a ( lowerCamelCase_ ): '''simple docstring''' lowercase__ = 0.00 lowercase__ = 0 for resistor in resistors: if resistor <= 0: lowercase__ = F"""Resistor at index {index} has a n...
671
0
import json import os from collections import Counter import torch import torchvision import torchvision.transforms as transforms from PIL import Image from torch import nn from torch.utils.data import Dataset A__ : Tuple = {1: (1, 1), 2: (2, 1), 3: (3, 1), 4: (2, 2), 5: (5, 1), 6: (3, 2), 7: ...
714
import argparse import re import requests import torch # git clone https://github.com/salesforce/BLIP.git from models.blip import blip_decoder from models.blip_itm import blip_itm from models.blip_vqa import blip_vqa from PIL import Image from torchvision import transforms from torchvision.transforms.functiona...
671
0
import os import unittest from transformers.models.transfo_xl.tokenization_transfo_xl import VOCAB_FILES_NAMES, TransfoXLTokenizer from ...test_tokenization_common import TokenizerTesterMixin class _UpperCAmelCase ( lowercase__ ,unittest.TestCase ): """simple docstring""" lowercase__ ...
715
import unittest import numpy as np 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(): impo...
671
0
from __future__ import absolute_import, division, print_function, unicode_literals from torch import nn from torch.nn import CrossEntropyLoss, MSELoss from transformers import RobertaConfig from transformers.file_utils import add_start_docstrings, add_start_docstrings_to_model_forward from transformers.models....
716
import argparse import os import re A__ : Optional[int] = 'src/transformers' # Pattern that looks at the indentation in a line. A__ : Union[str, Any] = re.compile(r'^(\s*)\S') # Pattern that matches `"key":" and puts `key` in group 0. A__ : List[str] = re.compil...
671
0
from __future__ import annotations import math def a ( lowerCamelCase_ , lowerCamelCase_ ): '''simple docstring''' if len(lowerCamelCase_ ) != 2 or len(a[0] ) != 2 or len(lowerCamelCase_ ) != 2 or len(b[0] ) != 2: raise Exception('''Mat...
717
from math import sqrt def a ( lowerCamelCase_ ): '''simple docstring''' assert isinstance(lowerCamelCase_ , lowerCamelCase_ ) and ( number >= 0 ), "'number' must been an int and positive" lowercase__ = True # 0 and 1 are none primes. ...
671
0
'''simple docstring''' A__ : Dict = { 'Pillow': 'Pillow<10.0.0', 'accelerate': 'accelerate>=0.20.3', 'av': 'av==9.2.0', 'beautifulsoup4': 'beautifulsoup4', 'black': 'black~=23.1', 'codecarbon': 'codecarbon==1.2.0', 'cookiecutter': 'cookiecutter==1.7.3', 'datac...
718
import argparse import re from typing import Dict import torch from datasets import Audio, Dataset, load_dataset, load_metric from transformers import AutoFeatureExtractor, pipeline def a ( lowerCamelCase_ , lowerCamelCase_ ): '''simple docstring''' lowercase__ =...
671
0
from datetime import datetime import matplotlib.pyplot as plt import torch def a ( lowerCamelCase_ ): '''simple docstring''' for param in module.parameters(): lowercase__ = False def a ( ): '''simple docstring''' l...
719
from functools import reduce A__ : Union[str, Any] = ( '73167176531330624919225119674426574742355349194934' '96983520312774506326239578318016984801869478851843' '85861560789112949495459501737958331952853208805511' '12540698747158523863050715693290963295227443043557' '66896648...
671
0
import unittest from transformers import AutoTokenizer, is_flax_available from transformers.testing_utils import require_flax, require_sentencepiece, require_tokenizers, slow if is_flax_available(): import jax.numpy as jnp from transformers import FlaxXLMRobertaModel @require_sentencepiece @req...
720
# DISCLAIMER: This file is strongly influenced by https://github.com/yang-song/score_sde_pytorch import math from dataclasses import dataclass from typing import Optional, Tuple, Union import torch from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput, randn_tensor f...
671
0
import os import jsonlines import numpy as np from tqdm import tqdm A__ : Dict = 20_48 A__ : Dict = 40_96 A__ : List[Any] = 42 A__ : List[str] = os.environ.pop('PROCESS_TRAIN', 'false') A__ : Optional[int] = {"nu...
721
from collections import defaultdict from math import gcd def a ( lowerCamelCase_ = 150_0000 ): '''simple docstring''' lowercase__ = defaultdict(lowerCamelCase_ ) lowercase__ = 2 while 2 * euclid_m * (euclid_m + 1) <= limit: for eucli...
671
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available A__ : int = { 'configuration_conditional_detr': [ 'CONDITIONAL_DETR_PRETRAINED_CONFIG_ARCHIVE_MAP', 'ConditionalDetrConfig', 'C...
700
import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_bert import BertTokenizer A__ : Dict = logging.get_logger(__name__) A__ : Dict =...
671
0
from PIL import Image def a ( lowerCamelCase_ , lowerCamelCase_ ): '''simple docstring''' def brightness(lowerCamelCase_ ) -> float: return 128 + level + (c - 128) if not -255.0 <= level <= 255.0: raise ValueError('''level must be between -255.0...
701
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) A__ : Any = {'configuration_unispeech': ['UNISPEECH_PRETRAINED_CONFIG_ARCHIVE_MAP', 'UniSpeechConfig']} try: ...
671
0
import unittest from transformers import MraConfig, 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, floats_tensor, ids_tensor, random_attention_mask if is_to...
702
import json import os import tempfile import transformers import datasets from utils import generate_example_dataset, get_duration A__ : Dict = 50_00_00 A__ , A__ : str = os.path.split(__file__) A__ : Optional[Any] = os.path.join(RESULTS_BASEPATH, 'res...
671
0
import sys from .dependency_versions_table import deps from .utils.versions import require_version, require_version_core # define which module versions we always want to check at run time # (usually the ones defined in `install_requires` in setup.py) # # order specific notes: # - tqdm must be checked before t...
703
class _UpperCAmelCase : """simple docstring""" def __init__( self : Optional[int], lowerCamelCase : str = "", lowerCamelCase : bool = False ): '''simple docstring''' # Mapping from the first character of the prefix of the node lowercase...
671
0
from __future__ import annotations from functools import lru_cache from math import ceil A__ : Any = 1_00 A__ : List[Any] = set(range(3, NUM_PRIMES, 2)) primes.add(2) A__ : Dict = 42 for prime in range(3, ceil(NUM_PRIMES**0.5), 2): if prime not in primes: ...
704
import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import MgpstrTokenizer from transformers.models.mgp_str.tokenization_mgp_str import VOCAB_FILES_NAMES from transformers.testing_utils import require_torch, require_vision from transformers.uti...
671
0
import json import multiprocessing import os import re from collections import defaultdict import torch from accelerate import Accelerator from accelerate.utils import set_seed from arguments import HumanEvalArguments from datasets import load_dataset, load_metric from torch.utils.data import IterableDataset fr...
705
def a ( lowerCamelCase_ , lowerCamelCase_ , lowerCamelCase_ ): '''simple docstring''' if exponent == 1: return base if exponent % 2 == 0: lowercase__ = _modexpt(lowerCamelCase_ , exponent // 2 , lowerCamelCase_ ) % modulo_value ...
671
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available A__ : int = { """configuration_pegasus_x""": ["""PEGASUS_X_PRETRAINED_CONFIG_ARCHIVE_MAP""", """PegasusXConfig"""], } try: if not is_torch_available(): r...
706
import inspect from typing import Callable, List, Optional, Union import torch from transformers import ( CLIPImageProcessor, CLIPTextModel, CLIPTokenizer, WhisperForConditionalGeneration, WhisperProcessor, ) from diffusers import ( AutoencoderKL, DDIMScheduler, DiffusionPipelin...
671
0
from sklearn.metrics import fa_score, matthews_corrcoef import datasets from .record_evaluation import evaluate as evaluate_record A__ : str = '\\n@article{wang2019superglue,\n title={SuperGLUE: A Stickier Benchmark for General-Purpose Language Understanding Systems},\n author={Wang, Alex a...
707
from __future__ import annotations from collections import deque from collections.abc import Iterator from dataclasses import dataclass @dataclass class _UpperCAmelCase : """simple docstring""" lowercase__ = 42 lowercase__ = 42 class _UpperCAmelCase ...
671
0