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 torch import nn def SCREAMING_SNAKE_CASE ( lowercase_ : Union[str, Any] ): if act_fn in ["swish", "silu"]: return nn.SiLU() elif act_fn == "mish": return nn.Mish() elif act_fn == "gelu": return nn.GELU...
718
'''simple docstring''' 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 lowercase_ : Optional[Any] = logging.get_logger(__name__) lowercase...
653
0
'''simple docstring''' import argparse import json import os import fairseq import torch from fairseq.data import Dictionary from transformers import ( WavaVecaConfig, WavaVecaCTCTokenizer, WavaVecaFeatureExtractor, WavaVecaForCTC, WavaVecaForPreTraining, WavaVecaProcessor, logging, ...
719
'''simple docstring''' def SCREAMING_SNAKE_CASE ( ): lowercase = [] lowercase = 1 while len(lowercase_ ) < 1E6: constant.append(str(lowercase_ ) ) i += 1 lowercase = """""".join(lowercase_ ) ...
653
0
'''simple docstring''' import tensorflow as tf from ...tf_utils import shape_list class __UpperCamelCase (tf.keras.layers.Layer ): def __init__( self , _lowerCAmelCase , _lowerCAmelCase , _lowerCAmelCase , _lowerCAmelCase , _lowerCAmelCase=1 , _lowerCAmelCase=False ,...
720
'''simple docstring''' import os def SCREAMING_SNAKE_CASE ( ): lowercase = os.path.join(os.path.dirname(lowercase_ ) , """num.txt""" ) with open(lowercase_ ) as file_hand: return str(sum(int(lowercase_ ) for line in file_hand ) ...
653
0
'''simple docstring''' from abc import ABC, abstractmethod from typing import Optional, Union from .. import Dataset, DatasetDict, Features, IterableDataset, IterableDatasetDict, NamedSplit from ..utils.typing import NestedDataStructureLike, PathLike class __UpperCamelCase (_UpperC...
721
'''simple docstring''' import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, EulerAncestralDiscreteScheduler, LMSDiscreteScheduler, PNDMScheduler, StableDiffusi...
653
0
'''simple docstring''' def SCREAMING_SNAKE_CASE ( lowercase_ : Union[str, Any] , lowercase_ : str ): lowercase = """""" for i in table: res += inp[i - 1] return res def SCREAMING_SNAKE_CASE ( lowercase_ : List[An...
700
'''simple docstring''' 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, AutoModelForSeq...
653
0
'''simple docstring''' from typing import List, Optional, Union from ...image_utils import ImageInput from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType class ...
701
'''simple docstring''' from typing import List, Union from ..utils import ( add_end_docstrings, is_tf_available, is_torch_available, is_vision_available, logging, requires_backends, ) from .base import PIPELINE_INIT_ARGS, Pipeline if is_vision_available(): from PIL import Image ...
653
0
from PIL import Image def SCREAMING_SNAKE_CASE ( lowercase_ : Image , lowercase_ : float ): def brightness(lowercase_ : int ) -> float: return 128 + level + (c - 128) if not -255.0 <= level <= 255.0: raise ValueError("""level...
702
'''simple docstring''' from ... import PretrainedConfig lowercase_ : int = { '''sijunhe/nezha-cn-base''': '''https://huggingface.co/sijunhe/nezha-cn-base/resolve/main/config.json''', } class __UpperCamelCase (_UpperCAmelCase ): __A = NEZHA_PRETRAINED_CONFIG_ARCHIV...
653
0
'''simple docstring''' import unittest import numpy as np from transformers import RoFormerConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_modeling_flax_common import FlaxModelTesterMixin, ids_tensor, random_attention_mask if is_flax_available(): impo...
703
'''simple docstring''' import json import logging import os import socket import git import numpy as np import torch logging.basicConfig( format='''%(asctime)s - %(levelname)s - %(name)s - PID: %(process)d - %(message)s''', datefmt='''%m/%d/%Y %H:%M:%S''', level=logging.INFO, ) lowercase_ : ...
653
0
'''simple docstring''' import math lowercase_ : Any = 10 lowercase_ : Any = 7 lowercase_ : str = BALLS_PER_COLOUR * NUM_COLOURS def SCREAMING_SNAKE_CASE ( lowercase_ : int = 20 ): lowercase = math.comb(lowercase_ ...
704
'''simple docstring''' from __future__ import annotations import os from typing import Any import requests lowercase_ : List[str] = '''https://api.github.com''' # https://docs.github.com/en/free-pro-team@latest/rest/reference/users#get-the-authenticated-user lowercase_ : Any =...
653
0
def SCREAMING_SNAKE_CASE ( lowercase_ : list ): def merge(lowercase_ : list , lowercase_ : list ) -> list: def _merge(): while left and right: yield (left if left[0] <= right[0] else right).pop(0 ) ...
705
'''simple docstring''' import logging import os import sys import warnings from dataclasses import dataclass, field from random import randint from typing import Optional import datasets import evaluate import numpy as np from datasets import DatasetDict, load_dataset import transformers from transformers impor...
653
0
'''simple docstring''' from ...utils import is_torch_available, is_transformers_available if is_transformers_available() and is_torch_available(): from .pipeline_vq_diffusion import LearnedClassifierFreeSamplingEmbeddings, VQDiffusionPipeline
706
'''simple docstring''' from dataclasses import dataclass, field from typing import Tuple from ..utils import cached_property, is_tf_available, logging, requires_backends from .benchmark_args_utils import BenchmarkArguments if is_tf_available(): import tensorflow as tf lowercase_ : Union[str, An...
653
0
'''simple docstring''' import copy import inspect import unittest import numpy as np from huggingface_hub import hf_hub_download from transformers import VideoMAEConfig from transformers.models.auto import get_values from transformers.testing_utils import require_torch, require_vision, slow, torch_device from tra...
707
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging lowercase_ : Any = logging.get_logger(__name__) lowercase_ : str = { '''sayakpaul/vit-msn-base''': '''https://huggingface.co/sayakpaul/vit-msn-base/resolve/main/config...
653
0
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging lowercase_ : str = logging.get_logger(__name__) lowercase_ : Optional[int] = { '''weiweishi/roc-bert-base-zh''': '''https://huggingface.co/weiweishi/roc-bert-base-zh/r...
708
'''simple docstring''' def SCREAMING_SNAKE_CASE ( lowercase_ : Union[str, Any] , lowercase_ : str ): lowercase = """""" for i in table: res += inp[i - 1] return res def SCREAMING_SNAKE_CASE ( lowercase_ : List[An...
653
0
import warnings from ...utils import logging from .image_processing_videomae import VideoMAEImageProcessor lowercase_ : Optional[Any] = logging.get_logger(__name__) class __UpperCamelCase (_UpperCAmelCase ): def __init__( self , *_lowerCAmelCase , **_lowerCAmel...
709
'''simple docstring''' import json import os import tempfile import transformers import datasets from utils import generate_example_dataset, get_duration lowercase_ : int = 50_0000 lowercase_ , lowercase_ : Union[str, Any] = os.path.split(__file__) lowercase_ ...
653
0
'''simple docstring''' import os import zipfile import requests from get_ci_error_statistics import download_artifact, get_artifacts_links def SCREAMING_SNAKE_CASE ( lowercase_ : Union[str, Any] , lowercase_ : Tuple=7 ): lowercase = None if token i...
710
'''simple docstring''' from random import shuffle import tensorflow as tf from numpy import array def SCREAMING_SNAKE_CASE ( lowercase_ : List[str] , lowercase_ : Optional[int] ): lowercase = int(lowercase_ ) assert noofclusters < len(lowercas...
653
0
'''simple docstring''' import socket def SCREAMING_SNAKE_CASE ( ): lowercase = socket.socket(socket.AF_INET , socket.SOCK_STREAM ) lowercase = socket.gethostname() lowercase = 1_2312 sock.connect((host, port) ) sock...
711
'''simple docstring''' def SCREAMING_SNAKE_CASE ( lowercase_ : int , lowercase_ : int , lowercase_ : list[list[int]] ): def update_area_of_max_square(lowercase_ : int , lowercase_ : int ) -> int: # BASE CASE if row >= r...
653
0
'''simple docstring''' 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, MobileViTImag...
712
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging lowercase_ : Optional[Any] = logging.get_logger(__name__) lowercase_ : int = { '''bigcode/gpt_bigcode-santacoder''': '''https://huggingface.co/bigcode/gpt_bigcode-sant...
653
0
'''simple docstring''' import os import re import warnings from shutil import copyfile from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer if TYPE_CHECKING: from ...tokenization_utils_base import TextInput from...
713
'''simple docstring''' import requests def SCREAMING_SNAKE_CASE ( lowercase_ : str , lowercase_ : str ): lowercase = {"""Content-Type""": """application/json"""} lowercase = requests.post(lowercase_ , json={"""text""": message_body} , ...
653
0
'''simple docstring''' def SCREAMING_SNAKE_CASE ( lowercase_ : int , lowercase_ : list[int] , lowercase_ : int ): def count_of_possible_combinations(lowercase_ : int ) -> int: if target < 0: return 0 if target ...
714
'''simple docstring''' 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, MobileViTImage...
653
0
'''simple docstring''' import importlib import shutil import threading import warnings from typing import List import fsspec import fsspec.asyn from . import compression from .hffilesystem import HfFileSystem lowercase_ : Any = importlib.util.find_spec('''s3fs''') is not None if _has_safs: ...
715
'''simple docstring''' import copy import inspect import unittest from transformers import PretrainedConfig, SwiftFormerConfig from transformers.testing_utils import ( require_torch, require_vision, slow, torch_device, ) from transformers.utils import cached_property, is_torch_available, is_visio...
653
0
'''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 ( CON...
716
'''simple docstring''' from transformers import HfArgumentParser, TensorFlowBenchmark, TensorFlowBenchmarkArguments def SCREAMING_SNAKE_CASE ( ): lowercase = HfArgumentParser(lowercase_ ) lowercase = parser.parse_args_into_dataclasses()[0] lowerca...
653
0
'''simple docstring''' import random import timeit from functools import wraps from typing import Callable, Optional from ..configuration_utils import PretrainedConfig from ..models.auto.modeling_tf_auto import TF_MODEL_MAPPING, TF_MODEL_WITH_LM_HEAD_MAPPING from ..utils import is_pyanvml_available...
717
'''simple docstring''' # coding=utf-8 # Copyright 2023 The HuggingFace Inc. team. # # 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 # # ...
653
0
'''simple docstring''' import argparse import json import os from collections import OrderedDict import numpy as np import tensorflow as tf import torch def SCREAMING_SNAKE_CASE ( lowercase_ : Union[str, Any] ): lowercase = os.path.join(args.tf_model_dir , """pa...
718
'''simple docstring''' 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 lowercase_ : Optional[Any] = logging.get_logger(__name__) lowercase...
653
0
'''simple docstring''' import argparse import collections import torch from flax import traverse_util from tax import checkpoints from transformers import TaConfig, TaEncoderModel, TaForConditionalGeneration from transformers.utils import logging logging.set_verbosity_info() def SCREAMING_SNAKE_CA...
719
'''simple docstring''' def SCREAMING_SNAKE_CASE ( ): lowercase = [] lowercase = 1 while len(lowercase_ ) < 1E6: constant.append(str(lowercase_ ) ) i += 1 lowercase = """""".join(lowercase_ ) ...
653
0
'''simple docstring''' from transformers import DistilBertTokenizer, DistilBertTokenizerFast from transformers.testing_utils import require_tokenizers, slow from ..bert.test_tokenization_bert import BertTokenizationTest @require_tokenizers class __UpperCamelCase (_UpperCAmelCase ): __A = ...
720
'''simple docstring''' import os def SCREAMING_SNAKE_CASE ( ): lowercase = os.path.join(os.path.dirname(lowercase_ ) , """num.txt""" ) with open(lowercase_ ) as file_hand: return str(sum(int(lowercase_ ) for line in file_hand ) ...
653
0
'''simple docstring''' def SCREAMING_SNAKE_CASE ( lowercase_ : str ): lowercase = 0 for ch in input_str: lowercase = ord(lowercase_ ) lowercase = pow(2 , lowercase_ ) # If we alr...
721
'''simple docstring''' import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, EulerAncestralDiscreteScheduler, LMSDiscreteScheduler, PNDMScheduler, StableDiffusi...
653
0
'''simple docstring''' import argparse import math import traceback import dateutil.parser as date_parser import requests def SCREAMING_SNAKE_CASE ( lowercase_ : Any ): lowercase = {} lowercase = job["""started_at"""] lowercase = ...
700
'''simple docstring''' 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, AutoModelForSeq...
653
0
'''simple docstring''' from __future__ import annotations from PIL import Image # Define glider example lowercase_ : List[str] = [ [0, 1, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0, 0, 0], [1, 1, 1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0,...
701
'''simple docstring''' from typing import List, Union from ..utils import ( add_end_docstrings, is_tf_available, is_torch_available, is_vision_available, logging, requires_backends, ) from .base import PIPELINE_INIT_ARGS, Pipeline if is_vision_available(): from PIL import Image ...
653
0
from manim import * class __UpperCamelCase (_UpperCAmelCase ): def _a ( self ) -> List[str]: '''simple docstring''' lowercase = Rectangle(height=0.5 , width=0.5 ) lowercase = Rectangle(height=0.46 , width=0.46...
702
'''simple docstring''' from ... import PretrainedConfig lowercase_ : int = { '''sijunhe/nezha-cn-base''': '''https://huggingface.co/sijunhe/nezha-cn-base/resolve/main/config.json''', } class __UpperCamelCase (_UpperCAmelCase ): __A = NEZHA_PRETRAINED_CONFIG_ARCHIV...
653
0
'''simple docstring''' import numpy as np from cva import COLOR_BGR2GRAY, CV_8UC3, cvtColor, filteraD, imread, imshow, waitKey def SCREAMING_SNAKE_CASE ( lowercase_ : int , lowercase_ : int , lowercase_ : int , lowercase_ : int , lowercase_ : int , ...
703
'''simple docstring''' import json import logging import os import socket import git import numpy as np import torch logging.basicConfig( format='''%(asctime)s - %(levelname)s - %(name)s - PID: %(process)d - %(message)s''', datefmt='''%m/%d/%Y %H:%M:%S''', level=logging.INFO, ) lowercase_ : ...
653
0
'''simple docstring''' from typing import Callable, List, Optional, Union import PIL import torch from transformers import ( CLIPImageProcessor, CLIPSegForImageSegmentation, CLIPSegProcessor, CLIPTextModel, CLIPTokenizer, ) from diffusers import DiffusionPipeline from diffusers.configuration_uti...
704
'''simple docstring''' from __future__ import annotations import os from typing import Any import requests lowercase_ : List[str] = '''https://api.github.com''' # https://docs.github.com/en/free-pro-team@latest/rest/reference/users#get-the-authenticated-user lowercase_ : Any =...
653
0
from __future__ import annotations def SCREAMING_SNAKE_CASE ( lowercase_ : list[int] ): return len(set(lowercase_ ) ) == len(lowercase_ ) if __name__ == "__main__": import doctest doctest.testmod()
705
'''simple docstring''' import logging import os import sys import warnings from dataclasses import dataclass, field from random import randint from typing import Optional import datasets import evaluate import numpy as np from datasets import DatasetDict, load_dataset import transformers from transformers impor...
653
0
'''simple docstring''' import os from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils import AddedToken from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiece_available(): from ...
706
'''simple docstring''' from dataclasses import dataclass, field from typing import Tuple from ..utils import cached_property, is_tf_available, logging, requires_backends from .benchmark_args_utils import BenchmarkArguments if is_tf_available(): import tensorflow as tf lowercase_ : Union[str, An...
653
0
'''simple docstring''' import copy import unittest from transformers.models.auto import get_values from transformers.testing_utils import require_torch, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_configuration_common import ConfigTester ...
707
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging lowercase_ : Any = logging.get_logger(__name__) lowercase_ : str = { '''sayakpaul/vit-msn-base''': '''https://huggingface.co/sayakpaul/vit-msn-base/resolve/main/config...
653
0
'''simple docstring''' from collections.abc import Callable def SCREAMING_SNAKE_CASE ( lowercase_ : Callable[[float], float] , lowercase_ : float , lowercase_ : float ): lowercase = a lowercase = b if function(lowercase_ ...
708
'''simple docstring''' def SCREAMING_SNAKE_CASE ( lowercase_ : Union[str, Any] , lowercase_ : str ): lowercase = """""" for i in table: res += inp[i - 1] return res def SCREAMING_SNAKE_CASE ( lowercase_ : List[An...
653
0
def SCREAMING_SNAKE_CASE ( lowercase_ : Optional[int] , lowercase_ : int , lowercase_ : Optional[int] , lowercase_ : Tuple ): if height >= 1: move_tower(height - 1 , lowercase_ , lowercase_ , lowercase_ ) move_disk(lowercase_ ,...
709
'''simple docstring''' import json import os import tempfile import transformers import datasets from utils import generate_example_dataset, get_duration lowercase_ : int = 50_0000 lowercase_ , lowercase_ : Union[str, Any] = os.path.split(__file__) lowercase_ ...
653
0
'''simple docstring''' from urllib.parse import quote import pytest from datasets.utils.hub import hf_hub_url @pytest.mark.parametrize("""repo_id""" , ["""canonical_dataset_name""", """org-name/dataset-name"""] ) @pytest.mark.parametrize("""path""" , ["""filename.csv""", """filename with blanks.cs...
710
'''simple docstring''' from random import shuffle import tensorflow as tf from numpy import array def SCREAMING_SNAKE_CASE ( lowercase_ : List[str] , lowercase_ : Optional[int] ): lowercase = int(lowercase_ ) assert noofclusters < len(lowercas...
653
0
'''simple docstring''' import torch from diffusers import DiffusionPipeline class __UpperCamelCase (_UpperCAmelCase ): def __init__( self , _lowerCAmelCase , _lowerCAmelCase ) -> List[Any]: '''simple docstring''' super().__init__() self.reg...
711
'''simple docstring''' def SCREAMING_SNAKE_CASE ( lowercase_ : int , lowercase_ : int , lowercase_ : list[list[int]] ): def update_area_of_max_square(lowercase_ : int , lowercase_ : int ) -> int: # BASE CASE if row >= r...
653
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available lowercase_ : Any = { '''configuration_rag''': ['''RagConfig'''], '''retrieval_rag''': ['''RagRetriever'''], '''tokenizatio...
712
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging lowercase_ : Optional[Any] = logging.get_logger(__name__) lowercase_ : int = { '''bigcode/gpt_bigcode-santacoder''': '''https://huggingface.co/bigcode/gpt_bigcode-sant...
653
0
'''simple docstring''' import argparse import gc import json import os import shutil import warnings import torch from transformers import LlamaConfig, LlamaForCausalLM, LlamaTokenizer try: from transformers import LlamaTokenizerFast except ImportError as e: warnings.warn(e) warnings.warn( ...
713
'''simple docstring''' import requests def SCREAMING_SNAKE_CASE ( lowercase_ : str , lowercase_ : str ): lowercase = {"""Content-Type""": """application/json"""} lowercase = requests.post(lowercase_ , json={"""text""": message_body} , ...
653
0
'''simple docstring''' import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch if is_torch_available(): import torch from transformers.generation import DisjunctiveConstraint @require_torch class __UpperCamelCase (unittest.Tes...
714
'''simple docstring''' 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, MobileViTImage...
653
0
'''simple docstring''' from collections import OrderedDict from typing import List, Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging lowercase_ : Dict = logging.get_logger(__name__) lowercas...
715
'''simple docstring''' import copy import inspect import unittest from transformers import PretrainedConfig, SwiftFormerConfig from transformers.testing_utils import ( require_torch, require_vision, slow, torch_device, ) from transformers.utils import cached_property, is_torch_available, is_visio...
653
0
'''simple docstring''' from collections import OrderedDict from typing import Any, Mapping, Optional from ... import PreTrainedTokenizer from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig, OnnxConfigWithPast, OnnxSeqaSeqConfigWithPast from ...onnx.utils import compute_effective_ax...
716
'''simple docstring''' from transformers import HfArgumentParser, TensorFlowBenchmark, TensorFlowBenchmarkArguments def SCREAMING_SNAKE_CASE ( ): lowercase = HfArgumentParser(lowercase_ ) lowercase = parser.parse_args_into_dataclasses()[0] lowerca...
653
0
'''simple docstring''' lowercase_ : List[str] = '''ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/''' def SCREAMING_SNAKE_CASE ( lowercase_ : bytes ): # Make sure the supplied data is a bytes-like object if not isinstan...
717
'''simple docstring''' # coding=utf-8 # Copyright 2023 The HuggingFace Inc. team. # # 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 # # ...
653
0
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices lowercase_ : Tuple = logging.get_logger(__name__) lowercase_ : Optional[int] ...
718
'''simple docstring''' 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 lowercase_ : Optional[Any] = logging.get_logger(__name__) lowercase...
653
0
'''simple docstring''' from collections import namedtuple lowercase_ : List[str] = namedtuple('''from_to''', '''from_ to''') lowercase_ : List[Any] = { '''cubicmeter''': from_to(1, 1), '''litre''': from_to(0.001, 1000), '''kilolitre''': from_to(1, 1), '''gallo...
719
'''simple docstring''' def SCREAMING_SNAKE_CASE ( ): lowercase = [] lowercase = 1 while len(lowercase_ ) < 1E6: constant.append(str(lowercase_ ) ) i += 1 lowercase = """""".join(lowercase_ ) ...
653
0
'''simple docstring''' import os import unicodedata from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import SPIECE_UNDERLINE, logging lowercase_ : Optional[Any] ...
720
'''simple docstring''' import os def SCREAMING_SNAKE_CASE ( ): lowercase = os.path.join(os.path.dirname(lowercase_ ) , """num.txt""" ) with open(lowercase_ ) as file_hand: return str(sum(int(lowercase_ ) for line in file_hand ) ...
653
0
'''simple docstring''' import torch from ..models.auto import AutoModelForSequenceClassification, AutoTokenizer from .base import PipelineTool class __UpperCamelCase (_UpperCAmelCase ): __A = '''facebook/bart-large-mnli''' __A = ( '''This is a tool that c...
721
'''simple docstring''' import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, EulerAncestralDiscreteScheduler, LMSDiscreteScheduler, PNDMScheduler, StableDiffusi...
653
0
'''simple docstring''' from transformers import BertTokenizerFast from .custom_tokenization import CustomTokenizer class A ( UpperCAmelCase ): a_ = CustomTokenizer pass
654
'''simple docstring''' import ast import os import re import shutil import tempfile import unittest from unittest import mock import torch from accelerate.test_utils.examples import compare_against_test from accelerate.test_utils.testing import TempDirTestCase, require_trackers, run_command, slow fro...
654
1
'''simple docstring''' import heapq import sys import numpy as np __lowerCAmelCase : Any = tuple[int, int] class A : def __init__( self : Optional[int] ) -> int: __UpperCAmelCase = [] __UpperCAmelCase ...
654
'''simple docstring''' import glob import os import random from string import ascii_lowercase, digits import cva __lowerCAmelCase : Any = "" __lowerCAmelCase : int = "" __lowerCAmelCase : Union[str, Any] = "" __lowerCAmelCase : Any =...
654
1
'''simple docstring''' import unittest from pathlib import Path from tempfile import TemporaryDirectory from transformers import AutoConfig, TFGPTaLMHeadModel, is_keras_nlp_available, is_tf_available from transformers.models.gpta.tokenization_gpta import GPTaTokenizer from transformers.testing_utils import ...
654
'''simple docstring''' from pathlib import Path import fire def lowerCAmelCase ( UpperCamelCase__ : str , UpperCamelCase__ : str , UpperCamelCase__ : int ): """simple docstring""" __UpperCAmelCase = Path(UpperCamelCase__ ) __UpperC...
654
1
'''simple docstring''' from io import BytesIO from typing import List, Union import requests from ..utils import add_end_docstrings, is_decord_available, is_torch_available, logging, requires_backends from .base import PIPELINE_INIT_ARGS, Pipeline if is_decord_available(): import numpy as np ...
654
'''simple docstring''' def lowerCAmelCase ( UpperCamelCase__ : int ): """simple docstring""" if not isinstance(UpperCamelCase__ , UpperCamelCase__ ): __UpperCAmelCase = f"""Input value of [number={number}] must be an integer""" raise TypeError(UpperCamelCa...
654
1
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging __lowerCAmelCase : List[str] = logging.get_logger(__name__) __lowerCAmelCase : Union[str, Any] = { "MIT/ast-finetuned-audioset-10-10-0.4593": ( "https:/...
654
'''simple docstring''' import unittest import torch from torch import nn from accelerate.test_utils import require_cuda from accelerate.utils.memory import find_executable_batch_size, release_memory def lowerCAmelCase ( ): """simple docstring""" raise RuntimeError('''CUDA out ...
654
1
'''simple docstring''' import warnings from ...utils import logging from .image_processing_dpt import DPTImageProcessor __lowerCAmelCase : Optional[int] = logging.get_logger(__name__) class A ( UpperCAmelCase ): def __init__( self : ...
654
'''simple docstring''' from __future__ import annotations import math def lowerCAmelCase ( UpperCamelCase__ : float , UpperCamelCase__ : int ): """simple docstring""" __UpperCAmelCase = u for i in range(1 , UpperCamelCase__ ): __Uppe...
654
1
'''simple docstring''' 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, BaseModelOutputWithNoA...
654
'''simple docstring''' import argparse from pathlib import Path import requests import torch from PIL import Image from transformers import ( RobertaTokenizer, TrOCRConfig, TrOCRForCausalLM, TrOCRProcessor, VisionEncoderDecoderModel, ViTConfig, ViTImageProcessor, Vi...
654
1
'''simple docstring''' import re def lowerCAmelCase ( UpperCamelCase__ : str ): """simple docstring""" if len(re.findall('''[ATCG]''' , UpperCamelCase__ ) ) != len(UpperCamelCase__ ): raise ValueError('''Invalid Strand''' ) return dna...
654
'''simple docstring''' import gc import unittest from parameterized import parameterized from diffusers import FlaxUNetaDConditionModel from diffusers.utils import is_flax_available from diffusers.utils.testing_utils import load_hf_numpy, require_flax, slow if is_flax_available(): import jax ...
654
1
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging __lowerCAmelCase : Optional[int] = logging.get_logger(__name__) __lowerCAmelCase : str = {} class A ( UpperCAmelCase ): a_ = ...
654
'''simple docstring''' import argparse import os import re import packaging.version __lowerCAmelCase : Optional[int] = "examples/" __lowerCAmelCase : Dict = { "examples": (re.compile(r"^check_min_version\(\"[^\"]+\"\)\s*$", re.MULTILINE), "check_min_version(\"VER...
654
1
'''simple docstring''' import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, PNDMScheduler, StableDiffusionLDMaDPipeline, UNetaDConditionModel, ) from ...
654
'''simple docstring''' def lowerCAmelCase ( UpperCamelCase__ : Tuple ): """simple docstring""" # if the collection is empty, returns empty if collection == []: return [] # get some information about the collection __UpperCAmelCase = len(UpperCamelCase__ ) __...
654
1
'''simple docstring''' import argparse import os import re import numpy as np import PIL import torch from timm import create_model from torch.optim.lr_scheduler import OneCycleLR from torch.utils.data import DataLoader, Dataset from torchvision.transforms import Compose, RandomResizedCrop, Resize, ToTe...
654
'''simple docstring''' import requests from bsa import BeautifulSoup def lowerCAmelCase ( UpperCamelCase__ : str = "AAPL" ): """simple docstring""" __UpperCAmelCase = f"""https://in.finance.yahoo.com/quote/{symbol}?s={symbol}""" __UpperCAmelCase = Beautif...
654
1
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices __lowerCAmelCase : Any = logging.get_logger(__name__) __lowerCAmelCase : str ...
654
'''simple docstring''' from __future__ import annotations from statistics import mean def lowerCAmelCase ( UpperCamelCase__ : list[int] , UpperCamelCase__ : list[int] , UpperCamelCase__ : int ): """simple docstring""" __UpperCAmelCase = [0...
654
1
'''simple docstring''' import json import os import tempfile import transformers import datasets from utils import generate_example_dataset, get_duration __lowerCAmelCase : Optional[int] = 500_000 __lowerCAmelCase , __lowerCAmelCase : str = os.path.split(_...
654
'''simple docstring''' from ..utils import DummyObject, requires_backends class A ( metaclass=UpperCAmelCase ): a_ = ['''torch'''] def __init__( self : Optional[int] , *__a : List[str] , **__a : Union[str, Any]...
654
1
'''simple docstring''' import argparse import json from collections import OrderedDict from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ( ConditionalDetrConfig, ConditionalDetrForObjectDetection, ...
654
'''simple docstring''' import warnings from diffusers import StableDiffusionImgaImgPipeline # noqa F401 warnings.warn( "The `image_to_image.py` script is outdated. Please use directly `from diffusers import" " StableDiffusionImg2ImgPipeline` instead." )
654
1
'''simple docstring''' import sys from typing import Tuple import numpy as np import torch from PIL import Image from torch import nn from transformers.image_utils import PILImageResampling from utils import img_tensorize class A : def __init__( self : ...
654
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, ) __lowerCAmelCase : Optional[Any] = { "configuration_llama":...
654
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/LICEN...
654
'''simple docstring''' import logging import os from dataclasses import dataclass, field from typing import Dict, Optional import datasets import numpy as np import tensorflow as tf from transformers import ( AutoConfig, AutoTokenizer, EvalPrediction, HfArgumentParser, PreTraine...
654
1
'''simple docstring''' from typing import List, Optional, Tuple, Union import torch from ...models import UNetaDModel from ...schedulers import ScoreSdeVeScheduler from ...utils import randn_tensor from ..pipeline_utils import DiffusionPipeline, ImagePipelineOutput class A ( UpperCA...
654
'''simple docstring''' from __future__ import annotations import unittest from transformers import DistilBertConfig, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, id...
654
1
'''simple docstring''' # 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 imp...
654
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_speech_available, is_torch_available __lowerCAmelCase : List[Any] = { "configuration_audio_spectrogram_transformer": [ "AUDIO_SPECTROGRAM_TRANSFORMER_...
654
1
'''simple docstring''' import copy from typing import Any, Dict, List, Optional, Union import numpy as np from ...audio_utils import mel_filter_bank, spectrogram, window_function from ...feature_extraction_sequence_utils import SequenceFeatureExtractor from ...feature_extraction_utils import BatchFeature ...
654
'''simple docstring''' from ...configuration_utils import PretrainedConfig class A ( UpperCAmelCase ): a_ = '''bert-generation''' def __init__( self : str , __a : str=5_0_3_5_8 , __a : int=1_0_2_4 , __a ...
654
1
'''simple docstring''' import gc import importlib.metadata import tempfile import unittest from packaging import version from transformers import ( AutoModel, AutoModelForCausalLM, AutoModelForSeqaSeqLM, AutoModelForSequenceClassification, AutoTokenizer, BitsAndBytesConfig, ...
654
'''simple docstring''' from math import sqrt import numpy as np from sympy import symbols # Coefficient # Speed of light (m/s) __lowerCAmelCase : str = 299_792_458 # Symbols __lowerCAmelCase , __lowerCAmelCase , __lowerCAmelCase , __lowerCAmelCase : Any ...
654
1
'''simple docstring''' def lowerCAmelCase ( UpperCamelCase__ : int = 3 , UpperCamelCase__ : int = 7 , UpperCamelCase__ : int = 1_0_0_0_0_0_0 ): """simple docstring""" __UpperCAmelCase = 0 __UpperCAmelCase = 1 for current_denominator in ran...
654
'''simple docstring''' import heapq import sys import numpy as np __lowerCAmelCase : Any = tuple[int, int] class A : def __init__( self : Optional[int] ) -> int: __UpperCAmelCase = [] __UpperCAmelCase ...
654
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/LICEN...
654
'''simple docstring''' import argparse import collections import os import re import tempfile import pandas as pd from datasets import Dataset from huggingface_hub import hf_hub_download, upload_folder from transformers.utils import direct_transformers_import # All paths are set with the intent yo...
654
1
'''simple docstring''' from ....utils import logging __lowerCAmelCase : Optional[Any] = logging.get_logger(__name__) class A ( UpperCAmelCase ): def __init__( self : Optional[int] , __a : int , __a : int=Non...
654
'''simple docstring''' import ast import os import re import shutil import tempfile import unittest from unittest import mock import torch from accelerate.test_utils.examples import compare_against_test from accelerate.test_utils.testing import TempDirTestCase, require_trackers, run_command, slow fro...
654
1
'''simple docstring''' from typing import Callable, Optional from .. import Features from ..packaged_modules.generator.generator import Generator from .abc import AbstractDatasetInputStream class A ( UpperCAmelCase ): def __init__( self : int , __a...
654
'''simple docstring''' import glob import os import random from string import ascii_lowercase, digits import cva __lowerCAmelCase : Any = "" __lowerCAmelCase : int = "" __lowerCAmelCase : Union[str, Any] = "" __lowerCAmelCase : Any =...
654
1
'''simple docstring''' import requests __lowerCAmelCase : Dict = "YOUR API KEY" def lowerCAmelCase ( UpperCamelCase__ : str , UpperCamelCase__ : str = giphy_api_key ): """simple docstring""" __UpperCAmelCase = '''+'''.join(query.spli...
654
'''simple docstring''' from pathlib import Path import fire def lowerCAmelCase ( UpperCamelCase__ : str , UpperCamelCase__ : str , UpperCamelCase__ : int ): """simple docstring""" __UpperCAmelCase = Path(UpperCamelCase__ ) __UpperC...
654
1
'''simple docstring''' import unittest from knapsack import knapsack as k class A ( unittest.TestCase ): def snake_case__ ( self : int ) -> Tuple: __UpperCAmelCase = 0 __UpperCAmelCase = [0] __Up...
654
'''simple docstring''' def lowerCAmelCase ( UpperCamelCase__ : int ): """simple docstring""" if not isinstance(UpperCamelCase__ , UpperCamelCase__ ): __UpperCAmelCase = f"""Input value of [number={number}] must be an integer""" raise TypeError(UpperCamelCa...
654
1
'''simple docstring''' from torch import nn def lowerCAmelCase ( UpperCamelCase__ : Any ): """simple docstring""" if act_fn in ["swish", "silu"]: return nn.SiLU() elif act_fn == "mish": return nn.Mish() elif act_fn == "gelu": return nn.GELU() else: raise V...
654
'''simple docstring''' import unittest import torch from torch import nn from accelerate.test_utils import require_cuda from accelerate.utils.memory import find_executable_batch_size, release_memory def lowerCAmelCase ( ): """simple docstring""" raise RuntimeError('''CUDA out ...
654
1
'''simple docstring''' def lowerCAmelCase ( UpperCamelCase__ : int = 5_0 ): """simple docstring""" __UpperCAmelCase = [1] * (length + 1) for row_length in range(length + 1 ): for tile_length in range(2 , 5 ): for tile_start in range(row_length - t...
654
'''simple docstring''' from __future__ import annotations import math def lowerCAmelCase ( UpperCamelCase__ : float , UpperCamelCase__ : int ): """simple docstring""" __UpperCAmelCase = u for i in range(1 , UpperCamelCase__ ): __Uppe...
654
1
'''simple docstring''' import math def lowerCAmelCase ( ): """simple docstring""" __UpperCAmelCase = input('''Enter message: ''' ) __UpperCAmelCase = int(input(f"""Enter key [2-{len(UpperCamelCase__ ) - 1}]: """ ) ) __UpperCAmelCase = ...
654
'''simple docstring''' import argparse from pathlib import Path import requests import torch from PIL import Image from transformers import ( RobertaTokenizer, TrOCRConfig, TrOCRForCausalLM, TrOCRProcessor, VisionEncoderDecoderModel, ViTConfig, ViTImageProcessor, Vi...
654
1
'''simple docstring''' import argparse import os import jax as jnp import numpy as onp import torch import torch.nn as nn from music_spectrogram_diffusion import inference from tax import checkpoints from diffusers import DDPMScheduler, OnnxRuntimeModel, SpectrogramDiffusionPipeline from diffusers.pip...
654
'''simple docstring''' import gc import unittest from parameterized import parameterized from diffusers import FlaxUNetaDConditionModel from diffusers.utils import is_flax_available from diffusers.utils.testing_utils import load_hf_numpy, require_flax, slow if is_flax_available(): import jax ...
654
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_speech_available, is_torch_available __lowerCAmelCase : List[Any] = { "configuration_audio_spectrogram_transformer": [ "AUDIO_SPECTROGRAM_TRANSFORMER_...
654
'''simple docstring''' import argparse import os import re import packaging.version __lowerCAmelCase : Optional[int] = "examples/" __lowerCAmelCase : Dict = { "examples": (re.compile(r"^check_min_version\(\"[^\"]+\"\)\s*$", re.MULTILINE), "check_min_version(\"VER...
654
1
'''simple docstring''' import argparse from collections import defaultdict import yaml __lowerCAmelCase : int = "docs/source/en/_toctree.yml" def lowerCAmelCase ( UpperCamelCase__ : List[str] ): """simple docstring""" __UpperCAmelCase = de...
654
'''simple docstring''' def lowerCAmelCase ( UpperCamelCase__ : Tuple ): """simple docstring""" # if the collection is empty, returns empty if collection == []: return [] # get some information about the collection __UpperCAmelCase = len(UpperCamelCase__ ) __...
654
1
'''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...
654
'''simple docstring''' import requests from bsa import BeautifulSoup def lowerCAmelCase ( UpperCamelCase__ : str = "AAPL" ): """simple docstring""" __UpperCAmelCase = f"""https://in.finance.yahoo.com/quote/{symbol}?s={symbol}""" __UpperCAmelCase = Beautif...
654
1
'''simple docstring''' from __future__ import annotations import unittest from transformers import DistilBertConfig, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, id...
654
'''simple docstring''' from __future__ import annotations from statistics import mean def lowerCAmelCase ( UpperCamelCase__ : list[int] , UpperCamelCase__ : list[int] , UpperCamelCase__ : int ): """simple docstring""" __UpperCAmelCase = [0...
654
1
'''simple docstring''' import argparse import json from pathlib import Path import requests import timm import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import DeiTConfig, DeiTForImageClassificationWithTeacher, DeiTImageProcessor from transformers.utils ...
654
'''simple docstring''' from ..utils import DummyObject, requires_backends class A ( metaclass=UpperCAmelCase ): a_ = ['''torch'''] def __init__( self : Optional[int] , *__a : List[str] , **__a : Union[str, Any]...
654
1
'''simple docstring''' import argparse import collections import os import re import tempfile import pandas as pd from datasets import Dataset from huggingface_hub import hf_hub_download, upload_folder from transformers.utils import direct_transformers_import # All paths are set with the intent yo...
654
'''simple docstring''' import warnings from diffusers import StableDiffusionImgaImgPipeline # noqa F401 warnings.warn( "The `image_to_image.py` script is outdated. Please use directly `from diffusers import" " StableDiffusionImg2ImgPipeline` instead." )
654
1
'''simple docstring''' from dataclasses import dataclass from enum import Enum from typing import List, Optional, Union import numpy as np import PIL from PIL import Image from ...utils import BaseOutput, is_torch_available, is_transformers_available @dataclass class A ( UpperCAme...
654
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, ) __lowerCAmelCase : Optional[Any] = { "configuration_llama":...
654
1
'''simple docstring''' def lowerCAmelCase ( UpperCamelCase__ : list[int] ): """simple docstring""" __UpperCAmelCase = [] if len(UpperCamelCase__ ) == 1: return [nums.copy()] for _ in range(len(UpperCamelCase__ ) ): __UpperCAmelCase = nums.po...
654
'''simple docstring''' import logging import os from dataclasses import dataclass, field from typing import Dict, Optional import datasets import numpy as np import tensorflow as tf from transformers import ( AutoConfig, AutoTokenizer, EvalPrediction, HfArgumentParser, PreTraine...
654
1
'''simple docstring''' def lowerCAmelCase ( UpperCamelCase__ : Tuple ): """simple docstring""" # if the collection is empty, returns empty if collection == []: return [] # get some information about the collection __UpperCAmelCase = len(UpperCamelCase__ ) __...
654
'''simple docstring''' from __future__ import annotations import unittest from transformers import DistilBertConfig, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, id...
654
1
'''simple docstring''' from dataclasses import dataclass from typing import List, Optional, Union import numpy as np import torch from ...utils import BaseOutput, OptionalDependencyNotAvailable, is_torch_available, is_transformers_available @dataclass class A ( UpperCAmelCase ): ...
654
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_speech_available, is_torch_available __lowerCAmelCase : List[Any] = { "configuration_audio_spectrogram_transformer": [ "AUDIO_SPECTROGRAM_TRANSFORMER_...
654
1
'''simple docstring''' # This model implementation is heavily inspired by https://github.com/haofanwang/ControlNet-for-Diffusers/ import gc import random import tempfile import unittest import numpy as np import torch from PIL import Image from transformers import CLIPTextConfig, CLIPTextModel, CLIPTok...
654
'''simple docstring''' from ...configuration_utils import PretrainedConfig class A ( UpperCAmelCase ): a_ = '''bert-generation''' def __init__( self : str , __a : str=5_0_3_5_8 , __a : int=1_0_2_4 , __a ...
654
1
'''simple docstring''' # # This a `torch.distributed` diagnostics script that checks that all GPUs in the cluster (one or # many nodes) can talk to each other via nccl and allocate gpu memory. # # To run first adjust the number of processes and nodes: # # python -m torch.distributed.run --nproc_per_node 2 --...
654
'''simple docstring''' from math import sqrt import numpy as np from sympy import symbols # Coefficient # Speed of light (m/s) __lowerCAmelCase : str = 299_792_458 # Symbols __lowerCAmelCase , __lowerCAmelCase , __lowerCAmelCase , __lowerCAmelCase : Any ...
654
1
'''simple docstring''' import unittest import numpy as np import timeout_decorator # noqa from transformers import BlenderbotConfig, is_flax_available from transformers.testing_utils import jax_device, require_flax, slow from ...generation.test_flax_utils import FlaxGenerationTesterMixin from ...test_...
654
'''simple docstring''' import heapq import sys import numpy as np __lowerCAmelCase : Any = tuple[int, int] class A : def __init__( self : Optional[int] ) -> int: __UpperCAmelCase = [] __UpperCAmelCase ...
654
1
'''simple docstring''' from typing import Dict, List, Optional from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging __lowerCAmelCase : str = logging.get_logger(__name__) __lowerCAmelCase : Optional[int] = { "nielsr/can...
654
'''simple docstring''' import argparse import collections import os import re import tempfile import pandas as pd from datasets import Dataset from huggingface_hub import hf_hub_download, upload_folder from transformers.utils import direct_transformers_import # All paths are set with the intent yo...
654
1
'''simple docstring''' import argparse import json import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from torchvision import transforms from transformers import BitImageProcessor, FocalNetConfig, FocalNetForImageClassification from transformers.image_utils i...
654
'''simple docstring''' import ast import os import re import shutil import tempfile import unittest from unittest import mock import torch from accelerate.test_utils.examples import compare_against_test from accelerate.test_utils.testing import TempDirTestCase, require_trackers, run_command, slow fro...
654
1
'''simple docstring''' from dataclasses import dataclass from typing import Dict, Optional, Union import torch import torch.nn.functional as F from torch import nn from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput from .attention import BasicTransformerBloc...
654
'''simple docstring''' import glob import os import random from string import ascii_lowercase, digits import cva __lowerCAmelCase : Any = "" __lowerCAmelCase : int = "" __lowerCAmelCase : Union[str, Any] = "" __lowerCAmelCase : Any =...
654
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, DDIMScheduler, EulerAncestralDiscreteScheduler, LMSDiscret...
654
'''simple docstring''' from pathlib import Path import fire def lowerCAmelCase ( UpperCamelCase__ : str , UpperCamelCase__ : str , UpperCamelCase__ : int ): """simple docstring""" __UpperCAmelCase = Path(UpperCamelCase__ ) __UpperC...
654
1
'''simple docstring''' from __future__ import annotations def lowerCAmelCase ( UpperCamelCase__ : list[list[int]] ): """simple docstring""" # preprocessing the first row for i in range(1 , len(matrix[0] ) ): matrix[0][i] += matrix[0][i - 1] # p...
654
'''simple docstring''' def lowerCAmelCase ( UpperCamelCase__ : int ): """simple docstring""" if not isinstance(UpperCamelCase__ , UpperCamelCase__ ): __UpperCAmelCase = f"""Input value of [number={number}] must be an integer""" raise TypeError(UpperCamelCa...
654
1
'''simple docstring''' import unittest from transformers import JukeboxTokenizer from transformers.testing_utils import require_torch class A ( unittest.TestCase ): a_ = JukeboxTokenizer a_ = { '''artist''': '''Zac Brown Band''', ...
654
'''simple docstring''' import unittest import torch from torch import nn from accelerate.test_utils import require_cuda from accelerate.utils.memory import find_executable_batch_size, release_memory def lowerCAmelCase ( ): """simple docstring""" raise RuntimeError('''CUDA out ...
654
1
'''simple docstring''' def lowerCAmelCase ( UpperCamelCase__ : int ): """simple docstring""" if upper_limit < 0: raise ValueError('''Limit for the Catalan sequence must be ≥ 0''' ) __UpperCAmelCase = [0] * (upper_limit + 1) # Base case: C(0) = C(1) = 1 __Upp...
654
'''simple docstring''' from __future__ import annotations import math def lowerCAmelCase ( UpperCamelCase__ : float , UpperCamelCase__ : int ): """simple docstring""" __UpperCAmelCase = u for i in range(1 , UpperCamelCase__ ): __Uppe...
654
1
'''simple docstring''' import json import multiprocessing as mp import re from collections import defaultdict from functools import partial from typing import Dict, List, Optional, Set, Tuple, Type from datasets import Dataset from datasketch import MinHash, MinHashLSH from dpu_utils.utils.iterators impo...
654
'''simple docstring''' import argparse from pathlib import Path import requests import torch from PIL import Image from transformers import ( RobertaTokenizer, TrOCRConfig, TrOCRForCausalLM, TrOCRProcessor, VisionEncoderDecoderModel, ViTConfig, ViTImageProcessor, Vi...
654
1
'''simple docstring''' import argparse import collections import os import re from transformers.utils import direct_transformers_import # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_table.py __lowerCAmelCase : Dict ...
654
'''simple docstring''' import gc import unittest from parameterized import parameterized from diffusers import FlaxUNetaDConditionModel from diffusers.utils import is_flax_available from diffusers.utils.testing_utils import load_hf_numpy, require_flax, slow if is_flax_available(): import jax ...
654
1