forked from tensorflow/datasets
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
280 lines (259 loc) · 9.63 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
# coding=utf-8
# Copyright 2024 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 agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""tensorflow/datasets is a library of datasets ready to use with TensorFlow.
tensorflow/datasets is a library of public datasets ready to use with
TensorFlow. Each dataset definition contains the logic necessary to download and
prepare the dataset, as well as to read it into a model using the
`tf.data.Dataset` API.
Usage outside of TensorFlow is also supported.
See the README on GitHub for further documentation.
"""
import datetime
import itertools
import os
import sys
import pkg_resources
import setuptools
if '--nightly' in sys.argv:
nightly = True
sys.argv.remove('--nightly')
else:
nightly = False
project_name = 'tensorflow-datasets'
# To enable importing version.py directly, we add its path to sys.path.
version_path = os.path.join(os.path.dirname(__file__), 'tensorflow_datasets')
sys.path.append(version_path)
from version import __version__ # pytype: disable=import-error # pylint: disable=g-import-not-at-top
if nightly:
project_name = 'tfds-nightly'
# Version as `X.Y.Z.dev199912312459`
datestring = os.environ.get(
'TFDS_NIGHTLY_TIMESTAMP'
) or datetime.datetime.now().strftime('%Y%m%d%H%M')
curr_version = pkg_resources.parse_version(__version__)
__version__ = f'{curr_version.base_version}.dev{datestring}'
DOCLINES = __doc__.split('\n')
REQUIRED_PKGS = [
'absl-py',
# Min version of 0.5.0 as old array_record wheel are bugged on all
# platform except 'x86_64'. See
# https://github.com/google/array_record/issues/71
'array_record>=0.5.0;platform_system=="Linux"',
'click',
'dm-tree',
'etils[enp,epath,epy,etree]>=1.6.0',
'numpy',
'promise',
'protobuf>=3.20',
'psutil',
'pyarrow',
'requests>=2.19.0',
'tensorflow-metadata',
'termcolor',
'toml',
'tqdm',
'wrapt',
# Standard library backports
'importlib_resources;python_version<"3.9"',
]
TESTS_DEPENDENCIES = [
'dill',
'jax[cpu]',
'jupyter',
'pytest',
'pytest-shard',
'pytest-xdist',
# Lazy-deps required by core
'pandas',
'pydub',
'apache-beam',
'conllu',
# TODO(b/142892342): Re-enable
# 'tensorflow-docs @ git+https://github.com/tensorflow/docs#egg=tensorflow-docs', # pylint: disable=line-too-long
# Required by scripts/documentation/
'pyyaml',
'tensorflow-io[tensorflow]',
]
# Additional deps for formatting
DEV_DEPENDENCIES = [
'pylint>=2.6.0',
'yapf',
]
# Static files needed by datasets.
DATASET_FILES = [
'datasets/imagenet2012/labels.txt',
'datasets/imagenet2012/validation_labels.txt',
'datasets/lvis/classes.txt',
'datasets/ogbg_molpcba/tasks.txt',
'datasets/quickdraw/labels.txt',
'datasets/smartwatch_gestures/labels.txt',
'image_classification/caltech101_labels.txt',
'image_classification/categories_places365.txt',
'image_classification/cbis_ddsm_calc_distributions.txt',
'image_classification/cbis_ddsm_calc_types.txt',
'image_classification/cbis_ddsm_mass_margins.txt',
'image_classification/cbis_ddsm_mass_shapes.txt',
'image_classification/cbis_ddsm_patch_labels.txt',
'image_classification/dtd_key_attributes.txt',
'image_classification/food-101_classes.txt',
'image_classification/i_naturalist2018/inaturalist2018_labels.txt',
'image_classification/i_naturalist2018/inaturalist2018_supercategories.txt',
'image_classification/i_naturalist2021/i_naturalist2021_labels.txt',
'image_classification/i_naturalist2021/i_naturalist2021_supercategories.txt',
'image_classification/imagenet_resized_labels.txt',
'image_classification/imagenette_labels.txt',
'image_classification/imagewang_labels.txt',
'image_classification/inaturalist_labels.txt',
'image_classification/inaturalist_supercategories.txt',
'image_classification/placesfull/categories_placesfull.txt',
'image_classification/plantae_k_urls.txt',
'image_classification/sun397_labels.txt',
'image_classification/sun397_tfds_te.txt',
'image_classification/sun397_tfds_tr.txt',
'image_classification/sun397_tfds_va.txt',
'object_detection/open_images_classes_all.txt',
'object_detection/open_images_classes_boxable.txt',
'object_detection/open_images_classes_trainable.txt',
'video/tao/labels.txt',
'video/ucf101_labels.txt',
'video/youtube_vis/labels.txt',
]
# Extra dependencies required by specific datasets
DATASET_EXTRAS = {
# In alphabetical order
'aflw2k3d': ['scipy'],
'beir': ['apache-beam'],
'ble_wind_field': ['gcsfs', 'zarr'],
'c4': ['apache-beam', 'gcld3', 'langdetect', 'nltk', 'tldextract'],
'c4_wsrs': ['apache-beam'],
'cats_vs_dogs': ['matplotlib'],
'colorectal_histology': ['Pillow'],
'common_voice': ['pydub'], # and ffmpeg installed
'duke_ultrasound': ['scipy'],
'eurosat': ['scikit-image', 'tifffile', 'imagecodecs'],
'groove': ['pretty_midi', 'pydub'],
'gtzan': ['pydub'],
'imagenet2012_corrupted': [
# This includes pre-built source; you may need to use an alternative
# route to install OpenCV
'opencv-python',
'scikit-image',
'scipy',
],
'librispeech': ['pydub'], # and ffmpeg installed
'lsun': ['tensorflow-io[tensorflow]'],
# sklearn version required to avoid conflict with librosa from
# https://github.com/scikit-learn/scikit-learn/issues/14485
# See https://github.com/librosa/librosa/issues/1160
'nsynth': ['crepe>=0.0.11', 'librosa', 'scikit-learn==0.20.3'],
'ogbg_molpcba': ['pandas', 'networkx'],
'pet_finder': ['pandas'],
'robonet': ['h5py'], # and ffmpeg installed
# envlogger is not available for Python versions >= 3.11 or non Linux
# platforms: https://pypi.org/project/envlogger/#files
'locomotion': ['envlogger;python_version<"3.11" and sys_platform=="linux"'],
'robosuite_panda_pick_place_can': [
'envlogger;python_version<"3.11" and sys_platform=="linux"'
],
'smartwatch_gestures': ['pandas'],
'svhn': ['scipy'],
'the300w_lp': ['scipy'],
'wider_face': ['Pillow'],
'wiki_dialog': ['apache-beam'],
'wikipedia': ['apache-beam', 'mwparserfromhell', 'mwxml'],
'wsc273': ['bs4', 'lxml'],
'youtube_vis': ['pycocotools'],
}
# Those datasets have dependencies which conflict with the rest of TFDS, so
# running them in an isolated environments.
ISOLATED_DATASETS = ('nsynth', 'lsun')
# Extra dataset deps are required for the tests
all_dataset_dependencies = list(
itertools.chain.from_iterable(
deps
for ds_name, deps in DATASET_EXTRAS.items()
if ds_name not in ISOLATED_DATASETS
)
)
TESTS_ALL_DEPENDENCIES = TESTS_DEPENDENCIES + all_dataset_dependencies
# `datasets` needs to be installed separately in Python >= 3.10 due to
# conflicts between `multiprocess` and `apache-beam` libraries. See
# https://github.com/uqfoundation/multiprocess/issues/125
HUGGINGFACE_ALL_DEPENDENCIES = [
dep for dep in TESTS_ALL_DEPENDENCIES if not dep.startswith('apache-beam')
] + ['datasets']
EXTRAS = {
'matplotlib': ['matplotlib'],
'tensorflow': ['tensorflow>=2.1'],
'tf-nightly': ['tf-nightly'],
'tensorflow-data-validation': ['tensorflow-data-validation'],
'tests-all': TESTS_ALL_DEPENDENCIES,
'dev': TESTS_DEPENDENCIES + DEV_DEPENDENCIES,
'huggingface': HUGGINGFACE_ALL_DEPENDENCIES,
}
EXTRAS.update(DATASET_EXTRAS)
setuptools.setup(
name=project_name,
version=__version__,
description=DOCLINES[0],
long_description='\n'.join(DOCLINES[2:]),
author='Google Inc.',
author_email='[email protected]',
url='https://github.com/tensorflow/datasets',
download_url='https://github.com/tensorflow/datasets/tags',
license='Apache 2.0',
packages=setuptools.find_packages(),
package_data={
'tensorflow_datasets': DATASET_FILES + [
# Bundle `datasets/` folder in PyPI releases
'datasets/*/*',
'core/utils/colormap.csv',
'scripts/documentation/templates/*',
'url_checksums/*',
'checksums.tsv',
'community-datasets.toml',
'dataset_collections/*/*.md',
'dataset_collections/*/*.bib',
'core/valid_tags.txt',
],
},
exclude_package_data={
'tensorflow_datasets': [
'dummy_data/*',
],
},
scripts=[],
install_requires=REQUIRED_PKGS,
python_requires='>=3.10',
extras_require=EXTRAS,
classifiers=[
'Development Status :: 4 - Beta',
'Intended Audience :: Developers',
'Intended Audience :: Science/Research',
'License :: OSI Approved :: Apache Software License',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3 :: Only',
'Topic :: Scientific/Engineering :: Artificial Intelligence',
],
keywords='tensorflow machine learning datasets',
entry_points={
'console_scripts': [
'tfds = tensorflow_datasets.scripts.cli.main:launch_cli'
],
},
# Include_package_data is required for setup.py to recognize the MANIFEST.in
# https://python-packaging.readthedocs.io/en/latest/non-code-files.html
include_package_data=True,
)