2021-08-31 17:08:22 +08:00
# Copyright 2021 The HuggingFace Team. All rights reserved.
2020-12-08 07:36:34 +08: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 19:20:22 +08:00
"""
2022-03-23 15:46:59 +08:00
Simple check list from AllenNLP repo : https : / / github . com / allenai / allennlp / blob / main / setup . py
2018-12-11 19:20:22 +08:00
To create the package for pypi .
2023-08-17 13:58:35 +08: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 23:22:42 +08:00
2022-04-29 02:17:44 +08:00
If releasing on a special branch , copy the updated README . md on the main branch for your the commit you will make
for the post - release and run ` make fix - copies ` on the main branch as well .
2021-04-09 04:13:17 +08:00
2023-08-17 13:58:35 +08: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 19:20:22 +08:00
2023-08-17 13:58:35 +08: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-08 02:15:20 +08:00
2023-08-17 13:58:35 +08:00
# If you were just cutting the branch in preparation for a release, you can stop here for now.
2018-12-11 19:20:22 +08:00
2023-08-17 13:58:35 +08:00
4. Wait for the tests on the release branch to be completed and be green ( otherwise revert and fix bugs )
2021-11-04 05:45:41 +08:00
2023-08-17 13:58:35 +08: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 23:04:23 +08:00
Push the tag to git : git push - - tags origin v < RELEASE > - release
2018-12-11 19:20:22 +08:00
2023-08-17 13:58:35 +08:00
6. Build both the sources and the wheel . Do not change anything in setup . py between
2018-12-11 19:20:22 +08:00
creating the wheel and the source distribution ( obviously ) .
2023-05-17 02:23:10 +08: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-30 02:05:42 +08:00
2019-09-26 19:47:58 +08:00
You should now have a / dist directory with both . whl and . tar . gz source versions .
2018-12-11 19:20:22 +08:00
2023-08-17 13:58:35 +08:00
7. Check that everything looks correct by uploading the package to the pypi test server :
2018-12-11 19:20:22 +08:00
2023-03-30 02:05:42 +08:00
twine upload dist / * - r testpypi
2018-12-11 19:20:22 +08:00
( pypi suggest using twine as other methods upload files via plaintext . )
2020-01-31 22:48:15 +08:00
You may have to specify the repository url , use the following command then :
2023-03-30 02:05:42 +08:00
twine upload dist / * - r testpypi - - repository - url = https : / / test . pypi . org / legacy /
2018-12-11 19:20:22 +08:00
Check that you can install it in a virtualenv by running :
2019-09-26 16:15:53 +08:00
pip install - i https : / / testpypi . python . org / pypi transformers
2018-12-11 19:20:22 +08:00
2021-11-04 05:45:41 +08:00
Check you can run the following commands :
2021-12-08 19:07:54 +08:00
python - c " from transformers import pipeline; classifier = pipeline( ' text-classification ' ); print(classifier( ' What a nice release ' )) "
2021-11-04 05:45:41 +08:00
python - c " from transformers import * "
2023-05-17 02:23:10 +08:00
python utils / check_build . py - - check_lib
2021-11-04 05:45:41 +08:00
2023-03-30 02:05:42 +08:00
If making a patch release , double check the bug you are patching is indeed resolved .
2023-08-17 13:58:35 +08:00
8. Upload the final version to actual pypi :
2018-12-11 19:20:22 +08:00
twine upload dist / * - r pypi
2023-08-17 13:58:35 +08:00
9. Copy the release notes from RELEASE . md to the tag in github once everything is looking hunky - dory .
2018-12-11 19:20:22 +08:00
"""
2019-12-21 22:57:32 +08:00
2020-10-28 01:54:57 +08:00
import os
2020-11-25 02:22:25 +08:00
import re
2019-12-24 03:06:39 +08:00
import shutil
from pathlib import Path
2023-04-08 03:08:44 +08:00
from setuptools import Command , find_packages , setup
2018-11-16 03:56:10 +08:00
2021-12-31 00:30:58 +08:00
2019-12-24 03:06:39 +08: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-25 02:22:25 +08: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-07-03 18:24:46 +08:00
" Pillow<10.0.0 " ,
2023-06-15 00:44:09 +08:00
" accelerate>=0.20.3 " ,
2023-03-02 20:30:38 +08:00
" av==9.2.0 " , # Latest version of PyAV (10.0.0) has issues with audio stream.
2023-02-17 02:27:27 +08:00
" beautifulsoup4 " ,
2023-02-07 07:10:56 +08:00
" black~=23.1 " ,
2021-06-23 14:53:09 +08:00
" codecarbon==1.2.0 " ,
2022-03-24 23:08:31 +08:00
" cookiecutter==1.7.3 " ,
2020-11-25 02:22:25 +08:00
" dataclasses " ,
2022-09-21 21:37:53 +08:00
" datasets!=2.5.0 " ,
2022-12-09 05:22:43 +08:00
" decord==0.6.0 " ,
2023-06-28 20:01:22 +08:00
" deepspeed>=0.9.3 " ,
2023-05-12 02:25:51 +08:00
" diffusers " ,
2022-05-20 23:00:58 +08:00
" dill<0.3.5 " ,
2022-08-01 23:14:49 +08:00
" evaluate>=0.2.0 " ,
2020-11-25 02:22:25 +08:00
" faiss-cpu " ,
" fastapi " ,
" filelock " ,
2023-07-13 19:57:30 +08:00
" flax>=0.4.1,<=0.7.0 " ,
2023-10-23 18:34:21 +08:00
" fsspec<2023.10.0 " ,
2022-02-18 17:21:30 +08:00
" ftfy " ,
2020-11-25 02:22:25 +08:00
" fugashi>=1.0 " ,
2021-07-23 20:16:04 +08:00
" GitPython<3.1.19 " ,
2022-04-30 05:42:15 +08:00
" hf-doc-builder>=0.3.0 " ,
2023-09-21 20:57:36 +08:00
" huggingface-hub>=0.16.4,<1.0 " ,
2021-01-07 01:17:24 +08:00
" importlib_metadata " ,
2020-11-25 02:22:25 +08:00
" ipadic>=1.0.0,<2.0 " ,
" isort>=5.5.4 " ,
2023-08-03 23:05:02 +08:00
" jax>=0.4.1,<=0.4.13 " ,
" jaxlib>=0.4.1,<=0.4.13 " ,
2021-04-10 02:07:47 +08:00
" jieba " ,
2022-10-26 23:06:46 +08:00
" kenlm " ,
2023-10-19 21:39:31 +08:00
# Keras pin - this is to make sure Keras 3 doesn't destroy us. Remove or change when we have proper support.
" keras<2.15 " ,
2022-11-29 23:02:40 +08:00
" keras-nlp>=0.3.1 " ,
2023-02-17 02:27:27 +08:00
" librosa " ,
2021-04-09 04:13:17 +08:00
" nltk " ,
2023-03-22 05:21:34 +08:00
" natten>=0.14.6 " ,
2021-02-02 18:46:33 +08:00
" numpy>=1.17 " ,
2020-09-01 20:27:52 +08:00
" onnxconverter-common " ,
2020-11-25 02:22:25 +08:00
" onnxruntime-tools>=1.4.2 " ,
" onnxruntime>=1.4.0 " ,
2023-05-12 02:25:51 +08:00
" opencv-python " ,
2021-05-28 19:52:01 +08:00
" optuna " ,
2023-04-21 00:30:14 +08:00
" optax>=0.0.8,<=0.1.4 " ,
2021-09-07 05:19:02 +08:00
" packaging>=20.0 " ,
2020-11-25 02:22:25 +08:00
" parameterized " ,
2021-12-18 02:56:44 +08:00
" phonemizer " ,
2023-07-01 02:56:55 +08:00
" protobuf " ,
2020-11-25 02:22:25 +08:00
" psutil " ,
2021-07-12 21:55:36 +08:00
" pyyaml>=5.1 " ,
2023-07-01 06:04:03 +08:00
" pydantic<2 " ,
2023-05-12 22:35:15 +08:00
" pytest>=7.2.0 " ,
2021-07-14 03:13:18 +08:00
" pytest-timeout " ,
2020-11-25 02:22:25 +08:00
" pytest-xdist " ,
2023-06-28 13:22:39 +08:00
" python>=3.8.0 " ,
2021-06-24 16:13:17 +08:00
" ray[tune] " ,
2020-11-25 02:22:25 +08:00
" regex!=2019.12.17 " ,
" requests " ,
2023-06-01 22:25:43 +08:00
" rhoknp>=1.1.0,<1.3.1 " ,
2022-05-04 16:04:10 +08:00
" rjieba " ,
2022-09-01 18:04:49 +08:00
" rouge-score!=0.0.7,!=0.0.8,!=0.1,!=0.1.1 " ,
2023-03-30 02:07:06 +08:00
" ruff>=0.0.241,<=0.0.259 " ,
2021-08-10 18:27:49 +08:00
" sacrebleu>=1.4.12,<2.0.0 " ,
2020-11-25 02:22:25 +08:00
" sacremoses " ,
2023-05-31 23:30:39 +08:00
" safetensors>=0.3.1 " ,
2021-04-09 04:13:17 +08:00
" sagemaker>=2.31.0 " ,
2020-11-25 02:22:25 +08:00
" scikit-learn " ,
2021-09-15 21:25:03 +08:00
" sentencepiece>=0.1.91,!=0.1.92 " ,
2021-09-23 23:01:51 +08:00
" sigopt " ,
2020-11-25 02:22:25 +08:00
" starlette " ,
2023-02-17 02:27:27 +08:00
" sudachipy>=0.6.6 " ,
" sudachidict_core>=20220729 " ,
2023-10-27 00:13:19 +08:00
" tensorboard " ,
2023-03-24 22:54:06 +08:00
# TensorFlow pin. When changing this value, update examples/tensorflow/_tests_requirements.txt accordingly
2023-08-22 20:13:38 +08:00
" tensorflow-cpu>=2.6,<2.15 " ,
" tensorflow>=2.6,<2.15 " ,
" tensorflow-text<2.15 " ,
2022-01-15 01:35:39 +08:00
" tf2onnx " ,
2020-11-25 02:22:25 +08:00
" timeout-decorator " ,
2021-06-09 23:51:13 +08:00
" timm " ,
2023-11-15 17:46:02 +08:00
" tokenizers>=0.14,<0.19 " ,
2023-09-01 00:54:01 +08:00
" torch>=1.10,!=1.12.0 " ,
2021-03-11 00:12:04 +08:00
" torchaudio " ,
2023-01-31 17:43:10 +08:00
" torchvision " ,
2022-10-18 20:48:03 +08:00
" pyctcdecode>=0.4.0 " ,
2020-11-25 02:22:25 +08:00
" tqdm>=4.27 " ,
" unidic>=1.0.2 " ,
" unidic_lite>=1.0.7 " ,
2023-05-05 00:00:22 +08:00
" urllib3<2.0.0 " ,
2020-11-25 02:22:25 +08:00
" uvicorn " ,
2020-05-15 04:35:52 +08:00
]
2020-11-25 02:22:25 +08:00
2021-01-14 18:04:08 +08: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 22:15:31 +08:00
deps = { b : a for a , b in ( re . findall ( r " ^(([^!=<>~ ]+)(?:[!=<>~ ].*)?$) " , x ) [ 0 ] for x in _deps ) }
2020-11-25 02:22:25 +08:00
2021-01-14 18:04:08 +08: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-14 02:12:14 +08:00
# print(" ".join([deps[x] for x in sys.argv[1:]]))' tokenizers datasets)
2021-01-14 18:04:08 +08:00
#
2020-11-25 02:22:25 +08: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 20:03:32 +08:00
" " ,
2020-11-25 02:22:25 +08:00
]
target = " src/transformers/dependency_versions_table.py "
print ( f " updating { target } " )
2020-11-28 01:25:20 +08:00
with open ( target , " w " , encoding = " utf-8 " , newline = " \n " ) as f :
2020-11-25 02:22:25 +08:00
f . write ( " \n " . join ( content ) )
2023-04-06 15:53:03 +08:00
2020-11-25 02:22:25 +08:00
extras = { }
2022-12-31 14:22:26 +08:00
extras [ " ja " ] = deps_list ( " fugashi " , " ipadic " , " unidic_lite " , " unidic " , " sudachipy " , " sudachidict_core " , " rhoknp " )
2020-11-25 02:22:25 +08:00
extras [ " sklearn " ] = deps_list ( " scikit-learn " )
2022-11-29 23:02:40 +08:00
extras [ " tf " ] = deps_list ( " tensorflow " , " onnxconverter-common " , " tf2onnx " , " tensorflow-text " , " keras-nlp " )
extras [ " tf-cpu " ] = deps_list ( " tensorflow-cpu " , " onnxconverter-common " , " tf2onnx " , " tensorflow-text " , " keras-nlp " )
2020-11-25 02:22:25 +08:00
2023-04-18 03:09:45 +08:00
extras [ " torch " ] = deps_list ( " torch " , " accelerate " )
2022-06-18 01:59:35 +08:00
extras [ " accelerate " ] = deps_list ( " accelerate " )
2020-10-28 01:54:57 +08:00
if os . name == " nt " : # windows
2020-11-25 02:22:25 +08:00
extras [ " retrieval " ] = deps_list ( " datasets " ) # faiss is not supported on windows
extras [ " flax " ] = [ ] # jax is not supported on windows
2020-10-28 02:39:49 +08:00
else :
2020-11-25 02:22:25 +08:00
extras [ " retrieval " ] = deps_list ( " faiss-cpu " , " datasets " )
2021-06-23 20:13:32 +08:00
extras [ " flax " ] = deps_list ( " jax " , " jaxlib " , " flax " , " optax " )
2019-12-23 03:28:26 +08:00
2020-11-25 02:22:25 +08:00
extras [ " tokenizers " ] = deps_list ( " tokenizers " )
2022-02-18 17:21:30 +08:00
extras [ " ftfy " ] = deps_list ( " ftfy " )
2020-11-25 02:22:25 +08:00
extras [ " onnxruntime " ] = deps_list ( " onnxruntime " , " onnxruntime-tools " )
2022-01-15 01:35:39 +08:00
extras [ " onnx " ] = deps_list ( " onnxconverter-common " , " tf2onnx " ) + extras [ " onnxruntime " ]
2020-11-25 02:22:25 +08:00
extras [ " modelcreation " ] = deps_list ( " cookiecutter " )
2019-12-23 03:28:26 +08:00
2021-03-30 14:28:02 +08:00
extras [ " sagemaker " ] = deps_list ( " sagemaker " )
2022-06-18 01:59:35 +08:00
extras [ " deepspeed " ] = deps_list ( " deepspeed " ) + extras [ " accelerate " ]
2021-05-28 19:52:01 +08:00
extras [ " optuna " ] = deps_list ( " optuna " )
2021-06-24 16:13:17 +08:00
extras [ " ray " ] = deps_list ( " ray[tune] " )
2021-09-23 23:01:51 +08:00
extras [ " sigopt " ] = deps_list ( " sigopt " )
2021-05-28 19:52:01 +08:00
2021-10-18 18:52:40 +08:00
extras [ " integrations " ] = extras [ " optuna " ] + extras [ " ray " ] + extras [ " sigopt " ]
2021-03-30 14:28:02 +08:00
2020-11-25 02:22:25 +08:00
extras [ " serving " ] = deps_list ( " pydantic " , " uvicorn " , " fastapi " , " starlette " )
2023-05-31 21:59:30 +08:00
extras [ " audio " ] = deps_list ( " librosa " , " pyctcdecode " , " phonemizer " , " kenlm " )
2021-12-31 00:30:58 +08: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 17:08:22 +08:00
extras [ " torch-speech " ] = deps_list ( " torchaudio " ) + extras [ " audio " ]
extras [ " tf-speech " ] = extras [ " audio " ]
extras [ " flax-speech " ] = extras [ " audio " ]
2021-04-01 23:16:05 +08:00
extras [ " vision " ] = deps_list ( " Pillow " )
2021-06-09 23:51:13 +08:00
extras [ " timm " ] = deps_list ( " timm " )
2023-01-31 17:43:10 +08:00
extras [ " torch-vision " ] = deps_list ( " torchvision " ) + extras [ " vision " ]
2022-11-19 02:08:26 +08:00
extras [ " natten " ] = deps_list ( " natten " )
2021-06-23 14:53:09 +08:00
extras [ " codecarbon " ] = deps_list ( " codecarbon " )
2023-03-02 20:30:38 +08:00
extras [ " video " ] = deps_list ( " decord " , " av " )
2022-10-01 03:32:59 +08:00
2020-11-25 02:22:25 +08:00
extras [ " sentencepiece " ] = deps_list ( " sentencepiece " , " protobuf " )
extras [ " testing " ] = (
2021-03-30 14:28:02 +08:00
deps_list (
2021-12-31 00:30:58 +08:00
" pytest " ,
" pytest-xdist " ,
" timeout-decorator " ,
" parameterized " ,
" psutil " ,
" datasets " ,
2022-05-20 23:00:58 +08:00
" dill " ,
2022-08-01 20:55:44 +08:00
" evaluate " ,
2021-12-31 00:30:58 +08:00
" pytest-timeout " ,
" black " ,
" sacrebleu " ,
" rouge-score " ,
" nltk " ,
" GitPython " ,
2022-03-28 19:45:18 +08:00
" hf-doc-builder " ,
2022-06-18 01:59:35 +08:00
" protobuf " , # Can be removed once we can unpin protobuf
2022-05-04 16:04:10 +08:00
" sacremoses " ,
2022-06-18 01:59:35 +08:00
" rjieba " ,
2022-10-01 00:14:01 +08:00
" beautifulsoup4 " ,
2023-10-27 00:13:19 +08:00
" tensorboard " ,
2021-03-30 14:28:02 +08:00
)
2020-11-25 02:22:25 +08:00
+ extras [ " retrieval " ]
+ extras [ " modelcreation " ]
)
2021-04-09 06:10:44 +08:00
2022-12-17 01:23:46 +08:00
extras [ " deepspeed-testing " ] = extras [ " deepspeed " ] + extras [ " testing " ] + extras [ " optuna " ] + extras [ " sentencepiece " ]
2022-04-15 08:24:38 +08:00
2023-05-05 00:00:22 +08:00
extras [ " quality " ] = deps_list ( " black " , " datasets " , " isort " , " ruff " , " GitPython " , " hf-doc-builder " , " urllib3 " )
2020-10-28 01:54:57 +08:00
2021-04-06 20:56:18 +08:00
extras [ " all " ] = (
extras [ " tf " ]
+ extras [ " torch " ]
+ extras [ " flax " ]
+ extras [ " sentencepiece " ]
+ extras [ " tokenizers " ]
2021-08-31 17:08:22 +08:00
+ extras [ " torch-speech " ]
2021-04-06 20:56:18 +08:00
+ extras [ " vision " ]
2021-05-28 19:52:01 +08:00
+ extras [ " integrations " ]
2021-06-09 23:51:13 +08:00
+ extras [ " timm " ]
2023-01-31 17:43:10 +08:00
+ extras [ " torch-vision " ]
2021-06-23 14:53:09 +08:00
+ extras [ " codecarbon " ]
2022-06-18 01:59:35 +08:00
+ extras [ " accelerate " ]
2022-12-09 05:22:43 +08:00
+ extras [ " video " ]
2021-04-06 20:56:18 +08:00
)
2020-10-28 01:54:57 +08:00
2021-12-16 22:29:26 +08:00
# Might need to add doc-builder and some specific deps in the future
2022-03-28 19:45:18 +08:00
extras [ " docs_specific " ] = [ " hf-doc-builder " ]
2021-12-16 22:29:26 +08:00
2021-04-09 06:10:44 +08:00
# "docs" needs "all" to resolve all the references
extras [ " docs " ] = extras [ " all " ] + extras [ " docs_specific " ]
2022-03-01 21:55:11 +08:00
extras [ " dev-torch " ] = (
2022-06-18 01:59:35 +08:00
extras [ " testing " ]
+ extras [ " torch " ]
2022-03-01 21:55:11 +08:00
+ extras [ " sentencepiece " ]
+ extras [ " tokenizers " ]
+ extras [ " torch-speech " ]
+ extras [ " vision " ]
+ extras [ " integrations " ]
+ extras [ " timm " ]
2023-01-31 17:43:10 +08:00
+ extras [ " torch-vision " ]
2022-03-01 21:55:11 +08:00
+ extras [ " codecarbon " ]
+ extras [ " quality " ]
+ extras [ " ja " ]
+ extras [ " docs_specific " ]
+ extras [ " sklearn " ]
+ extras [ " modelcreation " ]
+ extras [ " onnxruntime " ]
)
extras [ " dev-tensorflow " ] = (
2022-06-18 01:59:35 +08:00
extras [ " testing " ]
+ extras [ " tf " ]
+ extras [ " sentencepiece " ]
+ extras [ " tokenizers " ]
+ extras [ " vision " ]
+ extras [ " quality " ]
+ extras [ " docs_specific " ]
+ extras [ " sklearn " ]
+ extras [ " modelcreation " ]
+ extras [ " onnx " ]
+ extras [ " tf-speech " ]
2022-03-01 21:55:11 +08:00
)
2020-11-25 02:22:25 +08:00
extras [ " dev " ] = (
extras [ " all " ]
+ extras [ " testing " ]
+ extras [ " quality " ]
+ extras [ " ja " ]
2021-04-09 06:10:44 +08:00
+ extras [ " docs_specific " ]
2020-11-25 02:22:25 +08:00
+ extras [ " sklearn " ]
+ extras [ " modelcreation " ]
)
2020-10-28 01:54:57 +08:00
2021-01-27 16:34:21 +08:00
extras [ " torchhub " ] = deps_list (
" filelock " ,
2021-04-22 07:17:29 +08:00
" huggingface-hub " ,
2021-01-27 16:34:21 +08:00
" importlib_metadata " ,
" numpy " ,
" packaging " ,
" protobuf " ,
" regex " ,
" requests " ,
" sentencepiece " ,
" torch " ,
" tokenizers " ,
" tqdm " ,
)
2019-12-04 13:52:23 +08:00
2023-05-12 02:25:51 +08:00
extras [ " agents " ] = deps_list (
2023-05-12 02:40:38 +08:00
" diffusers " , " accelerate " , " datasets " , " torch " , " sentencepiece " , " opencv-python " , " Pillow "
2023-05-12 02:25:51 +08:00
)
2020-11-25 02:22:25 +08:00
# when modifying the following list, make sure to update src/transformers/dependency_versions_check.py
install_requires = [
2020-12-16 20:03:32 +08:00
deps [ " filelock " ] , # filesystem locks, e.g., to prevent parallel downloads
2021-04-22 07:12:58 +08:00
deps [ " huggingface-hub " ] ,
2020-11-25 02:22:25 +08:00
deps [ " numpy " ] ,
deps [ " packaging " ] , # utilities from PyPA to e.g., compare versions
2021-06-23 20:13:32 +08:00
deps [ " pyyaml " ] , # used for the model cards metadata
2020-12-16 20:03:32 +08:00
deps [ " regex " ] , # for OpenAI GPT
deps [ " requests " ] , # for downloading models over HTTPS
2021-01-13 07:00:22 +08:00
deps [ " tokenizers " ] ,
2023-05-23 21:16:34 +08:00
deps [ " safetensors " ] ,
2020-12-16 20:03:32 +08:00
deps [ " tqdm " ] , # progress bars in model download and training scripts
2020-11-25 02:22:25 +08:00
]
2018-11-16 03:56:10 +08:00
setup (
2019-09-26 16:15:53 +08:00
name = " transformers " ,
2023-11-02 23:38:59 +08:00
version = " 4.36.0.dev0 " , # 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-08 03:08:44 +08: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-17 02:23:10 +08:00
package_data = { " " : [ " **/*.cu " , " **/*.cpp " , " **/*.cuh " , " **/*.h " , " **/*.pyx " ] } ,
2023-04-08 03:08:44 +08:00
zip_safe = False ,
2019-12-21 22:46:46 +08:00
extras_require = extras ,
2023-04-08 03:08:44 +08:00
entry_points = { " console_scripts " : [ " transformers-cli=transformers.commands.transformers_cli:main " ] } ,
2023-06-28 13:22:39 +08:00
python_requires = " >=3.8.0 " ,
2023-07-14 00:56:43 +08:00
install_requires = list ( install_requires ) ,
2023-04-08 03:08:44 +08: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.8 " ,
" Programming Language :: Python :: 3.9 " ,
" Programming Language :: Python :: 3.10 " ,
" Topic :: Scientific/Engineering :: Artificial Intelligence " ,
] ,
2020-11-25 02:22:25 +08:00
cmdclass = { " deps_table_update " : DepsTableUpdateCommand } ,
2018-11-16 03:56:10 +08:00
)