repo_id stringlengths 15 89 | file_path stringlengths 27 180 | content stringlengths 1 2.23M | __index_level_0__ int64 0 0 |
|---|---|---|---|
hf_public_repos/datasets/src/datasets/packaged_modules | hf_public_repos/datasets/src/datasets/packaged_modules/webdataset/webdataset.py | import io
import json
from itertools import islice
from typing import Any, Callable, Dict, List
import numpy as np
import pyarrow as pa
import datasets
logger = datasets.utils.logging.get_logger(__name__)
class WebDataset(datasets.GeneratorBasedBuilder):
DEFAULT_WRITER_BATCH_SIZE = 100
IMAGE_EXTENSIONS: L... | 0 |
hf_public_repos/datasets/src/datasets/packaged_modules | hf_public_repos/datasets/src/datasets/packaged_modules/webdataset/_tenbin.py | #
# Copyright (c) 2017-2021 NVIDIA CORPORATION. All rights reserved.
# This file coems from the WebDataset library.
# See the LICENSE file for licensing terms (BSD-style).
#
"""
Binary tensor encodings for PyTorch and NumPy.
This defines efficient binary encodings for tensors. The format is 8 byte
aligned and can be ... | 0 |
hf_public_repos/datasets/src/datasets | hf_public_repos/datasets/src/datasets/features/features.py | # Copyright 2020 The HuggingFace Datasets Authors and the TensorFlow Datasets Authors.
#
# 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
#
# U... | 0 |
hf_public_repos/datasets/src/datasets | hf_public_repos/datasets/src/datasets/features/translation.py | from dataclasses import dataclass, field
from typing import TYPE_CHECKING, Any, ClassVar, Dict, List, Optional, Union
import pyarrow as pa
if TYPE_CHECKING:
from .features import FeatureType
@dataclass
class Translation:
"""`FeatureConnector` for translations with fixed languages per example.
Here for ... | 0 |
hf_public_repos/datasets/src/datasets | hf_public_repos/datasets/src/datasets/features/image.py | import os
import sys
import warnings
from dataclasses import dataclass, field
from io import BytesIO
from typing import TYPE_CHECKING, Any, ClassVar, Dict, List, Optional, Union
import numpy as np
import pyarrow as pa
from .. import config
from ..download.download_config import DownloadConfig
from ..download.streamin... | 0 |
hf_public_repos/datasets/src/datasets | hf_public_repos/datasets/src/datasets/features/audio.py | import os
from dataclasses import dataclass, field
from io import BytesIO
from typing import TYPE_CHECKING, Any, ClassVar, Dict, Optional, Union
import numpy as np
import pyarrow as pa
from .. import config
from ..download.download_config import DownloadConfig
from ..download.streaming_download_manager import xopen, ... | 0 |
hf_public_repos/datasets/src/datasets | hf_public_repos/datasets/src/datasets/features/__init__.py | # flake8: noqa
__all__ = [
"Audio",
"Array2D",
"Array3D",
"Array4D",
"Array5D",
"ClassLabel",
"Features",
"Sequence",
"Value",
"Image",
"Translation",
"TranslationVariableLanguages",
]
from .audio import Audio
from .features import Array2D, Array3D, Array4D, Array5D, Cla... | 0 |
hf_public_repos/datasets/src/datasets | hf_public_repos/datasets/src/datasets/utils/readme.py | # loading package files: https://stackoverflow.com/a/20885799
import importlib.resources as pkg_resources
import logging
from pathlib import Path
from typing import Any, List, Tuple
import yaml
from . import resources
from .deprecation_utils import deprecated
BASE_REF_URL = "https://github.com/huggingface/datasets/... | 0 |
hf_public_repos/datasets/src/datasets | hf_public_repos/datasets/src/datasets/utils/tf_utils.py | # Copyright 2022 The HuggingFace Datasets Authors and the TensorFlow Datasets Authors.
#
# 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
#
# U... | 0 |
hf_public_repos/datasets/src/datasets | hf_public_repos/datasets/src/datasets/utils/_filelock.py | #!/usr/bin/env python
# coding=utf-8
# 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/LI... | 0 |
hf_public_repos/datasets/src/datasets | hf_public_repos/datasets/src/datasets/utils/doc_utils.py | from typing import Callable
def is_documented_by(function_with_docstring: Callable):
"""Decorator to share docstrings across common functions.
Args:
function_with_docstring (`Callable`): Name of the function with the docstring.
"""
def wrapper(target_function):
target_function.__doc_... | 0 |
hf_public_repos/datasets/src/datasets | hf_public_repos/datasets/src/datasets/utils/stratify.py | import numpy as np
def approximate_mode(class_counts, n_draws, rng):
"""Computes approximate mode of multivariate hypergeometric.
This is an approximation to the mode of the multivariate
hypergeometric given by class_counts and n_draws.
It shouldn't be off by more than one.
It is the mostly likely... | 0 |
hf_public_repos/datasets/src/datasets | hf_public_repos/datasets/src/datasets/utils/download_manager.py | # deprecated, please use datasets.download.download_manager
| 0 |
hf_public_repos/datasets/src/datasets | hf_public_repos/datasets/src/datasets/utils/beam_utils.py | import os
from apache_beam.io.filesystems import FileSystems
from apache_beam.pipeline import Pipeline
from .logging import get_logger
CHUNK_SIZE = 2 << 20 # 2mb
logger = get_logger(__name__)
class BeamPipeline(Pipeline):
"""Wrapper over `apache_beam.pipeline.Pipeline` for convenience"""
def is_local(se... | 0 |
hf_public_repos/datasets/src/datasets | hf_public_repos/datasets/src/datasets/utils/deprecation_utils.py | import enum
import inspect
import warnings
from functools import wraps
from typing import Callable, Optional
from .logging import get_logger
_emitted_deprecation_warnings = set()
logger = get_logger(__name__)
def deprecated(help_message: Optional[str] = None):
"""Decorator to mark a class or a function as depr... | 0 |
hf_public_repos/datasets/src/datasets | hf_public_repos/datasets/src/datasets/utils/typing.py | import os
from typing import Dict, List, Tuple, TypeVar, Union
T = TypeVar("T")
ListLike = Union[List[T], Tuple[T, ...]]
NestedDataStructureLike = Union[T, List[T], Dict[str, T]]
PathLike = Union[str, bytes, os.PathLike]
| 0 |
hf_public_repos/datasets/src/datasets | hf_public_repos/datasets/src/datasets/utils/extract.py | import bz2
import gzip
import lzma
import os
import shutil
import struct
import tarfile
import warnings
import zipfile
from abc import ABC, abstractmethod
from pathlib import Path
from typing import Dict, List, Optional, Type, Union
from .. import config
from ._filelock import FileLock
from .logging import get_logger
... | 0 |
hf_public_repos/datasets/src/datasets | hf_public_repos/datasets/src/datasets/utils/py_utils.py | # Copyright 2020 The HuggingFace Datasets Authors and the TensorFlow Datasets Authors.
#
# 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
#
# U... | 0 |
hf_public_repos/datasets/src/datasets | hf_public_repos/datasets/src/datasets/utils/filelock.py | # deprecated, please use the `filelock` package instead
from filelock import ( # noqa: F401 # imported for backward compatibility TODO: remove in 3.0.0
BaseFileLock,
SoftFileLock,
Timeout,
UnixFileLock,
WindowsFileLock,
)
from ._filelock import FileLock # noqa: F401 # imported for backward compa... | 0 |
hf_public_repos/datasets/src/datasets | hf_public_repos/datasets/src/datasets/utils/track.py | from collections.abc import Iterator
from typing import Iterable
class tracked_str(str):
origins = {}
def set_origin(self, origin: str):
if super().__repr__() not in self.origins:
self.origins[super().__repr__()] = origin
def get_origin(self):
return self.origins.get(super().... | 0 |
hf_public_repos/datasets/src/datasets | hf_public_repos/datasets/src/datasets/utils/experimental.py | """Contains utilities to flag a feature as "experimental" in datasets."""
import warnings
from functools import wraps
from typing import Callable
def experimental(fn: Callable) -> Callable:
"""Decorator to flag a feature as experimental.
An experimental feature trigger a warning when used as it might be subj... | 0 |
hf_public_repos/datasets/src/datasets | hf_public_repos/datasets/src/datasets/utils/tqdm.py | """Utility helpers to handle progress bars in `datasets`.
Example:
1. Use `datasets.utils.tqdm` as you would use `tqdm.tqdm` or `tqdm.auto.tqdm`.
2. To disable progress bars, either use `disable_progress_bars()` helper or set the
environment variable `HF_DATASETS_DISABLE_PROGRESS_BARS` to 1.
3. To r... | 0 |
hf_public_repos/datasets/src/datasets | hf_public_repos/datasets/src/datasets/utils/metadata.py | import textwrap
from collections import Counter
from itertools import groupby
from operator import itemgetter
from pathlib import Path
from typing import Any, ClassVar, Dict, List, Optional, Tuple, Union
import yaml
from huggingface_hub import DatasetCardData
from ..config import METADATA_CONFIGS_FIELD
from ..info im... | 0 |
hf_public_repos/datasets/src/datasets | hf_public_repos/datasets/src/datasets/utils/__init__.py | # Copyright 2020 The HuggingFace Datasets Authors and the TensorFlow Datasets Authors.
#
# 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
#
# U... | 0 |
hf_public_repos/datasets/src/datasets | hf_public_repos/datasets/src/datasets/utils/logging.py | # Copyright 2020 Optuna, Hugging Face
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | 0 |
hf_public_repos/datasets/src/datasets | hf_public_repos/datasets/src/datasets/utils/hub.py | import time
from functools import partial
from huggingface_hub import HfApi, hf_hub_url
from huggingface_hub.hf_api import RepoFile
from packaging import version
from requests import ConnectionError, HTTPError
from .. import config
from . import logging
logger = logging.get_logger(__name__)
# Retry `preupload_lfs_... | 0 |
hf_public_repos/datasets/src/datasets | hf_public_repos/datasets/src/datasets/utils/sharding.py | from typing import List
import numpy as np
def _number_of_shards_in_gen_kwargs(gen_kwargs: dict) -> int:
"""Return the number of possible shards according to the input gen_kwargs"""
# Having lists of different sizes makes sharding ambigious, raise an error in this case
# until we decide how to define sha... | 0 |
hf_public_repos/datasets/src/datasets | hf_public_repos/datasets/src/datasets/utils/_dill.py | # Copyright 2023 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | 0 |
hf_public_repos/datasets/src/datasets | hf_public_repos/datasets/src/datasets/utils/version.py | # Copyright 2020 The HuggingFace Datasets Authors and the TensorFlow Datasets Authors.
#
# 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
#
# U... | 0 |
hf_public_repos/datasets/src/datasets | hf_public_repos/datasets/src/datasets/utils/_datasets_server.py | from typing import Any, Dict, List, Optional, Union
from .. import config
from ..exceptions import DatasetsError
from .file_utils import (
get_authentication_headers_for_url,
http_get,
)
from .logging import get_logger
logger = get_logger(__name__)
class DatasetsServerError(DatasetsError):
"""Dataset-s... | 0 |
hf_public_repos/datasets/src/datasets | hf_public_repos/datasets/src/datasets/utils/patching.py | from importlib import import_module
from .logging import get_logger
logger = get_logger(__name__)
class _PatchedModuleObj:
"""Set all the modules components as attributes of the _PatchedModuleObj object."""
def __init__(self, module, attrs=None):
attrs = attrs or []
if module is not None:
... | 0 |
hf_public_repos/datasets/src/datasets | hf_public_repos/datasets/src/datasets/utils/info_utils.py | import enum
import os
from typing import Optional
from huggingface_hub.utils import insecure_hashlib
from .. import config
from .logging import get_logger
logger = get_logger(__name__)
class VerificationMode(enum.Enum):
"""`Enum` that specifies which verification checks to run.
The default mode is `BASIC... | 0 |
hf_public_repos/datasets/src/datasets | hf_public_repos/datasets/src/datasets/utils/file_utils.py | """
Utilities for working with the local dataset cache.
This file is adapted from the AllenNLP library at https://github.com/allenai/allennlp
Copyright by the AllenNLP authors.
"""
import copy
import io
import json
import multiprocessing
import os
import posixpath
import re
import shutil
import sys
import time
import ... | 0 |
hf_public_repos/datasets/src/datasets/utils | hf_public_repos/datasets/src/datasets/utils/resources/creators.json | {
"language": [
"found",
"crowdsourced",
"expert-generated",
"machine-generated",
"other"
],
"annotations": [
"found",
"crowdsourced",
"expert-generated",
"machine-generated",
"no-annotation",
"other"
]
}
| 0 |
hf_public_repos/datasets/src/datasets/utils | hf_public_repos/datasets/src/datasets/utils/resources/size_categories.json | [
"unknown",
"n<1K",
"1K<n<10K",
"10K<n<100K",
"100K<n<1M",
"1M<n<10M",
"10M<n<100M",
"100M<n<1B",
"1B<n<10B",
"10B<n<100B",
"100B<n<1T",
"n>1T"
]
| 0 |
hf_public_repos/datasets/src/datasets/utils | hf_public_repos/datasets/src/datasets/utils/resources/languages.json | {
"code": "Programming language (C++, Java, Javascript, Python, etc.)",
"aa": "Afar",
"aaa": "Ghotuo",
"aab": "Alumu-Tesu",
"aac": "Ari",
"aad": "Amal",
"aae": "Arbëreshë Albanian",
"aaf": "Aranadan",
"aag": "Ambrak",
"aah": "Abu' Arapesh",
"aai": "Arifama-Miniafia",
"aak... | 0 |
hf_public_repos/datasets/src/datasets/utils | hf_public_repos/datasets/src/datasets/utils/resources/multilingualities.json | {
"monolingual": "contains a single language",
"multilingual": "contains multiple languages",
"translation": "contains translated or aligned text",
"other": "other type of language distribution"
}
| 0 |
hf_public_repos/datasets/src/datasets/utils | hf_public_repos/datasets/src/datasets/utils/resources/readme_structure.yaml | name: "" # Filename comes here
allow_empty: false
allow_empty_text: true
subsections:
- name: "Dataset Card for X" # First-level markdown heading
allow_empty: false
allow_empty_text: true
subsections:
- name: "Table of Contents"
allow_empty: false
allow_empty_text: false
subs... | 0 |
hf_public_repos/datasets/src/datasets | hf_public_repos/datasets/src/datasets/formatting/tf_formatter.py | # Copyright 2020 The HuggingFace Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... | 0 |
hf_public_repos/datasets/src/datasets | hf_public_repos/datasets/src/datasets/formatting/torch_formatter.py | # Copyright 2020 The HuggingFace Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... | 0 |
hf_public_repos/datasets/src/datasets | hf_public_repos/datasets/src/datasets/formatting/jax_formatter.py | # Copyright 2021 The HuggingFace Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... | 0 |
hf_public_repos/datasets/src/datasets | hf_public_repos/datasets/src/datasets/formatting/formatting.py | # Copyright 2020 The HuggingFace Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... | 0 |
hf_public_repos/datasets/src/datasets | hf_public_repos/datasets/src/datasets/formatting/__init__.py | # Copyright 2020 The HuggingFace Datasets Authors and the TensorFlow Datasets Authors.
#
# 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
#
# U... | 0 |
hf_public_repos/datasets/src/datasets | hf_public_repos/datasets/src/datasets/formatting/np_formatter.py | # Copyright 2020 The HuggingFace Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... | 0 |
hf_public_repos/datasets/src/datasets | hf_public_repos/datasets/src/datasets/download/download_manager.py | # Copyright 2020 The TensorFlow Datasets Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | 0 |
hf_public_repos/datasets/src/datasets | hf_public_repos/datasets/src/datasets/download/download_config.py | import copy
import warnings
from dataclasses import InitVar, dataclass, field
from pathlib import Path
from typing import Any, Dict, Optional, Union
from .. import config
@dataclass
class DownloadConfig:
"""Configuration for our cached path manager.
Attributes:
cache_dir (`str` or `Path`, *optional*... | 0 |
hf_public_repos/datasets/src/datasets | hf_public_repos/datasets/src/datasets/download/streaming_download_manager.py | import glob
import io
import os
import posixpath
import re
import tarfile
import time
import xml.dom.minidom
import zipfile
from asyncio import TimeoutError
from io import BytesIO
from itertools import chain
from pathlib import Path, PurePosixPath
from typing import Any, Callable, Dict, Generator, Iterable, List, Optio... | 0 |
hf_public_repos/datasets/src/datasets | hf_public_repos/datasets/src/datasets/download/__init__.py | __all__ = [
"DownloadConfig",
"DownloadManager",
"DownloadMode",
"StreamingDownloadManager",
]
from .download_config import DownloadConfig
from .download_manager import DownloadManager, DownloadMode
from .streaming_download_manager import StreamingDownloadManager
| 0 |
hf_public_repos/datasets/src/datasets | hf_public_repos/datasets/src/datasets/download/mock_download_manager.py | # Copyright 2020 The TensorFlow Datasets Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | 0 |
hf_public_repos/datasets/src/datasets | hf_public_repos/datasets/src/datasets/commands/test.py | import logging
import os
from argparse import ArgumentParser
from pathlib import Path
from shutil import copyfile, rmtree
from typing import Generator
import datasets.config
from datasets.builder import DatasetBuilder
from datasets.commands import BaseDatasetsCLICommand
from datasets.download.download_manager import D... | 0 |
hf_public_repos/datasets/src/datasets | hf_public_repos/datasets/src/datasets/commands/dummy_data.py | import fnmatch
import json
import os
import shutil
import tempfile
import xml.etree.ElementTree as ET
from argparse import ArgumentParser
from pathlib import Path
from typing import Optional
from datasets import config
from datasets.commands import BaseDatasetsCLICommand
from datasets.download.download_config import D... | 0 |
hf_public_repos/datasets/src/datasets | hf_public_repos/datasets/src/datasets/commands/__init__.py | from abc import ABC, abstractmethod
from argparse import ArgumentParser
class BaseDatasetsCLICommand(ABC):
@staticmethod
@abstractmethod
def register_subcommand(parser: ArgumentParser):
raise NotImplementedError()
@abstractmethod
def run(self):
raise NotImplementedError()
| 0 |
hf_public_repos/datasets/src/datasets | hf_public_repos/datasets/src/datasets/commands/env.py | import platform
from argparse import ArgumentParser
import fsspec
import huggingface_hub
import pandas
import pyarrow
from datasets import __version__ as version
from datasets.commands import BaseDatasetsCLICommand
def info_command_factory(_):
return EnvironmentCommand()
class EnvironmentCommand(BaseDatasetsC... | 0 |
hf_public_repos/datasets/src/datasets | hf_public_repos/datasets/src/datasets/commands/run_beam.py | import os
from argparse import ArgumentParser
from pathlib import Path
from shutil import copyfile
from typing import List
from datasets import config
from datasets.builder import DatasetBuilder
from datasets.commands import BaseDatasetsCLICommand
from datasets.download.download_config import DownloadConfig
from datas... | 0 |
hf_public_repos/datasets/src/datasets | hf_public_repos/datasets/src/datasets/commands/datasets_cli.py | #!/usr/bin/env python
from argparse import ArgumentParser
from datasets.commands.convert import ConvertCommand
from datasets.commands.dummy_data import DummyDataCommand
from datasets.commands.env import EnvironmentCommand
from datasets.commands.run_beam import RunBeamCommand
from datasets.commands.test import TestComm... | 0 |
hf_public_repos/datasets/src/datasets | hf_public_repos/datasets/src/datasets/commands/convert.py | import os
import re
import shutil
from argparse import ArgumentParser, Namespace
from datasets.commands import BaseDatasetsCLICommand
from datasets.utils.logging import get_logger
HIGHLIGHT_MESSAGE_PRE = """<<<<<<< This should probably be modified because it mentions: """
HIGHLIGHT_MESSAGE_POST = """=======
>>>>>>>... | 0 |
hf_public_repos/datasets/src/datasets | hf_public_repos/datasets/src/datasets/filesystems/compression.py | import os
from typing import Optional
import fsspec
from fsspec.archive import AbstractArchiveFileSystem
from fsspec.utils import DEFAULT_BLOCK_SIZE
class BaseCompressedFileFileSystem(AbstractArchiveFileSystem):
"""Read contents of compressed file as a filesystem with one file inside."""
root_marker = ""
... | 0 |
hf_public_repos/datasets/src/datasets | hf_public_repos/datasets/src/datasets/filesystems/__init__.py | import importlib
import shutil
import threading
import warnings
from typing import List
import fsspec
import fsspec.asyn
from fsspec.implementations.local import LocalFileSystem
from ..utils.deprecation_utils import deprecated
from . import compression
_has_s3fs = importlib.util.find_spec("s3fs") is not None
if _h... | 0 |
hf_public_repos/datasets/src/datasets | hf_public_repos/datasets/src/datasets/filesystems/s3filesystem.py | import s3fs
from ..utils.deprecation_utils import deprecated
@deprecated("Use s3fs.S3FileSystem instead.")
class S3FileSystem(s3fs.S3FileSystem):
"""
`datasets.filesystems.S3FileSystem` is a subclass of [`s3fs.S3FileSystem`](https://s3fs.readthedocs.io/en/latest/api.html).
Users can use this class to ac... | 0 |
hf_public_repos/datasets/src/datasets | hf_public_repos/datasets/src/datasets/tasks/image_classification.py | import copy
from dataclasses import dataclass, field
from typing import ClassVar, Dict
from ..features import ClassLabel, Features, Image
from .base import TaskTemplate
@dataclass(frozen=True)
class ImageClassification(TaskTemplate):
task: str = field(default="image-classification", metadata={"include_in_asdict_... | 0 |
hf_public_repos/datasets/src/datasets | hf_public_repos/datasets/src/datasets/tasks/language_modeling.py | from dataclasses import dataclass, field
from typing import ClassVar, Dict
from ..features import Features, Value
from .base import TaskTemplate
@dataclass(frozen=True)
class LanguageModeling(TaskTemplate):
task: str = field(default="language-modeling", metadata={"include_in_asdict_even_if_is_default": True})
... | 0 |
hf_public_repos/datasets/src/datasets | hf_public_repos/datasets/src/datasets/tasks/automatic_speech_recognition.py | import copy
from dataclasses import dataclass, field
from typing import ClassVar, Dict
from ..features import Audio, Features, Value
from .base import TaskTemplate
@dataclass(frozen=True)
class AutomaticSpeechRecognition(TaskTemplate):
task: str = field(default="automatic-speech-recognition", metadata={"include_... | 0 |
hf_public_repos/datasets/src/datasets | hf_public_repos/datasets/src/datasets/tasks/audio_classification.py | import copy
from dataclasses import dataclass, field
from typing import ClassVar, Dict
from ..features import Audio, ClassLabel, Features
from .base import TaskTemplate
@dataclass(frozen=True)
class AudioClassification(TaskTemplate):
task: str = field(default="audio-classification", metadata={"include_in_asdict_... | 0 |
hf_public_repos/datasets/src/datasets | hf_public_repos/datasets/src/datasets/tasks/__init__.py | from typing import Optional
from ..utils.logging import get_logger
from .audio_classification import AudioClassification
from .automatic_speech_recognition import AutomaticSpeechRecognition
from .base import TaskTemplate
from .image_classification import ImageClassification
from .language_modeling import LanguageModel... | 0 |
hf_public_repos/datasets/src/datasets | hf_public_repos/datasets/src/datasets/tasks/question_answering.py | from dataclasses import dataclass, field
from typing import ClassVar, Dict
from ..features import Features, Sequence, Value
from .base import TaskTemplate
@dataclass(frozen=True)
class QuestionAnsweringExtractive(TaskTemplate):
# `task` is not a ClassVar since we want it to be part of the `asdict` output for JSO... | 0 |
hf_public_repos/datasets/src/datasets | hf_public_repos/datasets/src/datasets/tasks/text_classification.py | import copy
from dataclasses import dataclass, field
from typing import ClassVar, Dict
from ..features import ClassLabel, Features, Value
from .base import TaskTemplate
@dataclass(frozen=True)
class TextClassification(TaskTemplate):
# `task` is not a ClassVar since we want it to be part of the `asdict` output fo... | 0 |
hf_public_repos/datasets/src/datasets | hf_public_repos/datasets/src/datasets/tasks/base.py | import abc
import copy
import dataclasses
from dataclasses import dataclass
from typing import ClassVar, Dict, Type, TypeVar
from ..features import Features
T = TypeVar("T", bound="TaskTemplate")
@dataclass(frozen=True)
class TaskTemplate(abc.ABC):
# `task` is not a ClassVar since we want it to be part of the ... | 0 |
hf_public_repos/datasets/src/datasets | hf_public_repos/datasets/src/datasets/tasks/summarization.py | from dataclasses import dataclass, field
from typing import ClassVar, Dict
from ..features import Features, Value
from .base import TaskTemplate
@dataclass(frozen=True)
class Summarization(TaskTemplate):
# `task` is not a ClassVar since we want it to be part of the `asdict` output for JSON serialization
task... | 0 |
hf_public_repos/datasets/.dvc | hf_public_repos/datasets/.dvc/plots/smooth.json | {
"$schema": "https://vega.github.io/schema/vega-lite/v4.json",
"data": {
"values": "<DVC_METRIC_DATA>"
},
"title": "<DVC_METRIC_TITLE>",
"mark": {
"type": "line"
},
"encoding": {
"x": {
"field": "<DVC_METRIC_X>",
"type": "quantitative",
... | 0 |
hf_public_repos/datasets/.dvc | hf_public_repos/datasets/.dvc/plots/confusion.json | {
"$schema": "https://vega.github.io/schema/vega-lite/v4.json",
"data": {
"values": "<DVC_METRIC_DATA>"
},
"title": "<DVC_METRIC_TITLE>",
"mark": "rect",
"encoding": {
"x": {
"field": "<DVC_METRIC_X>",
"type": "nominal",
"sort": "ascending",
... | 0 |
hf_public_repos/datasets/.dvc | hf_public_repos/datasets/.dvc/plots/scatter.json | {
"$schema": "https://vega.github.io/schema/vega-lite/v4.json",
"data": {
"values": "<DVC_METRIC_DATA>"
},
"title": "<DVC_METRIC_TITLE>",
"mark": "point",
"encoding": {
"x": {
"field": "<DVC_METRIC_X>",
"type": "quantitative",
"title": "<DVC_ME... | 0 |
hf_public_repos/datasets/.dvc | hf_public_repos/datasets/.dvc/plots/default.json | {
"$schema": "https://vega.github.io/schema/vega-lite/v4.json",
"data": {
"values": "<DVC_METRIC_DATA>"
},
"title": "<DVC_METRIC_TITLE>",
"mark": {
"type": "line"
},
"encoding": {
"x": {
"field": "<DVC_METRIC_X>",
"type": "quantitative",
... | 0 |
hf_public_repos | hf_public_repos/pytorch-image-models/setup.cfg | [dist_conda]
conda_name_differences = 'torch:pytorch'
channels = pytorch
noarch = True
| 0 |
hf_public_repos | hf_public_repos/pytorch-image-models/benchmark.py | #!/usr/bin/env python3
""" Model Benchmark Script
An inference and train step benchmark script for timm models.
Hacked together by Ross Wightman (https://github.com/rwightman)
"""
import argparse
import csv
import json
import logging
import time
from collections import OrderedDict
from contextlib import suppress
from... | 0 |
hf_public_repos | hf_public_repos/pytorch-image-models/inference.py | #!/usr/bin/env python3
"""PyTorch Inference Script
An example inference script that outputs top-k class ids for images in a folder into a csv.
Hacked together by / Copyright 2020 Ross Wightman (https://github.com/rwightman)
"""
import argparse
import json
import logging
import os
import time
from contextlib import su... | 0 |
hf_public_repos | hf_public_repos/pytorch-image-models/bulk_runner.py | #!/usr/bin/env python3
""" Bulk Model Script Runner
Run validation or benchmark script in separate process for each model
Benchmark all 'vit*' models:
python bulk_runner.py --model-list 'vit*' --results-file vit_bench.csv benchmark.py --amp -b 512
Validate all models:
python bulk_runner.py --model-list all --resul... | 0 |
hf_public_repos | hf_public_repos/pytorch-image-models/onnx_export.py | """ ONNX export script
Export PyTorch models as ONNX graphs.
This export script originally started as an adaptation of code snippets found at
https://pytorch.org/tutorials/advanced/super_resolution_with_onnxruntime.html
The default parameters work with PyTorch 1.6 and ONNX 1.7 and produce an optimal ONNX graph
for h... | 0 |
hf_public_repos | hf_public_repos/pytorch-image-models/mkdocs.yml | site_name: 'Pytorch Image Models'
site_description: 'Pretained Image Recognition Models'
repo_name: 'rwightman/pytorch-image-models'
repo_url: 'https://github.com/rwightman/pytorch-image-models'
nav:
- index.md
- models.md
- ... | models/*.md
- results.md
- scripts.md
- training_hparam_examples.md
- featu... | 0 |
hf_public_repos | hf_public_repos/pytorch-image-models/README.md | # PyTorch Image Models
- [What's New](#whats-new)
- [Introduction](#introduction)
- [Models](#models)
- [Features](#features)
- [Results](#results)
- [Getting Started (Documentation)](#getting-started-documentation)
- [Train, Validation, Inference Scripts](#train-validation-inference-scripts)
- [Awesome PyTorch Resourc... | 0 |
hf_public_repos | hf_public_repos/pytorch-image-models/pyproject.toml | [tool.pytest.ini_options]
markers = [
"base: marker for model tests using the basic setup",
"cfg: marker for model tests checking the config",
"torchscript: marker for model tests using torchscript",
"features: marker for model tests checking feature extraction",
"fxforward: marker for model tests u... | 0 |
hf_public_repos | hf_public_repos/pytorch-image-models/clean_checkpoint.py | #!/usr/bin/env python3
""" Checkpoint Cleaning Script
Takes training checkpoints with GPU tensors, optimizer state, extra dict keys, etc.
and outputs a CPU tensor checkpoint with only the `state_dict` along with SHA256
calculation for model zoo compatibility.
Hacked together by / Copyright 2020 Ross Wightman (https:... | 0 |
hf_public_repos | hf_public_repos/pytorch-image-models/requirements-dev.txt | pytest
pytest-timeout
pytest-xdist
pytest-forked
expecttest
| 0 |
hf_public_repos | hf_public_repos/pytorch-image-models/CONTRIBUTING.md | *This guideline is very much a work-in-progress.*
Contributions to `timm` for code, documentation, tests are more than welcome!
There haven't been any formal guidelines to date so please bear with me, and feel free to add to this guide.
# Coding style
Code linting and auto-format (black) are not currently in place ... | 0 |
hf_public_repos | hf_public_repos/pytorch-image-models/requirements.txt | torch>=1.7
torchvision
pyyaml
huggingface_hub
safetensors>=0.2 | 0 |
hf_public_repos | hf_public_repos/pytorch-image-models/distributed_train.sh | #!/bin/bash
NUM_PROC=$1
shift
torchrun --nproc_per_node=$NUM_PROC train.py "$@"
| 0 |
hf_public_repos | hf_public_repos/pytorch-image-models/setup.py | """ Setup
"""
from setuptools import setup, find_packages
from codecs import open
from os import path
here = path.abspath(path.dirname(__file__))
# Get the long description from the README file
with open(path.join(here, 'README.md'), encoding='utf-8') as f:
long_description = f.read()
exec(open('timm/version.py'... | 0 |
hf_public_repos | hf_public_repos/pytorch-image-models/train.py | #!/usr/bin/env python3
""" ImageNet Training Script
This is intended to be a lean and easily modifiable ImageNet training script that reproduces ImageNet
training results with some of the latest networks and training techniques. It favours canonical PyTorch
and standard Python style over trying to be able to 'do it al... | 0 |
hf_public_repos | hf_public_repos/pytorch-image-models/MANIFEST.in | include timm/models/_pruned/*.txt
include timm/data/_info/*.txt
include timm/data/_info/*.json
| 0 |
hf_public_repos | hf_public_repos/pytorch-image-models/requirements-docs.txt | mkdocs
mkdocs-material
mkdocs-redirects
mdx_truly_sane_lists
mkdocs-awesome-pages-plugin
| 0 |
hf_public_repos | hf_public_repos/pytorch-image-models/avg_checkpoints.py | #!/usr/bin/env python3
""" Checkpoint Averaging Script
This script averages all model weights for checkpoints in specified path that match
the specified filter wildcard. All checkpoints must be from the exact same model.
For any hope of decent results, the checkpoints should be from the same or child
(via resumes) tr... | 0 |
hf_public_repos | hf_public_repos/pytorch-image-models/hubconf.py | dependencies = ['torch']
import timm
globals().update(timm.models._registry._model_entrypoints)
| 0 |
hf_public_repos | hf_public_repos/pytorch-image-models/validate.py | #!/usr/bin/env python3
""" ImageNet Validation Script
This is intended to be a lean and easily modifiable ImageNet validation script for evaluating pretrained
models or training checkpoints against ImageNet or similarly organized image datasets. It prioritizes
canonical PyTorch, standard Python style, and good perform... | 0 |
hf_public_repos | hf_public_repos/pytorch-image-models/onnx_validate.py | """ ONNX-runtime validation script
This script was created to verify accuracy and performance of exported ONNX
models running with the onnxruntime. It utilizes the PyTorch dataloader/processing
pipeline for a fair comparison against the originals.
Copyright 2020 Ross Wightman
"""
import argparse
import numpy as np
im... | 0 |
hf_public_repos | hf_public_repos/pytorch-image-models/LICENSE | Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
... | 0 |
hf_public_repos | hf_public_repos/pytorch-image-models/model-index.yml | Import:
- ./docs/models/*.md
Library:
Name: PyTorch Image Models
Headline: PyTorch image models, scripts, pretrained weights
Website: https://rwightman.github.io/pytorch-image-models/
Repository: https://github.com/rwightman/pytorch-image-models
Docs: https://rwightman.github.io/pytorch-image-models/
README... | 0 |
hf_public_repos/pytorch-image-models | hf_public_repos/pytorch-image-models/results/results-imagenet-a.csv | model,top1,top1_err,top5,top5_err,param_count,img_size,crop_pct,interpolation,top1_diff,top5_diff,rank_diff
eva02_large_patch14_448.mim_m38m_ft_in22k_in1k,88.227,11.773,97.093,2.907,305.08,448,1.000,bicubic,-10.623,-2.787,+1
eva02_large_patch14_448.mim_in22k_ft_in22k_in1k,87.893,12.107,96.920,3.080,305.08,448,1.000,bic... | 0 |
hf_public_repos/pytorch-image-models | hf_public_repos/pytorch-image-models/results/generate_csv_results.py | import numpy as np
import pandas as pd
results = {
'results-imagenet.csv': [
'results-imagenet-real.csv',
'results-imagenetv2-matched-frequency.csv',
'results-sketch.csv'
],
'results-imagenet-a-clean.csv': [
'results-imagenet-a.csv',
],
'results-imagenet-r-clean.csv... | 0 |
hf_public_repos/pytorch-image-models | hf_public_repos/pytorch-image-models/results/results-imagenet-a-clean.csv | model,top1,top1_err,top5,top5_err,param_count,img_size,crop_pct,interpolation
eva02_large_patch14_448.mim_in22k_ft_in22k_in1k,98.930,1.070,99.910,0.090,305.08,448,1.000,bicubic
eva02_large_patch14_448.mim_m38m_ft_in22k_in1k,98.850,1.150,99.880,0.120,305.08,448,1.000,bicubic
eva02_large_patch14_448.mim_in22k_ft_in1k,98.... | 0 |
hf_public_repos/pytorch-image-models | hf_public_repos/pytorch-image-models/results/benchmark-infer-amp-nhwc-pt113-cu117-rtx3090.csv | model,infer_samples_per_sec,infer_step_time,infer_batch_size,infer_img_size,infer_gmacs,infer_macts,param_count
tinynet_e,72737.62,14.068,1024,106,0.03,0.69,2.04
mobilenetv3_small_050,54822.3,18.668,1024,224,0.03,0.92,1.59
lcnet_035,53629.35,19.084,1024,224,0.03,1.04,1.64
lcnet_050,45492.41,22.499,1024,224,0.05,1.26,1.... | 0 |
hf_public_repos/pytorch-image-models | hf_public_repos/pytorch-image-models/results/README.md | # Validation and Benchmark Results
This folder contains validation and benchmark results for the models in this collection. Validation scores are currently only run for models with pretrained weights and ImageNet-1k heads, benchmark numbers are run for all.
## Datasets
There are currently results for the ImageNet va... | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.