2021-08-31 09:08:22 +00:00
# Copyright 2021 The HuggingFace Team. All rights reserved.
2020-12-07 23:36:34 +00:00
#
# 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.
2018-12-11 11:20:22 +00:00
"""
2022-03-23 07:46:59 +00:00
Simple check list from AllenNLP repo : https : / / github . com / allenai / allennlp / blob / main / setup . py
2018-12-11 11:20:22 +00:00
To create the package for pypi .
2023-08-17 05:58:35 +00:00
1. Create the release branch named : v < RELEASE > - release , for example v4 .19 - release . For a patch release checkout the
current release branch .
2022-05-10 15:22:42 +00:00
2024-12-17 14:18:42 +00:00
If releasing on a special branch , copy the updated README . md on the main branch for the commit you will make
2022-04-28 18:17:44 +00:00
for the post - release and run ` make fix - copies ` on the main branch as well .
2021-04-08 20:13:17 +00:00
2023-08-17 05:58:35 +00:00
2. Run ` make pre - release ` ( or ` make pre - patch ` for a patch release ) and commit these changes with the message :
" Release: <VERSION> " and push .
2018-12-11 11:20:22 +00:00
2023-08-17 05:58:35 +00:00
3. Go back to the main branch and run ` make post - release ` then ` make fix - copies ` . Commit these changes with the
message " v<NEXT_VERSION>.dev.0 " and push to main .
2020-05-07 18:15:20 +00:00
2023-08-17 05:58:35 +00:00
# If you were just cutting the branch in preparation for a release, you can stop here for now.
2018-12-11 11:20:22 +00:00
2023-08-17 05:58:35 +00:00
4. Wait for the tests on the release branch to be completed and be green ( otherwise revert and fix bugs )
2021-11-03 21:45:41 +00:00
2023-08-17 05:58:35 +00:00
5. On the release branch , add a tag in git to mark the release : " git tag v<VERSION> -m ' Adds tag v<VERSION> for pypi ' "
2022-05-12 15:04:23 +00:00
Push the tag to git : git push - - tags origin v < RELEASE > - release
2018-12-11 11:20:22 +00:00
2023-08-17 05:58:35 +00:00
6. Build both the sources and the wheel . Do not change anything in setup . py between
2018-12-11 11:20:22 +00:00
creating the wheel and the source distribution ( obviously ) .
2023-05-16 18:23:10 +00:00
Run ` make build - release ` . This will build the release and do some sanity checks for you . If this ends with an error
message , you need to fix things before going further .
2023-03-29 18:05:42 +00:00
2019-09-26 11:47:58 +00:00
You should now have a / dist directory with both . whl and . tar . gz source versions .
2018-12-11 11:20:22 +00:00
2023-08-17 05:58:35 +00:00
7. Check that everything looks correct by uploading the package to the pypi test server :
2018-12-11 11:20:22 +00:00
2023-03-29 18:05:42 +00:00
twine upload dist / * - r testpypi
2018-12-11 11:20:22 +00:00
( pypi suggest using twine as other methods upload files via plaintext . )
2020-01-31 14:48:15 +00:00
You may have to specify the repository url , use the following command then :
2023-03-29 18:05:42 +00:00
twine upload dist / * - r testpypi - - repository - url = https : / / test . pypi . org / legacy /
2018-12-11 11:20:22 +00:00
Check that you can install it in a virtualenv by running :
2019-09-26 08:15:53 +00:00
pip install - i https : / / testpypi . python . org / pypi transformers
2018-12-11 11:20:22 +00:00
2021-11-03 21:45:41 +00:00
Check you can run the following commands :
2021-12-08 11:07:54 +00:00
python - c " from transformers import pipeline; classifier = pipeline( ' text-classification ' ); print(classifier( ' What a nice release ' )) "
2021-11-03 21:45:41 +00:00
python - c " from transformers import * "
2023-05-16 18:23:10 +00:00
python utils / check_build . py - - check_lib
2021-11-03 21:45:41 +00:00
2023-03-29 18:05:42 +00:00
If making a patch release , double check the bug you are patching is indeed resolved .
2023-08-17 05:58:35 +00:00
8. Upload the final version to actual pypi :
2018-12-11 11:20:22 +00:00
twine upload dist / * - r pypi
2023-08-17 05:58:35 +00:00
9. Copy the release notes from RELEASE . md to the tag in github once everything is looking hunky - dory .
2018-12-11 11:20:22 +00:00
"""
2019-12-21 14:57:32 +00:00
2020-10-27 17:54:57 +00:00
import os
2020-11-24 18:22:25 +00:00
import re
2019-12-23 19:06:39 +00:00
import shutil
from pathlib import Path
2023-04-07 19:08:44 +00:00
from setuptools import Command , find_packages , setup
2018-11-15 19:56:10 +00:00
2021-12-30 16:30:58 +00:00
2019-12-23 19:06:39 +00:00
# Remove stale transformers.egg-info directory to avoid https://github.com/pypa/pip/issues/5466
stale_egg_info = Path ( __file__ ) . parent / " transformers.egg-info "
if stale_egg_info . exists ( ) :
print (
(
" Warning: {} exists. \n \n "
" If you recently updated transformers to 3.0 or later, this is expected, \n "
" but it may prevent transformers from installing in editable mode. \n \n "
" This directory is automatically generated by Python ' s packaging tools. \n "
" I will remove it now. \n \n "
" See https://github.com/pypa/pip/issues/5466 for details. \n "
) . format ( stale_egg_info )
)
shutil . rmtree ( stale_egg_info )
2020-11-24 18:22:25 +00:00
# IMPORTANT:
# 1. all dependencies should be listed here with their version requirements if any
# 2. once modified, run: `make deps_table_update` to update src/transformers/dependency_versions_table.py
_deps = [
2023-11-22 08:40:30 +00:00
" Pillow>=10.0.1,<=15.0 " ,
2024-08-20 09:42:36 +00:00
" accelerate>=0.26.0 " ,
2023-03-02 12:30:38 +00:00
" av==9.2.0 " , # Latest version of PyAV (10.0.0) has issues with audio stream.
2023-02-16 18:27:27 +00:00
" beautifulsoup4 " ,
2024-09-06 12:24:02 +00:00
" blobfile " ,
2024-12-20 14:04:36 +00:00
" codecarbon>=2.8.1 " ,
2022-03-24 15:08:31 +00:00
" cookiecutter==1.7.3 " ,
2020-11-24 18:22:25 +00:00
" dataclasses " ,
2024-06-17 16:29:13 +00:00
" datasets!=2.5.0 " ,
2023-06-28 12:01:22 +00:00
" deepspeed>=0.9.3 " ,
2023-05-11 18:25:51 +00:00
" diffusers " ,
2022-05-20 15:00:58 +00:00
" dill<0.3.5 " ,
2022-08-01 15:14:49 +00:00
" evaluate>=0.2.0 " ,
2020-11-24 18:22:25 +00:00
" faiss-cpu " ,
" fastapi " ,
" filelock " ,
2023-07-13 11:57:30 +00:00
" flax>=0.4.1,<=0.7.0 " ,
2023-10-23 10:34:21 +00:00
" fsspec<2023.10.0 " ,
2022-02-18 09:21:30 +00:00
" ftfy " ,
2020-11-24 18:22:25 +00:00
" fugashi>=1.0 " ,
2021-07-23 12:16:04 +00:00
" GitPython<3.1.19 " ,
2024-05-06 16:01:15 +00:00
" hf-doc-builder>=0.3.0 " ,
2024-11-15 22:07:24 +00:00
" huggingface-hub>=0.24.0,<1.0 " ,
2021-01-06 17:17:24 +00:00
" importlib_metadata " ,
2020-11-24 18:22:25 +00:00
" ipadic>=1.0.0,<2.0 " ,
" isort>=5.5.4 " ,
2023-08-03 15:05:02 +00:00
" jax>=0.4.1,<=0.4.13 " ,
" jaxlib>=0.4.1,<=0.4.13 " ,
2021-04-09 18:07:47 +00:00
" jieba " ,
2024-06-24 13:42:16 +00:00
" jinja2>=3.1.0 " ,
2022-10-26 15:06:46 +00:00
" kenlm " ,
2023-10-19 13:39:31 +00:00
# Keras pin - this is to make sure Keras 3 doesn't destroy us. Remove or change when we have proper support.
2024-05-06 08:10:32 +00:00
" keras>2.9,<2.16 " ,
2024-07-01 16:39:33 +00:00
" keras-nlp>=0.3.1,<0.14.0 " , # keras-nlp 0.14 doesn't support keras 2, see pin on keras.
2023-02-16 18:27:27 +00:00
" librosa " ,
2024-09-04 16:28:08 +00:00
" nltk<=3.8.1 " ,
2024-01-10 12:39:05 +00:00
" natten>=0.14.6,<0.15.0 " ,
2024-07-18 09:26:01 +00:00
" numpy>=1.17 " ,
2020-09-01 12:27:52 +00:00
" onnxconverter-common " ,
2020-11-24 18:22:25 +00:00
" onnxruntime-tools>=1.4.2 " ,
" onnxruntime>=1.4.0 " ,
2023-05-11 18:25:51 +00:00
" opencv-python " ,
2024-08-22 14:07:47 +00:00
" optimum-benchmark>=0.3.0 " ,
2021-05-28 11:52:01 +00:00
" optuna " ,
2023-04-20 16:30:14 +00:00
" optax>=0.0.8,<=0.1.4 " ,
2021-09-06 21:19:02 +00:00
" packaging>=20.0 " ,
2020-11-24 18:22:25 +00:00
" parameterized " ,
2021-12-17 18:56:44 +00:00
" phonemizer " ,
2023-06-30 18:56:55 +00:00
" protobuf " ,
2020-11-24 18:22:25 +00:00
" psutil " ,
2021-07-12 13:55:36 +00:00
" pyyaml>=5.1 " ,
2024-01-26 16:39:33 +00:00
" pydantic " ,
2024-01-29 15:22:14 +00:00
" pytest>=7.2.0,<8.0.0 " ,
2024-12-20 11:08:12 +00:00
" pytest-asyncio " ,
2021-07-13 19:13:18 +00:00
" pytest-timeout " ,
2020-11-24 18:22:25 +00:00
" pytest-xdist " ,
2024-10-24 09:16:55 +00:00
" python>=3.9.0 " ,
2023-12-09 10:04:13 +00:00
" ray[tune]>=2.7.0 " ,
2020-11-24 18:22:25 +00:00
" regex!=2019.12.17 " ,
" requests " ,
2023-06-01 14:25:43 +00:00
" rhoknp>=1.1.0,<1.3.1 " ,
2022-05-04 08:04:10 +00:00
" rjieba " ,
2022-09-01 10:04:49 +00:00
" rouge-score!=0.0.7,!=0.0.8,!=0.1,!=0.1.1 " ,
2024-07-23 15:07:31 +00:00
" ruff==0.5.1 " ,
2021-08-10 10:27:49 +00:00
" sacrebleu>=1.4.12,<2.0.0 " ,
2020-11-24 18:22:25 +00:00
" sacremoses " ,
2024-01-23 09:28:23 +00:00
" safetensors>=0.4.1 " ,
2021-04-08 20:13:17 +00:00
" sagemaker>=2.31.0 " ,
2024-09-09 07:51:39 +00:00
" schedulefree>=1.2.6 " ,
2020-11-24 18:22:25 +00:00
" scikit-learn " ,
2024-04-23 09:42:17 +00:00
" scipy<1.13.0 " , # SciPy >= 1.13.0 is not supported with the current jax pin (`jax>=0.4.1,<=0.4.13`)
2021-09-15 13:25:03 +00:00
" sentencepiece>=0.1.91,!=0.1.92 " ,
2021-09-23 15:01:51 +00:00
" sigopt " ,
2020-11-24 18:22:25 +00:00
" starlette " ,
2023-02-16 18:27:27 +00:00
" sudachipy>=0.6.6 " ,
" sudachidict_core>=20220729 " ,
2023-10-26 16:13:19 +00:00
" tensorboard " ,
2023-03-24 14:54:06 +00:00
# TensorFlow pin. When changing this value, update examples/tensorflow/_tests_requirements.txt accordingly
2024-05-06 08:10:32 +00:00
" tensorflow-cpu>2.9,<2.16 " ,
" tensorflow>2.9,<2.16 " ,
2023-11-16 13:47:43 +00:00
" tensorflow-text<2.16 " ,
2024-05-22 08:52:59 +00:00
" tensorflow-probability<0.24 " ,
2022-01-14 17:35:39 +00:00
" tf2onnx " ,
2020-11-24 18:22:25 +00:00
" timeout-decorator " ,
2024-09-06 12:24:02 +00:00
" tiktoken " ,
2024-11-29 12:46:59 +00:00
" timm<=1.0.11 " ,
2024-12-05 14:46:02 +00:00
" tokenizers>=0.21,<0.22 " ,
2025-01-08 14:59:32 +00:00
" torch>=2.0 " ,
2024-02-06 16:21:05 +00:00
" torchaudio " ,
" torchvision " ,
2022-10-18 12:48:03 +00:00
" pyctcdecode>=0.4.0 " ,
2020-11-24 18:22:25 +00:00
" tqdm>=4.27 " ,
" unidic>=1.0.2 " ,
" unidic_lite>=1.0.7 " ,
2023-05-04 16:00:22 +00:00
" urllib3<2.0.0 " ,
2020-11-24 18:22:25 +00:00
" uvicorn " ,
2024-05-06 08:10:32 +00:00
" pytest-rich " ,
2024-09-24 13:54:07 +00:00
" libcst " ,
" rich " ,
2020-05-14 20:35:52 +00:00
]
2020-11-24 18:22:25 +00:00
2021-01-14 10:04:08 +00:00
# this is a lookup table with items like:
#
# tokenizers: "tokenizers==0.9.4"
# packaging: "packaging"
#
# some of the values are versioned whereas others aren't.
2022-09-21 14:15:31 +00:00
deps = { b : a for a , b in ( re . findall ( r " ^(([^!=<>~ ]+)(?:[!=<>~ ].*)?$) " , x ) [ 0 ] for x in _deps ) }
2020-11-24 18:22:25 +00:00
2021-01-14 10:04:08 +00:00
# since we save this data in src/transformers/dependency_versions_table.py it can be easily accessed from
# anywhere. If you need to quickly access the data from this table in a shell, you can do so easily with:
#
# python -c 'import sys; from transformers.dependency_versions_table import deps; \
# print(" ".join([ deps[x] for x in sys.argv[1:]]))' tokenizers datasets
#
# Just pass the desired package names to that script as it's shown with 2 packages above.
#
# If transformers is not yet installed and the work is done from the cloned repo remember to add `PYTHONPATH=src` to the script above
#
# You can then feed this for example to `pip`:
#
# pip install -U $(python -c 'import sys; from transformers.dependency_versions_table import deps; \
2023-02-13 18:12:14 +00:00
# print(" ".join([deps[x] for x in sys.argv[1:]]))' tokenizers datasets)
2021-01-14 10:04:08 +00:00
#
2020-11-24 18:22:25 +00:00
def deps_list ( * pkgs ) :
return [ deps [ pkg ] for pkg in pkgs ]
class DepsTableUpdateCommand ( Command ) :
"""
A custom distutils command that updates the dependency table .
usage : python setup . py deps_table_update
"""
description = " build runtime dependency table "
user_options = [
# format: (long option, short option, description).
( " dep-table-update " , None , " updates src/transformers/dependency_versions_table.py " ) ,
]
def initialize_options ( self ) :
pass
def finalize_options ( self ) :
pass
def run ( self ) :
entries = " \n " . join ( [ f ' " { k } " : " { v } " , ' for k , v in deps . items ( ) ] )
content = [
" # THIS FILE HAS BEEN AUTOGENERATED. To update: " ,
" # 1. modify the `_deps` dict in setup.py " ,
" # 2. run `make deps_table_update`` " ,
" deps = { " ,
entries ,
" } " ,
2020-12-16 12:03:32 +00:00
" " ,
2020-11-24 18:22:25 +00:00
]
target = " src/transformers/dependency_versions_table.py "
print ( f " updating { target } " )
2020-11-27 17:25:20 +00:00
with open ( target , " w " , encoding = " utf-8 " , newline = " \n " ) as f :
2020-11-24 18:22:25 +00:00
f . write ( " \n " . join ( content ) )
2023-04-06 07:53:03 +00:00
2020-11-24 18:22:25 +00:00
extras = { }
2022-12-31 06:22:26 +00:00
extras [ " ja " ] = deps_list ( " fugashi " , " ipadic " , " unidic_lite " , " unidic " , " sudachipy " , " sudachidict_core " , " rhoknp " )
2020-11-24 18:22:25 +00:00
extras [ " sklearn " ] = deps_list ( " scikit-learn " )
2022-11-29 15:02:40 +00:00
extras [ " tf " ] = deps_list ( " tensorflow " , " onnxconverter-common " , " tf2onnx " , " tensorflow-text " , " keras-nlp " )
2024-05-09 23:42:01 +00:00
extras [ " tf-cpu " ] = deps_list (
" keras " ,
" tensorflow-cpu " ,
" onnxconverter-common " ,
" tf2onnx " ,
" tensorflow-text " ,
" keras-nlp " ,
" tensorflow-probability " ,
)
2020-11-24 18:22:25 +00:00
2023-04-17 19:09:45 +00:00
extras [ " torch " ] = deps_list ( " torch " , " accelerate " )
2022-06-17 17:59:35 +00:00
extras [ " accelerate " ] = deps_list ( " accelerate " )
2020-10-27 17:54:57 +00:00
if os . name == " nt " : # windows
2020-11-24 18:22:25 +00:00
extras [ " retrieval " ] = deps_list ( " datasets " ) # faiss is not supported on windows
extras [ " flax " ] = [ ] # jax is not supported on windows
2020-10-27 18:39:49 +00:00
else :
2020-11-24 18:22:25 +00:00
extras [ " retrieval " ] = deps_list ( " faiss-cpu " , " datasets " )
2024-04-23 09:42:17 +00:00
extras [ " flax " ] = deps_list ( " jax " , " jaxlib " , " flax " , " optax " , " scipy " )
2019-12-22 19:28:26 +00:00
2020-11-24 18:22:25 +00:00
extras [ " tokenizers " ] = deps_list ( " tokenizers " )
2022-02-18 09:21:30 +00:00
extras [ " ftfy " ] = deps_list ( " ftfy " )
2020-11-24 18:22:25 +00:00
extras [ " onnxruntime " ] = deps_list ( " onnxruntime " , " onnxruntime-tools " )
2022-01-14 17:35:39 +00:00
extras [ " onnx " ] = deps_list ( " onnxconverter-common " , " tf2onnx " ) + extras [ " onnxruntime " ]
2020-11-24 18:22:25 +00:00
extras [ " modelcreation " ] = deps_list ( " cookiecutter " )
2019-12-22 19:28:26 +00:00
2021-03-30 06:28:02 +00:00
extras [ " sagemaker " ] = deps_list ( " sagemaker " )
2022-06-17 17:59:35 +00:00
extras [ " deepspeed " ] = deps_list ( " deepspeed " ) + extras [ " accelerate " ]
2021-05-28 11:52:01 +00:00
extras [ " optuna " ] = deps_list ( " optuna " )
2021-06-24 08:13:17 +00:00
extras [ " ray " ] = deps_list ( " ray[tune] " )
2021-09-23 15:01:51 +00:00
extras [ " sigopt " ] = deps_list ( " sigopt " )
2021-05-28 11:52:01 +00:00
2021-10-18 10:52:40 +00:00
extras [ " integrations " ] = extras [ " optuna " ] + extras [ " ray " ] + extras [ " sigopt " ]
2021-03-30 06:28:02 +00:00
2020-11-24 18:22:25 +00:00
extras [ " serving " ] = deps_list ( " pydantic " , " uvicorn " , " fastapi " , " starlette " )
2023-05-31 13:59:30 +00:00
extras [ " audio " ] = deps_list ( " librosa " , " pyctcdecode " , " phonemizer " , " kenlm " )
2021-12-30 16:30:58 +00:00
# `pip install ".[speech]"` is deprecated and `pip install ".[torch-speech]"` should be used instead
extras [ " speech " ] = deps_list ( " torchaudio " ) + extras [ " audio " ]
2021-08-31 09:08:22 +00:00
extras [ " torch-speech " ] = deps_list ( " torchaudio " ) + extras [ " audio " ]
extras [ " tf-speech " ] = extras [ " audio " ]
extras [ " flax-speech " ] = extras [ " audio " ]
2021-04-01 15:16:05 +00:00
extras [ " vision " ] = deps_list ( " Pillow " )
2021-06-09 15:51:13 +00:00
extras [ " timm " ] = deps_list ( " timm " )
2023-01-31 09:43:10 +00:00
extras [ " torch-vision " ] = deps_list ( " torchvision " ) + extras [ " vision " ]
2022-11-18 18:08:26 +00:00
extras [ " natten " ] = deps_list ( " natten " )
2021-06-23 06:53:09 +00:00
extras [ " codecarbon " ] = deps_list ( " codecarbon " )
2024-10-17 15:27:34 +00:00
extras [ " video " ] = deps_list ( " av " )
2022-09-30 19:32:59 +00:00
2020-11-24 18:22:25 +00:00
extras [ " sentencepiece " ] = deps_list ( " sentencepiece " , " protobuf " )
2024-09-06 12:24:02 +00:00
extras [ " tiktoken " ] = deps_list ( " tiktoken " , " blobfile " )
2020-11-24 18:22:25 +00:00
extras [ " testing " ] = (
2021-03-30 06:28:02 +00:00
deps_list (
2021-12-30 16:30:58 +00:00
" pytest " ,
2024-12-20 11:08:12 +00:00
" pytest-asyncio " ,
2024-05-06 08:10:32 +00:00
" pytest-rich " ,
2021-12-30 16:30:58 +00:00
" pytest-xdist " ,
" timeout-decorator " ,
" parameterized " ,
" psutil " ,
" datasets " ,
2022-05-20 15:00:58 +00:00
" dill " ,
2022-08-01 12:55:44 +00:00
" evaluate " ,
2021-12-30 16:30:58 +00:00
" pytest-timeout " ,
2023-11-16 16:43:19 +00:00
" ruff " ,
2021-12-30 16:30:58 +00:00
" sacrebleu " ,
" rouge-score " ,
" nltk " ,
" GitPython " ,
2022-05-04 08:04:10 +00:00
" sacremoses " ,
2022-06-17 17:59:35 +00:00
" rjieba " ,
2022-09-30 16:14:01 +00:00
" beautifulsoup4 " ,
2023-10-26 16:13:19 +00:00
" tensorboard " ,
2023-11-16 14:29:53 +00:00
" pydantic " ,
2024-03-20 15:53:42 +00:00
" sentencepiece " ,
2021-03-30 06:28:02 +00:00
)
2020-11-24 18:22:25 +00:00
+ extras [ " retrieval " ]
+ extras [ " modelcreation " ]
)
2021-04-08 22:10:44 +00:00
2022-12-16 17:23:46 +00:00
extras [ " deepspeed-testing " ] = extras [ " deepspeed " ] + extras [ " testing " ] + extras [ " optuna " ] + extras [ " sentencepiece " ]
2024-05-22 08:52:59 +00:00
extras [ " ruff " ] = deps_list ( " ruff " )
2024-09-24 13:54:07 +00:00
extras [ " quality " ] = deps_list ( " datasets " , " isort " , " ruff " , " GitPython " , " urllib3 " , " libcst " , " rich " )
2020-10-27 17:54:57 +00:00
2021-04-06 12:56:18 +00:00
extras [ " all " ] = (
extras [ " tf " ]
+ extras [ " torch " ]
+ extras [ " flax " ]
+ extras [ " sentencepiece " ]
+ extras [ " tokenizers " ]
2021-08-31 09:08:22 +00:00
+ extras [ " torch-speech " ]
2021-04-06 12:56:18 +00:00
+ extras [ " vision " ]
2021-05-28 11:52:01 +00:00
+ extras [ " integrations " ]
2021-06-09 15:51:13 +00:00
+ extras [ " timm " ]
2023-01-31 09:43:10 +00:00
+ extras [ " torch-vision " ]
2021-06-23 06:53:09 +00:00
+ extras [ " codecarbon " ]
2022-06-17 17:59:35 +00:00
+ extras [ " accelerate " ]
2022-12-08 21:22:43 +00:00
+ extras [ " video " ]
2021-04-06 12:56:18 +00:00
)
2020-10-27 17:54:57 +00:00
2021-04-08 22:10:44 +00:00
2022-03-01 13:55:11 +00:00
extras [ " dev-torch " ] = (
2022-06-17 17:59:35 +00:00
extras [ " testing " ]
+ extras [ " torch " ]
2022-03-01 13:55:11 +00:00
+ extras [ " sentencepiece " ]
+ extras [ " tokenizers " ]
+ extras [ " torch-speech " ]
+ extras [ " vision " ]
+ extras [ " integrations " ]
+ extras [ " timm " ]
2023-01-31 09:43:10 +00:00
+ extras [ " torch-vision " ]
2022-03-01 13:55:11 +00:00
+ extras [ " codecarbon " ]
+ extras [ " quality " ]
+ extras [ " ja " ]
+ extras [ " sklearn " ]
+ extras [ " modelcreation " ]
+ extras [ " onnxruntime " ]
)
extras [ " dev-tensorflow " ] = (
2022-06-17 17:59:35 +00:00
extras [ " testing " ]
+ extras [ " tf " ]
+ extras [ " sentencepiece " ]
+ extras [ " tokenizers " ]
+ extras [ " vision " ]
+ extras [ " quality " ]
+ extras [ " sklearn " ]
+ extras [ " modelcreation " ]
+ extras [ " onnx " ]
+ extras [ " tf-speech " ]
2022-03-01 13:55:11 +00:00
)
2020-11-24 18:22:25 +00:00
extras [ " dev " ] = (
2024-05-09 23:42:01 +00:00
extras [ " all " ] + extras [ " testing " ] + extras [ " quality " ] + extras [ " ja " ] + extras [ " sklearn " ] + extras [ " modelcreation " ]
2020-11-24 18:22:25 +00:00
)
2020-10-27 17:54:57 +00:00
2021-01-27 08:34:21 +00:00
extras [ " torchhub " ] = deps_list (
" filelock " ,
2021-04-21 23:17:29 +00:00
" huggingface-hub " ,
2021-01-27 08:34:21 +00:00
" importlib_metadata " ,
" numpy " ,
" packaging " ,
" protobuf " ,
" regex " ,
" requests " ,
" sentencepiece " ,
" torch " ,
" tokenizers " ,
" tqdm " ,
)
2019-12-04 05:52:23 +00:00
2023-05-11 18:25:51 +00:00
extras [ " agents " ] = deps_list (
2023-05-11 18:40:38 +00:00
" diffusers " , " accelerate " , " datasets " , " torch " , " sentencepiece " , " opencv-python " , " Pillow "
2023-05-11 18:25:51 +00:00
)
2024-05-21 13:15:19 +00:00
extras [ " benchmark " ] = deps_list ( " optimum-benchmark " )
2020-11-24 18:22:25 +00:00
# when modifying the following list, make sure to update src/transformers/dependency_versions_check.py
install_requires = [
2020-12-16 12:03:32 +00:00
deps [ " filelock " ] , # filesystem locks, e.g., to prevent parallel downloads
2021-04-21 23:12:58 +00:00
deps [ " huggingface-hub " ] ,
2020-11-24 18:22:25 +00:00
deps [ " numpy " ] ,
deps [ " packaging " ] , # utilities from PyPA to e.g., compare versions
2021-06-23 12:13:32 +00:00
deps [ " pyyaml " ] , # used for the model cards metadata
2020-12-16 12:03:32 +00:00
deps [ " regex " ] , # for OpenAI GPT
deps [ " requests " ] , # for downloading models over HTTPS
2021-01-12 23:00:22 +00:00
deps [ " tokenizers " ] ,
2023-05-23 13:16:34 +00:00
deps [ " safetensors " ] ,
2020-12-16 12:03:32 +00:00
deps [ " tqdm " ] , # progress bars in model download and training scripts
2020-11-24 18:22:25 +00:00
]
2018-11-15 19:56:10 +00:00
setup (
2019-09-26 08:15:53 +00:00
name = " transformers " ,
2025-02-07 09:32:49 +00:00
version = " 4.48.3 " , # expected format is one of x.y.z.dev0, or x.y.z.rc1 or x.y.z (no to dashes, yes to dots)
2023-04-07 19:08:44 +00:00
author = " The Hugging Face team (past and future) with the help of all our contributors (https://github.com/huggingface/transformers/graphs/contributors) " ,
author_email = " transformers@huggingface.co " ,
description = " State-of-the-art Machine Learning for JAX, PyTorch and TensorFlow " ,
long_description = open ( " README.md " , " r " , encoding = " utf-8 " ) . read ( ) ,
long_description_content_type = " text/markdown " ,
keywords = " NLP vision speech deep learning transformer pytorch tensorflow jax BERT GPT-2 Wav2Vec2 ViT " ,
license = " Apache 2.0 License " ,
url = " https://github.com/huggingface/transformers " ,
package_dir = { " " : " src " } ,
packages = find_packages ( " src " ) ,
include_package_data = True ,
2023-05-16 18:23:10 +00:00
package_data = { " " : [ " **/*.cu " , " **/*.cpp " , " **/*.cuh " , " **/*.h " , " **/*.pyx " ] } ,
2023-04-07 19:08:44 +00:00
zip_safe = False ,
2019-12-21 14:46:46 +00:00
extras_require = extras ,
2023-04-07 19:08:44 +00:00
entry_points = { " console_scripts " : [ " transformers-cli=transformers.commands.transformers_cli:main " ] } ,
2024-10-24 09:16:55 +00:00
python_requires = " >=3.9.0 " ,
2023-07-13 16:56:43 +00:00
install_requires = list ( install_requires ) ,
2023-04-07 19:08:44 +00:00
classifiers = [
" Development Status :: 5 - Production/Stable " ,
" Intended Audience :: Developers " ,
" Intended Audience :: Education " ,
" Intended Audience :: Science/Research " ,
" License :: OSI Approved :: Apache Software License " ,
" Operating System :: OS Independent " ,
" Programming Language :: Python :: 3 " ,
" Programming Language :: Python :: 3.9 " ,
" Programming Language :: Python :: 3.10 " ,
" Topic :: Scientific/Engineering :: Artificial Intelligence " ,
] ,
2020-11-24 18:22:25 +00:00
cmdclass = { " deps_table_update " : DepsTableUpdateCommand } ,
2018-11-15 19:56:10 +00:00
)
2024-05-06 08:10:32 +00:00
extras [ " tests_torch " ] = deps_list ( )
extras [ " tests_tf " ] = deps_list ( )
extras [ " tests_flax " ] = deps_list ( )
extras [ " tests_torch_and_tf " ] = deps_list ( )
extras [ " tests_torch_and_flax " ] = deps_list ( )
extras [ " tests_hub " ] = deps_list ( )
extras [ " tests_pipelines_torch " ] = deps_list ( )
extras [ " tests_pipelines_tf " ] = deps_list ( )
extras [ " tests_onnx " ] = deps_list ( )
extras [ " tests_examples_torch " ] = deps_list ( )
extras [ " tests_examples_tf " ] = deps_list ( )
extras [ " tests_custom_tokenizers " ] = deps_list ( )
extras [ " tests_exotic_models " ] = deps_list ( )
2024-05-09 23:42:01 +00:00
extras [ " consistency " ] = deps_list ( )