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
"""simple docstring""" from math import factorial def a__ ( SCREAMING_SNAKE_CASE : int = 1_0_0 ): '''simple docstring''' return sum(int(SCREAMING_SNAKE_CASE ) for x in str(factorial(SCREAMING_SNAKE_CASE ) ) ) if __name__ == "__main__": p...
681
"""simple docstring""" from typing import Any class SCREAMING_SNAKE_CASE__ : """simple docstring""" def __init__( self , snake_case__ ): """simple docstring""" lowerCAmelCase : Dict = data lowerCAmelCase : Any = None ...
681
1
"""simple docstring""" def a__ ( SCREAMING_SNAKE_CASE : list[int] ): '''simple docstring''' if not numbers: return 0 if not isinstance(SCREAMING_SNAKE_CASE , (list, tuple) ) or not all( isinstance(SCREAMING_SNAKE_CASE , SCREAMING_SNA...
681
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available, is_vision_available, ) lowerCAmelCase__ = { '''configuration_efficientformer''': [ '''EFFICIENTFORMER...
681
1
"""simple docstring""" import os # Precomputes a list of the 100 first triangular numbers lowerCAmelCase__ = [int(0.5 * n * (n + 1)) for n in range(1, 101)] def a__ ( ): '''simple docstring''' lowerCAmelCase : Optional[Any] = os.path.dirname(os.path.realpath...
681
"""simple docstring""" import argparse import csv import logging import os import random import numpy as np import torch from torch.utils.data import DataLoader, RandomSampler, SequentialSampler, TensorDataset from tqdm import tqdm, trange from transformers import ( CONFIG_NAME, WEIGHTS_NAME, Ad...
681
1
"""simple docstring""" import gc import random import unittest import numpy as np import torch from PIL import Image from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import AutoencoderKL, PNDMScheduler, StableDiffusionInpaintPipeline, UNetaDConditionModel from diffusers.u...
681
"""simple docstring""" from typing import List, Optional, Union from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCAmelCase__ = logging.get_logger(__name__) lowerCAmelCase__ = { '''huggingface/informer-tourism-monthly''': ( '''https...
681
1
"""simple docstring""" from typing import TYPE_CHECKING from ...file_utils import _LazyModule, is_torch_available from ...utils import OptionalDependencyNotAvailable lowerCAmelCase__ = { '''configuration_gpt_neox_japanese''': ['''GPT_NEOX_JAPANESE_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''GPTNe...
681
"""simple docstring""" def a__ ( SCREAMING_SNAKE_CASE : int ): '''simple docstring''' if num < 0: return False lowerCAmelCase : int = num lowerCAmelCase : int = 0 while num > 0: lowerCAmelCase : Dict = rev_num * 1_0 + (num ...
681
1
"""simple docstring""" import heapq def a__ ( SCREAMING_SNAKE_CASE : dict ): '''simple docstring''' lowerCAmelCase : list[list] = [] # for each node and his adjacency list add them and the rank of the node to queue # using heapq module the queue will be...
681
"""simple docstring""" import os import re import shutil import sys import tempfile import unittest import black lowerCAmelCase__ = os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))) sys.path.append(os.path.join(git_repo_path, '''utils''')) import check_copies # noq...
681
1
"""simple docstring""" from typing import Optional, Tuple, Union import flax import flax.linen as nn import jax import jax.numpy as jnp from flax.core.frozen_dict import FrozenDict from ..configuration_utils import ConfigMixin, flax_register_to_config from ..utils import BaseOutput from .embeddings_flax imp...
681
"""simple docstring""" import re from flax.core.frozen_dict import freeze from flax.traverse_util import flatten_dict, unflatten_dict from jax.experimental import PartitionSpec as P # Sentinels lowerCAmelCase__ = object() # For specifying empty leaf dict `{}` lowerCAmelCase__ = o...
681
1
"""simple docstring""" # DISCLAIMER: This file is strongly influenced by https://github.com/ermongroup/ddim from dataclasses import dataclass from typing import Optional, Tuple, Union import flax import jax import jax.numpy as jnp from ..configuration_utils import ConfigMixin, register_to_config from .sche...
681
"""simple docstring""" def a__ ( SCREAMING_SNAKE_CASE : int = 1_0 , SCREAMING_SNAKE_CASE : int = 2_2 ): '''simple docstring''' lowerCAmelCase : Dict = range(1 , SCREAMING_SNAKE_CASE ) lowerCAmelCase : List[str] = ran...
681
1
"""simple docstring""" 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_extracti...
681
"""simple docstring""" def a__ ( SCREAMING_SNAKE_CASE : List[str] ): '''simple docstring''' lowerCAmelCase : Optional[int] = len(SCREAMING_SNAKE_CASE ) while cur > 1: # Find the maximum number in arr lowerCAmelCase : List[str] = arr...
681
1
"""simple docstring""" from __future__ import annotations lowerCAmelCase__ = list[tuple[int, int]] lowerCAmelCase__ = [ [0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0], # 0 are free path whereas 1's are obstacles [0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0, 0], [1, 0...
681
"""simple docstring""" from ..utils import is_flax_available, is_torch_available if is_torch_available(): from .autoencoder_kl import AutoencoderKL from .controlnet import ControlNetModel from .dual_transformer_ad import DualTransformeraDModel from .modeling_utils import ModelMixin ...
681
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available lowerCAmelCase__ = { '''configuration_pegasus_x''': ['''PEGASUS_X_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''PegasusXConfig'''], } try: if not is_tor...
681
"""simple docstring""" import math def a__ ( SCREAMING_SNAKE_CASE : int ): '''simple docstring''' return math.sqrt(SCREAMING_SNAKE_CASE ) * math.sqrt(SCREAMING_SNAKE_CASE ) == num def a__ ( SCREAMING_SNAKE_CASE : int ): '''...
681
1
"""simple docstring""" from itertools import product from cva import COLOR_BGR2GRAY, cvtColor, imread, imshow, waitKey from numpy import dot, exp, mgrid, pi, ravel, square, uinta, zeros def a__ ( SCREAMING_SNAKE_CASE : Optional[int] , SCREAMING_SNAKE_CASE : str ):...
681
"""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 lowerCAmelCase__ = logging.get_logger(__name__) lowerCAmelCase__...
681
1
"""simple docstring""" lowerCAmelCase__ = [ (1_000, '''M'''), (900, '''CM'''), (500, '''D'''), (400, '''CD'''), (100, '''C'''), (90, '''XC'''), (50, '''L'''), (40, '''XL'''), (10, '''X'''), (9, '''IX'''), (5, '''V'''), (4, '''IV'''), (1, '''I'''...
681
"""simple docstring""" from .glue import glue_convert_examples_to_features, glue_output_modes, glue_processors, glue_tasks_num_labels from .squad import SquadExample, SquadFeatures, SquadVaProcessor, SquadVaProcessor, squad_convert_examples_to_features from .utils import DataProcessor, InputExample, InputFeat...
681
1
"""simple docstring""" from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, convert_to_rgb, get_resize_output_image_size, normalize, rescale, ...
681
"""simple docstring""" import copy import inspect import unittest from transformers import AutoBackbone from transformers.configuration_utils import PretrainedConfig from transformers.testing_utils import require_timm, require_torch, torch_device from transformers.utils.import_utils import is_torch_available...
681
1
"""simple docstring""" import gc import random import unittest import numpy as np import torch from PIL import Image from transformers import XLMRobertaTokenizerFast from diffusers import DDIMScheduler, KandinskyInpaintPipeline, KandinskyPriorPipeline, UNetaDConditionModel, VQModel from diffusers.pipelines....
681
"""simple docstring""" import argparse import os import re lowerCAmelCase__ = '''src/transformers''' # Pattern that looks at the indentation in a line. lowerCAmelCase__ = re.compile(r'''^(\s*)\S''') # Pattern that matches `"key":" and puts `key` in group 0. lowerCAmelCase__ ...
681
1
"""simple docstring""" import enum import warnings from .. import MODEL_FOR_CAUSAL_LM_MAPPING, TF_MODEL_FOR_CAUSAL_LM_MAPPING from ..utils import add_end_docstrings, is_tf_available from .base import PIPELINE_INIT_ARGS, Pipeline if is_tf_available(): import tensorflow as tf class SCREAMING_SNAKE_...
681
"""simple docstring""" from __future__ import annotations import inspect import unittest import numpy as np from transformers import ResNetConfig from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import cached_property, is_tf_available, is_vision_available fro...
681
1
"""simple docstring""" import unittest from transformers import AutoConfig, AutoTokenizer, BertConfig, TensorType, is_flax_available from transformers.testing_utils import DUMMY_UNKNOWN_IDENTIFIER, require_flax, slow if is_flax_available(): import jax from transformers.models.auto.modeling_flax_...
681
"""simple docstring""" import random from .binary_exp_mod import bin_exp_mod def a__ ( SCREAMING_SNAKE_CASE : Any , SCREAMING_SNAKE_CASE : int=1_0_0_0 ): '''simple docstring''' if n < 2: return False if n % 2 == 0: return n == 2 # this m...
681
1
"""simple docstring""" def a__ ( SCREAMING_SNAKE_CASE : Dict ): '''simple docstring''' lowerCAmelCase : List[str] = len(SCREAMING_SNAKE_CASE ) lowerCAmelCase : str = sum(SCREAMING_SNAKE_CASE ) lowerCAmelCase : List[str] = ...
681
"""simple docstring""" # DISCLAIMER: This file is strongly influenced by https://github.com/ermongroup/ddim from dataclasses import dataclass from typing import Optional, Tuple, Union import flax import jax import jax.numpy as jnp from ..configuration_utils import ConfigMixin, register_to_config from .sche...
681
1
"""simple docstring""" import unittest from transformers import BertGenerationTokenizer from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_torch, slow from transformers.utils import cached_property from ...test_tokenization_common import TokenizerTesterMixin lowerCAmelCas...
681
"""simple docstring""" import argparse import OmegaConf import torch from diffusers import DDIMScheduler, LDMPipeline, UNetLDMModel, VQModel def a__ ( SCREAMING_SNAKE_CASE : int , SCREAMING_SNAKE_CASE : Tuple , SCREAMING_SNAKE_CASE : Optional[int] ...
681
1
"""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/LICENS...
681
"""simple docstring""" def a__ ( SCREAMING_SNAKE_CASE : int = 1_0_0_0 ): '''simple docstring''' return sum(e for e in range(3 , SCREAMING_SNAKE_CASE ) if e % 3 == 0 or e % 5 == 0 ) if __name__ == "__main__": print(F"{solution() = }")
681
1
"""simple docstring""" import comet # From: unbabel-comet import torch import datasets lowerCAmelCase__ = datasets.logging.get_logger(__name__) lowerCAmelCase__ = '''\ @inproceedings{rei-EtAl:2020:WMT, author = {Rei, Ricardo and Stewart, Craig and Farinha, Ana C and ...
681
"""simple docstring""" import json import os import subprocess import unittest from ast import literal_eval import pytest from parameterized import parameterized, parameterized_class from . import is_sagemaker_available if is_sagemaker_available(): from sagemaker import Session, TrainingJobAnalytics ...
681
1
"""simple docstring""" from __future__ import annotations def a__ ( SCREAMING_SNAKE_CASE : list[int] , SCREAMING_SNAKE_CASE : int ): '''simple docstring''' if len(SCREAMING_SNAKE_CASE ) < k or k < 0: raise ValueError("Invalid Input" ) ...
681
"""simple docstring""" from math import factorial def a__ ( SCREAMING_SNAKE_CASE : int = 1_0_0 ): '''simple docstring''' return sum(int(SCREAMING_SNAKE_CASE ) for x in str(factorial(SCREAMING_SNAKE_CASE ) ) ) if __name__ == "__main__": p...
681
1
"""simple docstring""" from __future__ import annotations import math def a__ ( SCREAMING_SNAKE_CASE : int , SCREAMING_SNAKE_CASE : int , SCREAMING_SNAKE_CASE : bool , SCREAMING_SNAKE_CASE : list[int] , SCREAMING_SNAKE_CASE : ...
681
"""simple docstring""" from typing import Any class SCREAMING_SNAKE_CASE__ : """simple docstring""" def __init__( self , snake_case__ ): """simple docstring""" lowerCAmelCase : Dict = data lowerCAmelCase : Any = None ...
681
1
"""simple docstring""" def a__ ( SCREAMING_SNAKE_CASE : int = 1_0 , SCREAMING_SNAKE_CASE : int = 2_2 ): '''simple docstring''' lowerCAmelCase : Dict = range(1 , SCREAMING_SNAKE_CASE ) lowerCAmelCase : List[str] = ran...
681
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available, is_vision_available, ) lowerCAmelCase__ = { '''configuration_efficientformer''': [ '''EFFICIENTFORMER...
681
1
"""simple docstring""" from functools import reduce lowerCAmelCase__ = ( '''73167176531330624919225119674426574742355349194934''' '''96983520312774506326239578318016984801869478851843''' '''85861560789112949495459501737958331952853208805511''' '''125406987471585238630507156932909...
681
"""simple docstring""" import argparse import csv import logging import os import random import numpy as np import torch from torch.utils.data import DataLoader, RandomSampler, SequentialSampler, TensorDataset from tqdm import tqdm, trange from transformers import ( CONFIG_NAME, WEIGHTS_NAME, Ad...
681
1
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCAmelCase__ = logging.get_logger(__name__) lowerCAmelCase__ = { '''transfo-xl-wt103''': '''https://huggingface.co/transfo-xl-wt103/resolve/main/config.json''', } clas...
681
"""simple docstring""" from typing import List, Optional, Union from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCAmelCase__ = logging.get_logger(__name__) lowerCAmelCase__ = { '''huggingface/informer-tourism-monthly''': ( '''https...
681
1
"""simple docstring""" import argparse import hashlib # hashlib is only used inside the Test class import struct class SCREAMING_SNAKE_CASE__ : """simple docstring""" def __init__( self , snake_case__ ): """simple docstring""" lowerCAmelCase : Unio...
681
"""simple docstring""" def a__ ( SCREAMING_SNAKE_CASE : int ): '''simple docstring''' if num < 0: return False lowerCAmelCase : int = num lowerCAmelCase : int = 0 while num > 0: lowerCAmelCase : Dict = rev_num * 1_0 + (num ...
681
1
"""simple docstring""" import collections import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging lowerCAmelCase__ = logging.get_logger(__name__) lowerCAmelCase__ = ...
681
"""simple docstring""" import os import re import shutil import sys import tempfile import unittest import black lowerCAmelCase__ = os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))) sys.path.append(os.path.join(git_repo_path, '''utils''')) import check_copies # noq...
681
1
"""simple docstring""" import random from .binary_exp_mod import bin_exp_mod def a__ ( SCREAMING_SNAKE_CASE : Any , SCREAMING_SNAKE_CASE : int=1_0_0_0 ): '''simple docstring''' if n < 2: return False if n % 2 == 0: return n == 2 # this m...
681
"""simple docstring""" import re from flax.core.frozen_dict import freeze from flax.traverse_util import flatten_dict, unflatten_dict from jax.experimental import PartitionSpec as P # Sentinels lowerCAmelCase__ = object() # For specifying empty leaf dict `{}` lowerCAmelCase__ = o...
681
1
"""simple docstring""" import argparse import json import os import evaluate import torch from datasets import load_dataset from torch.optim import AdamW from torch.utils.data import DataLoader from transformers import AutoModelForSequenceClassification, AutoTokenizer, get_linear_schedule_with_warmup, set_se...
681
"""simple docstring""" def a__ ( SCREAMING_SNAKE_CASE : int = 1_0 , SCREAMING_SNAKE_CASE : int = 2_2 ): '''simple docstring''' lowerCAmelCase : Dict = range(1 , SCREAMING_SNAKE_CASE ) lowerCAmelCase : List[str] = ran...
681
1
"""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(): fr...
681
"""simple docstring""" def a__ ( SCREAMING_SNAKE_CASE : List[str] ): '''simple docstring''' lowerCAmelCase : Optional[int] = len(SCREAMING_SNAKE_CASE ) while cur > 1: # Find the maximum number in arr lowerCAmelCase : List[str] = arr...
681
1
"""simple docstring""" 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_dimens...
681
"""simple docstring""" from ..utils import is_flax_available, is_torch_available if is_torch_available(): from .autoencoder_kl import AutoencoderKL from .controlnet import ControlNetModel from .dual_transformer_ad import DualTransformeraDModel from .modeling_utils import ModelMixin ...
681
1
"""simple docstring""" import torch from transformers import PreTrainedModel, XLMRobertaConfig, XLMRobertaModel class SCREAMING_SNAKE_CASE__ ( lowercase ): """simple docstring""" a : Optional[int] ="M-CLIP" def __init__( self , snake_case__=1_024 , sn...
681
"""simple docstring""" import math def a__ ( SCREAMING_SNAKE_CASE : int ): '''simple docstring''' return math.sqrt(SCREAMING_SNAKE_CASE ) * math.sqrt(SCREAMING_SNAKE_CASE ) == num def a__ ( SCREAMING_SNAKE_CASE : int ): '''...
681
1
"""simple docstring""" import os def a__ ( SCREAMING_SNAKE_CASE : int ): '''simple docstring''' lowerCAmelCase : Union[str, Any] = len(grid[0] ) lowerCAmelCase : Optional[Any] = len(SCREAMING_SNAKE_CASE ) lowerCAmelCase : Union[s...
681
"""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 lowerCAmelCase__ = logging.get_logger(__name__) lowerCAmelCase__...
681
1
"""simple docstring""" import argparse import json import os import numpy as np import PIL import requests import tensorflow.keras.applications.efficientnet as efficientnet import torch from huggingface_hub import hf_hub_download from PIL import Image from tensorflow.keras.preprocessing import image from tr...
681
"""simple docstring""" from .glue import glue_convert_examples_to_features, glue_output_modes, glue_processors, glue_tasks_num_labels from .squad import SquadExample, SquadFeatures, SquadVaProcessor, SquadVaProcessor, squad_convert_examples_to_features from .utils import DataProcessor, InputExample, InputFeat...
681
1
"""simple docstring""" import PIL.Image import PIL.ImageOps from packaging import version from PIL import Image if version.parse(version.parse(PIL.__version__).base_version) >= version.parse('''9.1.0'''): lowerCAmelCase__ = { '''linear''': PIL.Image.Resampling.BILINEAR, '...
681
"""simple docstring""" import copy import inspect import unittest from transformers import AutoBackbone from transformers.configuration_utils import PretrainedConfig from transformers.testing_utils import require_timm, require_torch, torch_device from transformers.utils.import_utils import is_torch_available...
681
1
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCAmelCase__ = logging.get_logger(__name__) lowerCAmelCase__ = { '''microsoft/markuplm-base''': '''https://huggingface.co/microsoft/markuplm-base/resolve/main/config.jso...
681
"""simple docstring""" import argparse import os import re lowerCAmelCase__ = '''src/transformers''' # Pattern that looks at the indentation in a line. lowerCAmelCase__ = re.compile(r'''^(\s*)\S''') # Pattern that matches `"key":" and puts `key` in group 0. lowerCAmelCase__ ...
681
1
"""simple docstring""" import math def a__ ( SCREAMING_SNAKE_CASE : Optional[int] , SCREAMING_SNAKE_CASE : List[Any] ): '''simple docstring''' if 0 not in (x, y): # We use the relation x^y = y*log10(x), where 10 is the base. return y * math.log...
681
"""simple docstring""" from __future__ import annotations import inspect import unittest import numpy as np from transformers import ResNetConfig from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import cached_property, is_tf_available, is_vision_available fro...
681
1
"""simple docstring""" 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 if TYPE_CHECKING: from tran...
681
"""simple docstring""" import random from .binary_exp_mod import bin_exp_mod def a__ ( SCREAMING_SNAKE_CASE : Any , SCREAMING_SNAKE_CASE : int=1_0_0_0 ): '''simple docstring''' if n < 2: return False if n % 2 == 0: return n == 2 # this m...
681
1
"""simple docstring""" from ..utils import DummyObject, requires_backends class SCREAMING_SNAKE_CASE__ ( metaclass=lowercase ): """simple docstring""" a : List[str] =["torch", "scipy"] def __init__( self , *snake_case__ , **snake_case__ ): ...
681
"""simple docstring""" # DISCLAIMER: This file is strongly influenced by https://github.com/ermongroup/ddim from dataclasses import dataclass from typing import Optional, Tuple, Union import flax import jax import jax.numpy as jnp from ..configuration_utils import ConfigMixin, register_to_config from .sche...
681
1
"""simple docstring""" import inspect import unittest import numpy as np from tests.test_modeling_common import floats_tensor from transformers import MaskaFormerConfig, is_torch_available, is_vision_available from transformers.testing_utils import require_torch, require_torch_multi_gpu, require_vision, slo...
681
"""simple docstring""" import argparse import OmegaConf import torch from diffusers import DDIMScheduler, LDMPipeline, UNetLDMModel, VQModel def a__ ( SCREAMING_SNAKE_CASE : int , SCREAMING_SNAKE_CASE : Tuple , SCREAMING_SNAKE_CASE : Optional[int] ...
681
1
"""simple docstring""" from pickle import UnpicklingError import jax import jax.numpy as jnp import numpy as np from flax.serialization import from_bytes from flax.traverse_util import flatten_dict from ..utils import logging lowerCAmelCase__ = logging.get_logger(__name__) def a__ ( ...
681
"""simple docstring""" def a__ ( SCREAMING_SNAKE_CASE : int = 1_0_0_0 ): '''simple docstring''' return sum(e for e in range(3 , SCREAMING_SNAKE_CASE ) if e % 3 == 0 or e % 5 == 0 ) if __name__ == "__main__": print(F"{solution() = }")
681
1
"""simple docstring""" import shutil import tempfile import unittest import numpy as np import pytest from transformers.testing_utils import require_vision from transformers.utils import is_vision_available if is_vision_available(): from PIL import Image from transformers import AutoProcessor, ...
681
"""simple docstring""" import json import os import subprocess import unittest from ast import literal_eval import pytest from parameterized import parameterized, parameterized_class from . import is_sagemaker_available if is_sagemaker_available(): from sagemaker import Session, TrainingJobAnalytics ...
681
1
"""simple docstring""" import os import re import warnings from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiece_available(): from .tokenization_ta...
681
"""simple docstring""" from math import factorial def a__ ( SCREAMING_SNAKE_CASE : int = 1_0_0 ): '''simple docstring''' return sum(int(SCREAMING_SNAKE_CASE ) for x in str(factorial(SCREAMING_SNAKE_CASE ) ) ) if __name__ == "__main__": p...
681
1
"""simple docstring""" import os import tempfile import unittest import uuid from pathlib import Path from transformers.testing_utils import get_tests_dir, require_soundfile, require_torch, require_vision from transformers.tools.agent_types import AgentAudio, AgentImage, AgentText from transformers.utils imp...
681
"""simple docstring""" from typing import Any class SCREAMING_SNAKE_CASE__ : """simple docstring""" def __init__( self , snake_case__ ): """simple docstring""" lowerCAmelCase : Dict = data lowerCAmelCase : Any = None ...
681
1
"""simple docstring""" from ....configuration_utils import PretrainedConfig from ....utils import logging lowerCAmelCase__ = logging.get_logger(__name__) lowerCAmelCase__ = { '''Visual-Attention-Network/van-base''': ( '''https://huggingface.co/Visual-Attention-Network/...
681
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available, is_vision_available, ) lowerCAmelCase__ = { '''configuration_efficientformer''': [ '''EFFICIENTFORMER...
681
1
"""simple docstring""" import logging import os from typing import Dict, List, Optional, Union import torch import torch.nn as nn from accelerate.utils.imports import ( is_abit_bnb_available, is_abit_bnb_available, is_bnb_available, ) from ..big_modeling import dispatch_model, init_empty_weight...
681
"""simple docstring""" import argparse import csv import logging import os import random import numpy as np import torch from torch.utils.data import DataLoader, RandomSampler, SequentialSampler, TensorDataset from tqdm import tqdm, trange from transformers import ( CONFIG_NAME, WEIGHTS_NAME, Ad...
681
1
"""simple docstring""" import pytest import requests from datasets.utils.file_utils import http_head from .utils import OfflineSimulationMode, RequestWouldHangIndefinitelyError, offline @pytest.mark.integration def a__ ( ): '''simple docstring''' with offline(OfflineSimulationMod...
681
"""simple docstring""" from typing import List, Optional, Union from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCAmelCase__ = logging.get_logger(__name__) lowerCAmelCase__ = { '''huggingface/informer-tourism-monthly''': ( '''https...
681
1
"""simple docstring""" import warnings from ...utils import logging from .image_processing_deit import DeiTImageProcessor lowerCAmelCase__ = logging.get_logger(__name__) class SCREAMING_SNAKE_CASE__ ( lowercase ): """simple docstring""" def __init__( self , *...
681
"""simple docstring""" def a__ ( SCREAMING_SNAKE_CASE : int ): '''simple docstring''' if num < 0: return False lowerCAmelCase : int = num lowerCAmelCase : int = 0 while num > 0: lowerCAmelCase : Dict = rev_num * 1_0 + (num ...
681
1
"""simple docstring""" # 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...
681
"""simple docstring""" import os import re import shutil import sys import tempfile import unittest import black lowerCAmelCase__ = os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))) sys.path.append(os.path.join(git_repo_path, '''utils''')) import check_copies # noq...
681
1
"""simple docstring""" from __future__ import annotations def a__ ( SCREAMING_SNAKE_CASE : list[int] , SCREAMING_SNAKE_CASE : int ): '''simple docstring''' lowerCAmelCase : str = 0 lowerCAmelCase : Any = len(SCREAMING_SNAKE_CASE ...
681
"""simple docstring""" import re from flax.core.frozen_dict import freeze from flax.traverse_util import flatten_dict, unflatten_dict from jax.experimental import PartitionSpec as P # Sentinels lowerCAmelCase__ = object() # For specifying empty leaf dict `{}` lowerCAmelCase__ = o...
681
1
"""simple docstring""" import os import re import shutil import sys import tempfile import unittest import black lowerCAmelCase__ = os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))) sys.path.append(os.path.join(git_repo_path, '''utils''')) import check_copies # noq...
681
"""simple docstring""" def a__ ( SCREAMING_SNAKE_CASE : int = 1_0 , SCREAMING_SNAKE_CASE : int = 2_2 ): '''simple docstring''' lowerCAmelCase : Dict = range(1 , SCREAMING_SNAKE_CASE ) lowerCAmelCase : List[str] = ran...
681
1
"""simple docstring""" import argparse import json from typing import List from ltp import LTP from transformers.models.bert.tokenization_bert import BertTokenizer def a__ ( SCREAMING_SNAKE_CASE : Union[str, Any] ): '''simple docstring''' if ( (cp >= 0x4_E_0_0...
681
"""simple docstring""" def a__ ( SCREAMING_SNAKE_CASE : List[str] ): '''simple docstring''' lowerCAmelCase : Optional[int] = len(SCREAMING_SNAKE_CASE ) while cur > 1: # Find the maximum number in arr lowerCAmelCase : List[str] = arr...
681
1
"""simple docstring""" import copy import random from transformers import CLIPTokenizer class SCREAMING_SNAKE_CASE__ ( lowercase ): """simple docstring""" def __init__( self , *snake_case__ , **snake_case__ ): """simple docstring""" super().__...
681
"""simple docstring""" from ..utils import is_flax_available, is_torch_available if is_torch_available(): from .autoencoder_kl import AutoencoderKL from .controlnet import ControlNetModel from .dual_transformer_ad import DualTransformeraDModel from .modeling_utils import ModelMixin ...
681
1
"""simple docstring""" from __future__ import annotations def a__ ( SCREAMING_SNAKE_CASE : tuple[int, int] , SCREAMING_SNAKE_CASE : int ): '''simple docstring''' lowerCAmelCase , lowerCAmelCase : List[Any] = position lowerCAmelCase :...
681
"""simple docstring""" import math def a__ ( SCREAMING_SNAKE_CASE : int ): '''simple docstring''' return math.sqrt(SCREAMING_SNAKE_CASE ) * math.sqrt(SCREAMING_SNAKE_CASE ) == num def a__ ( SCREAMING_SNAKE_CASE : int ): '''...
681
1
"""simple docstring""" import json import os import sys import tempfile import unittest from pathlib import Path from shutil import copyfile from huggingface_hub import HfFolder, Repository, create_repo, delete_repo from requests.exceptions import HTTPError import transformers from transformers import ( ...
681
"""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 lowerCAmelCase__ = logging.get_logger(__name__) lowerCAmelCase__...
681
1
"""simple docstring""" import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, XLMRobertaTokenizer from diffusers import AltDiffusionPipeline, AutoencoderKL, DDIMScheduler, PNDMScheduler, UNetaDConditionModel from diffusers.pipelines.alt_diffusion.mo...
681
"""simple docstring""" from .glue import glue_convert_examples_to_features, glue_output_modes, glue_processors, glue_tasks_num_labels from .squad import SquadExample, SquadFeatures, SquadVaProcessor, SquadVaProcessor, squad_convert_examples_to_features from .utils import DataProcessor, InputExample, InputFeat...
681
1
"""simple docstring""" from ...configuration_utils import PretrainedConfig lowerCAmelCase__ = { '''google/tapas-base-finetuned-sqa''': ( '''https://huggingface.co/google/tapas-base-finetuned-sqa/resolve/main/config.json''' ), '''google/tapas-base-finetuned-wtq''': ( ...
681
"""simple docstring""" import copy import inspect import unittest from transformers import AutoBackbone from transformers.configuration_utils import PretrainedConfig from transformers.testing_utils import require_timm, require_torch, torch_device from transformers.utils.import_utils import is_torch_available...
681
1
"""simple docstring""" import warnings from typing import List import numpy as np from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding from ...utils import is_flax_available, is_tf_available, is_torch_available class SCREAMING_SNAKE_CASE__ ( lowercas...
681
"""simple docstring""" import argparse import os import re lowerCAmelCase__ = '''src/transformers''' # Pattern that looks at the indentation in a line. lowerCAmelCase__ = re.compile(r'''^(\s*)\S''') # Pattern that matches `"key":" and puts `key` in group 0. lowerCAmelCase__ ...
681
1
"""simple docstring""" lowerCAmelCase__ = ''' # Transformers 설치 방법 ! pip install transformers datasets # 마지막 릴리스 대신 소스에서 설치하려면, 위 명령을 주석으로 바꾸고 아래 명령을 해제하세요. # ! pip install git+https://github.com/huggingface/transformers.git ''' lowerCAmelCase__ = [{'''type''': '''code''', '''conten...
681
"""simple docstring""" from __future__ import annotations import inspect import unittest import numpy as np from transformers import ResNetConfig from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import cached_property, is_tf_available, is_vision_available fro...
681
1
"""simple docstring""" from typing import Optional from torch import nn from .transformer_ad import TransformeraDModel, TransformeraDModelOutput class SCREAMING_SNAKE_CASE__ ( nn.Module ): """simple docstring""" def __init__( self , snake_case__ = 16 , snake_case__ = 88 ,...
681
"""simple docstring""" import random from .binary_exp_mod import bin_exp_mod def a__ ( SCREAMING_SNAKE_CASE : Any , SCREAMING_SNAKE_CASE : int=1_0_0_0 ): '''simple docstring''' if n < 2: return False if n % 2 == 0: return n == 2 # this m...
681
1
"""simple docstring""" from __future__ import annotations import numpy as np from numpy import floataa from numpy.typing import NDArray def a__ ( SCREAMING_SNAKE_CASE : NDArray[floataa] , SCREAMING_SNAKE_CASE : NDArray[floataa] , SCREAMING_SNAKE_CASE : l...
681
"""simple docstring""" # DISCLAIMER: This file is strongly influenced by https://github.com/ermongroup/ddim from dataclasses import dataclass from typing import Optional, Tuple, Union import flax import jax import jax.numpy as jnp from ..configuration_utils import ConfigMixin, register_to_config from .sche...
681
1
"""simple docstring""" from __future__ import annotations import unittest from transformers import is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import ...
681
"""simple docstring""" import argparse import OmegaConf import torch from diffusers import DDIMScheduler, LDMPipeline, UNetLDMModel, VQModel def a__ ( SCREAMING_SNAKE_CASE : int , SCREAMING_SNAKE_CASE : Tuple , SCREAMING_SNAKE_CASE : Optional[int] ...
681
1
"""simple docstring""" from dataclasses import dataclass from typing import Optional, Tuple, Union import flax import jax.numpy as jnp from jax import random from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput from .scheduling_utils_flax import FlaxSchedulerMixin...
681
"""simple docstring""" def a__ ( SCREAMING_SNAKE_CASE : int = 1_0_0_0 ): '''simple docstring''' return sum(e for e in range(3 , SCREAMING_SNAKE_CASE ) if e % 3 == 0 or e % 5 == 0 ) if __name__ == "__main__": print(F"{solution() = }")
681
1
"""simple docstring""" import argparse import json import torch from diffusers import DDPMScheduler, LDMPipeline, UNetaDModel, VQModel def a__ ( SCREAMING_SNAKE_CASE : Optional[int] , SCREAMING_SNAKE_CASE : List[str]=1 ): '''simple docstring''' if n_...
681
"""simple docstring""" import json import os import subprocess import unittest from ast import literal_eval import pytest from parameterized import parameterized, parameterized_class from . import is_sagemaker_available if is_sagemaker_available(): from sagemaker import Session, TrainingJobAnalytics ...
681
1
"""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(): fr...
681
"""simple docstring""" from math import factorial def a__ ( SCREAMING_SNAKE_CASE : int = 1_0_0 ): '''simple docstring''' return sum(int(SCREAMING_SNAKE_CASE ) for x in str(factorial(SCREAMING_SNAKE_CASE ) ) ) if __name__ == "__main__": p...
681
1
"""simple docstring""" from torch import nn class SCREAMING_SNAKE_CASE__ ( nn.Module ): """simple docstring""" def __init__( self , snake_case__ , snake_case__ ): """simple docstring""" super().__init__() lowerCAmelCase : str = ...
681
"""simple docstring""" from typing import Any class SCREAMING_SNAKE_CASE__ : """simple docstring""" def __init__( self , snake_case__ ): """simple docstring""" lowerCAmelCase : Dict = data lowerCAmelCase : Any = None ...
681
1
"""simple docstring""" def a__ ( SCREAMING_SNAKE_CASE : int ): '''simple docstring''' if num < 0: return False lowerCAmelCase : int = num lowerCAmelCase : int = 0 while num > 0: lowerCAmelCase : Dict = rev_num * 1_0 + (num ...
681
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available, is_vision_available, ) lowerCAmelCase__ = { '''configuration_efficientformer''': [ '''EFFICIENTFORMER...
681
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available lowerCAmelCase__ = { '''configuration_tapas''': ['''TAPAS_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''TapasConfig'''], '''tokenization_...
681
"""simple docstring""" import argparse import csv import logging import os import random import numpy as np import torch from torch.utils.data import DataLoader, RandomSampler, SequentialSampler, TensorDataset from tqdm import tqdm, trange from transformers import ( CONFIG_NAME, WEIGHTS_NAME, Ad...
681
1
"""simple docstring""" import unittest from transformers.testing_utils import require_bsa from transformers.utils import is_bsa_available from ...test_feature_extraction_common import FeatureExtractionSavingTestMixin if is_bsa_available(): from transformers import MarkupLMFeatureExtractor class ...
681
"""simple docstring""" from typing import List, Optional, Union from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCAmelCase__ = logging.get_logger(__name__) lowerCAmelCase__ = { '''huggingface/informer-tourism-monthly''': ( '''https...
681
1
"""simple docstring""" import argparse import torch from transformers import BertConfig, BertForPreTraining, load_tf_weights_in_bert from transformers.utils import logging logging.set_verbosity_info() def a__ ( SCREAMING_SNAKE_CASE : Dict , SCREAMING_SNAKE_CASE : Lis...
681
"""simple docstring""" def a__ ( SCREAMING_SNAKE_CASE : int ): '''simple docstring''' if num < 0: return False lowerCAmelCase : int = num lowerCAmelCase : int = 0 while num > 0: lowerCAmelCase : Dict = rev_num * 1_0 + (num ...
681
1
"""simple docstring""" from abc import ABC, abstractmethod from argparse import ArgumentParser class SCREAMING_SNAKE_CASE__ ( lowercase ): """simple docstring""" @staticmethod @abstractmethod def lowercase__ ( snake_case__ ): """simple doc...
681
"""simple docstring""" import os import re import shutil import sys import tempfile import unittest import black lowerCAmelCase__ = os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))) sys.path.append(os.path.join(git_repo_path, '''utils''')) import check_copies # noq...
681
1
"""simple docstring""" import argparse from tax import checkpoints from transformers import AutoConfig, FlaxAutoModelForSeqaSeqLM def a__ ( SCREAMING_SNAKE_CASE : List[Any] , SCREAMING_SNAKE_CASE : str , SCREAMING_SNAKE_CASE : Dict ): '''simpl...
681
"""simple docstring""" import re from flax.core.frozen_dict import freeze from flax.traverse_util import flatten_dict, unflatten_dict from jax.experimental import PartitionSpec as P # Sentinels lowerCAmelCase__ = object() # For specifying empty leaf dict `{}` lowerCAmelCase__ = o...
681
1
"""simple docstring""" 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 if is_torch_available(): im...
681
"""simple docstring""" def a__ ( SCREAMING_SNAKE_CASE : int = 1_0 , SCREAMING_SNAKE_CASE : int = 2_2 ): '''simple docstring''' lowerCAmelCase : Dict = range(1 , SCREAMING_SNAKE_CASE ) lowerCAmelCase : List[str] = ran...
681
1
"""simple docstring""" import inspect import unittest import warnings from transformers import DeiTConfig from transformers.models.auto import get_values from transformers.testing_utils import ( require_accelerate, require_torch, require_torch_gpu, require_vision, slow, torch_device, ...
681
"""simple docstring""" def a__ ( SCREAMING_SNAKE_CASE : List[str] ): '''simple docstring''' lowerCAmelCase : Optional[int] = len(SCREAMING_SNAKE_CASE ) while cur > 1: # Find the maximum number in arr lowerCAmelCase : List[str] = arr...
681
1
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCAmelCase__ = logging.get_logger(__name__) lowerCAmelCase__ = { '''studio-ousia/luke-base''': '''https://huggingface.co/studio-ousia/luke-base/resolve/main/config.json'...
681
"""simple docstring""" from ..utils import is_flax_available, is_torch_available if is_torch_available(): from .autoencoder_kl import AutoencoderKL from .controlnet import ControlNetModel from .dual_transformer_ad import DualTransformeraDModel from .modeling_utils import ModelMixin ...
681
1
"""simple docstring""" import logging import math import os from dataclasses import dataclass, field from glob import glob from typing import Optional from torch.utils.data import ConcatDataset import transformers from transformers import ( CONFIG_MAPPING, MODEL_WITH_LM_HEAD_MAPPING, AutoConfig,...
681
"""simple docstring""" import math def a__ ( SCREAMING_SNAKE_CASE : int ): '''simple docstring''' return math.sqrt(SCREAMING_SNAKE_CASE ) * math.sqrt(SCREAMING_SNAKE_CASE ) == num def a__ ( SCREAMING_SNAKE_CASE : int ): '''...
681
1
"""simple docstring""" import absl # noqa: F401 # Here to have a nice missing dependency error message early on import nltk # noqa: F401 # Here to have a nice missing dependency error message early on import numpy # noqa: F401 # Here to have a nice missing dependency error message early on import six # no...
681
"""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 lowerCAmelCase__ = logging.get_logger(__name__) lowerCAmelCase__...
681
1
"""simple docstring""" def a__ ( SCREAMING_SNAKE_CASE : Optional[int] , SCREAMING_SNAKE_CASE : Optional[int] ): '''simple docstring''' lowerCAmelCase : Optional[Any] = 0 lowerCAmelCase : Optional[Any] = len(SCREAMING_SNAKE_CASE ...
681
"""simple docstring""" from .glue import glue_convert_examples_to_features, glue_output_modes, glue_processors, glue_tasks_num_labels from .squad import SquadExample, SquadFeatures, SquadVaProcessor, SquadVaProcessor, squad_convert_examples_to_features from .utils import DataProcessor, InputExample, InputFeat...
681
1
"""simple docstring""" from math import ceil def a__ ( SCREAMING_SNAKE_CASE : int = 1_0_0_1 ): '''simple docstring''' lowerCAmelCase : int = 1 for i in range(1 , int(ceil(n / 2.0 ) ) ): lowerCAmelCase : Optional[int] = ...
681
"""simple docstring""" import copy import inspect import unittest from transformers import AutoBackbone from transformers.configuration_utils import PretrainedConfig from transformers.testing_utils import require_timm, require_torch, torch_device from transformers.utils.import_utils import is_torch_available...
681
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available, is_vision_available, ) lowerCAmelCase__ = { '''configuration_efficientformer''': [ '''EFFICIENTFORMER...
681
"""simple docstring""" import argparse import os import re lowerCAmelCase__ = '''src/transformers''' # Pattern that looks at the indentation in a line. lowerCAmelCase__ = re.compile(r'''^(\s*)\S''') # Pattern that matches `"key":" and puts `key` in group 0. lowerCAmelCase__ ...
681
1
"""simple docstring""" 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, Dist...
681
"""simple docstring""" from __future__ import annotations import inspect import unittest import numpy as np from transformers import ResNetConfig from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import cached_property, is_tf_available, is_vision_available fro...
681
1
"""simple docstring""" import argparse import os from . import ( ALBERT_PRETRAINED_CONFIG_ARCHIVE_MAP, BART_PRETRAINED_MODEL_ARCHIVE_LIST, BERT_PRETRAINED_CONFIG_ARCHIVE_MAP, CAMEMBERT_PRETRAINED_CONFIG_ARCHIVE_MAP, CTRL_PRETRAINED_CONFIG_ARCHIVE_MAP, DISTILBERT_PRETRAINED_CONFIG_ARCH...
681
"""simple docstring""" import random from .binary_exp_mod import bin_exp_mod def a__ ( SCREAMING_SNAKE_CASE : Any , SCREAMING_SNAKE_CASE : int=1_0_0_0 ): '''simple docstring''' if n < 2: return False if n % 2 == 0: return n == 2 # this m...
681
1
"""simple docstring""" import logging from dataclasses import dataclass, field from typing import Optional from seqaseq_trainer import arg_to_scheduler from transformers import TrainingArguments lowerCAmelCase__ = logging.getLogger(__name__) @dataclass class SCREAMING_SNAKE_CASE__ ...
681
"""simple docstring""" # DISCLAIMER: This file is strongly influenced by https://github.com/ermongroup/ddim from dataclasses import dataclass from typing import Optional, Tuple, Union import flax import jax import jax.numpy as jnp from ..configuration_utils import ConfigMixin, register_to_config from .sche...
681
1
"""simple docstring""" from .glue import glue_convert_examples_to_features, glue_output_modes, glue_processors, glue_tasks_num_labels from .squad import SquadExample, SquadFeatures, SquadVaProcessor, SquadVaProcessor, squad_convert_examples_to_features from .utils import DataProcessor, InputExample, InputFeat...
681
"""simple docstring""" import argparse import OmegaConf import torch from diffusers import DDIMScheduler, LDMPipeline, UNetLDMModel, VQModel def a__ ( SCREAMING_SNAKE_CASE : int , SCREAMING_SNAKE_CASE : Tuple , SCREAMING_SNAKE_CASE : Optional[int] ...
681
1
"""simple docstring""" from __future__ import annotations import string from itertools import cycle, product from pathlib import Path lowerCAmelCase__ = ( string.ascii_letters + string.digits + string.punctuation + string.whitespace ) lowerCAmelCase__ = [ord(letter) for letter ...
681
"""simple docstring""" def a__ ( SCREAMING_SNAKE_CASE : int = 1_0_0_0 ): '''simple docstring''' return sum(e for e in range(3 , SCREAMING_SNAKE_CASE ) if e % 3 == 0 or e % 5 == 0 ) if __name__ == "__main__": print(F"{solution() = }")
681
1
"""simple docstring""" import argparse import pickle import numpy as np import torch from torch import nn from transformers import ReformerConfig, ReformerModelWithLMHead from transformers.utils import logging logging.set_verbosity_info() def a__ ( SCREAMING_SNAKE_CASE : List[Any] ...
681
"""simple docstring""" import json import os import subprocess import unittest from ast import literal_eval import pytest from parameterized import parameterized, parameterized_class from . import is_sagemaker_available if is_sagemaker_available(): from sagemaker import Session, TrainingJobAnalytics ...
681
1
"""simple docstring""" import importlib import inspect import os import re # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_config_docstrings.py lowerCAmelCase__ = '''src/transformers''' # This is to make sure the t...
681
"""simple docstring""" from math import factorial def a__ ( SCREAMING_SNAKE_CASE : int = 1_0_0 ): '''simple docstring''' return sum(int(SCREAMING_SNAKE_CASE ) for x in str(factorial(SCREAMING_SNAKE_CASE ) ) ) if __name__ == "__main__": p...
681
1
"""simple docstring""" import math def a__ ( SCREAMING_SNAKE_CASE : int ): '''simple docstring''' return math.sqrt(SCREAMING_SNAKE_CASE ) * math.sqrt(SCREAMING_SNAKE_CASE ) == num def a__ ( SCREAMING_SNAKE_CASE : int ): '''...
681
"""simple docstring""" from typing import Any class SCREAMING_SNAKE_CASE__ : """simple docstring""" def __init__( self , snake_case__ ): """simple docstring""" lowerCAmelCase : Dict = data lowerCAmelCase : Any = None ...
681
1
"""simple docstring""" from collections import OrderedDict from typing import TYPE_CHECKING, Any, List, Mapping, Optional from packaging import version if TYPE_CHECKING: from ... import PreTrainedTokenizer, TensorType from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfigW...
681
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available, is_vision_available, ) lowerCAmelCase__ = { '''configuration_efficientformer''': [ '''EFFICIENTFORMER...
681
1
"""simple docstring""" from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import convert_to_rgb, normalize, rescale, resize, to_channel_dimension_format from ...image_utils import ( ...
681
"""simple docstring""" import argparse import csv import logging import os import random import numpy as np import torch from torch.utils.data import DataLoader, RandomSampler, SequentialSampler, TensorDataset from tqdm import tqdm, trange from transformers import ( CONFIG_NAME, WEIGHTS_NAME, Ad...
681
1
"""simple docstring""" import gc import random import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTextModelWithProjection, CLIPTokenizer from diffusers import ( AutoencoderKL, DiffusionPipeline, EulerDiscreteScheduler, StableDiffusionX...
681
"""simple docstring""" from typing import List, Optional, Union from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCAmelCase__ = logging.get_logger(__name__) lowerCAmelCase__ = { '''huggingface/informer-tourism-monthly''': ( '''https...
681
1
"""simple docstring""" def a__ ( SCREAMING_SNAKE_CASE : List[str] ): '''simple docstring''' lowerCAmelCase : Optional[int] = len(SCREAMING_SNAKE_CASE ) while cur > 1: # Find the maximum number in arr lowerCAmelCase : List[str] = arr...
681
"""simple docstring""" def a__ ( SCREAMING_SNAKE_CASE : int ): '''simple docstring''' if num < 0: return False lowerCAmelCase : int = num lowerCAmelCase : int = 0 while num > 0: lowerCAmelCase : Dict = rev_num * 1_0 + (num ...
681
1
"""simple docstring""" from collections import defaultdict from pathlib import Path import pandas as pd from rouge_cli import calculate_rouge_path from utils import calculate_rouge lowerCAmelCase__ = [ '''Prosecutor: "No videos were used in the crash investigation" German papers say they ...
681
"""simple docstring""" import os import re import shutil import sys import tempfile import unittest import black lowerCAmelCase__ = os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))) sys.path.append(os.path.join(git_repo_path, '''utils''')) import check_copies # noq...
681
1
"""simple docstring""" def a__ ( SCREAMING_SNAKE_CASE : 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()...
681
"""simple docstring""" import re from flax.core.frozen_dict import freeze from flax.traverse_util import flatten_dict, unflatten_dict from jax.experimental import PartitionSpec as P # Sentinels lowerCAmelCase__ = object() # For specifying empty leaf dict `{}` lowerCAmelCase__ = o...
681
1
"""simple docstring""" import cmath import math def a__ ( SCREAMING_SNAKE_CASE : float , SCREAMING_SNAKE_CASE : float , SCREAMING_SNAKE_CASE : float , SCREAMING_SNAKE_CASE : float ): '''simple docstring''' lowerCAmelCase...
681
"""simple docstring""" def a__ ( SCREAMING_SNAKE_CASE : int = 1_0 , SCREAMING_SNAKE_CASE : int = 2_2 ): '''simple docstring''' lowerCAmelCase : Dict = range(1 , SCREAMING_SNAKE_CASE ) lowerCAmelCase : List[str] = ran...
681
1
"""simple docstring""" import re import string from collections import Counter import sacrebleu import sacremoses from packaging import version import datasets lowerCAmelCase__ = ''' @inproceedings{xu-etal-2016-optimizing, title = {Optimizing Statistical Machine Translation for Text Simpl...
681
"""simple docstring""" def a__ ( SCREAMING_SNAKE_CASE : List[str] ): '''simple docstring''' lowerCAmelCase : Optional[int] = len(SCREAMING_SNAKE_CASE ) while cur > 1: # Find the maximum number in arr lowerCAmelCase : List[str] = arr...
681
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, TensorFlowB...
681
"""simple docstring""" from ..utils import is_flax_available, is_torch_available if is_torch_available(): from .autoencoder_kl import AutoencoderKL from .controlnet import ControlNetModel from .dual_transformer_ad import DualTransformeraDModel from .modeling_utils import ModelMixin ...
681
1
"""simple docstring""" def a__ ( SCREAMING_SNAKE_CASE : List[str] ): '''simple docstring''' lowerCAmelCase : Union[str, Any] = [0] * len(SCREAMING_SNAKE_CASE ) lowerCAmelCase : Any = [] lowerCAmelCase : Tuple = [1] * len(SCREAMI...
681
"""simple docstring""" import math def a__ ( SCREAMING_SNAKE_CASE : int ): '''simple docstring''' return math.sqrt(SCREAMING_SNAKE_CASE ) * math.sqrt(SCREAMING_SNAKE_CASE ) == num def a__ ( SCREAMING_SNAKE_CASE : int ): '''...
681
1
"""simple docstring""" from .configuration_bert_masked import MaskedBertConfig from .modeling_bert_masked import ( MaskedBertForMultipleChoice, MaskedBertForQuestionAnswering, MaskedBertForSequenceClassification, MaskedBertForTokenClassification, MaskedBertModel, ) from .modules import * ...
681
"""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 lowerCAmelCase__ = logging.get_logger(__name__) lowerCAmelCase__...
681
1