diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000000..00edb5036a --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,16 @@ +# Copyright 2021 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 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. + +include README.md +include LICENSE diff --git a/Makefile b/Makefile new file mode 100644 index 0000000000..99e21a9e4d --- /dev/null +++ b/Makefile @@ -0,0 +1,41 @@ +# Copyright 2021 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 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. + +.PHONY: style test + +# Run code quality checks +style_check: + black --check . + isort --check . + +style: + black . + isort . + +# Run tests for the library +test: + python -m pytest tests + +# Utilities to release to PyPi +build_dist_install_tools: + pip install build + pip install twine + +build_dist: + rm -fr build + rm -fr dist + python -m build + +pypi_upload: build_dist + python -m twine upload dist/* diff --git a/README.md b/README.md new file mode 100644 index 0000000000..0f2feaa5d0 --- /dev/null +++ b/README.md @@ -0,0 +1,24 @@ +# Optimum Intel + +🤗 Optimum Intel is the interface between the 🤗 Transformers library and the different tools and libraries provided by Intel to accelerate end-to-end pipelines on Intel architectures. + +## Install +To install the latest release of this package: + +`pip install optimum[intel]` + +Optimum Intel is a fast-moving project, and you may want to install from source. + +`pip install git+https://github.com/huggingface/optimum-intel.git` + + +## Running the examples + +There are a number of examples provided in the `examples` directory. + +Please install the requirements for every example: + +``` +cd +pip install -r requirements.txt +``` diff --git a/optimum/version.py b/optimum/version.py new file mode 100644 index 0000000000..7e759f6f5c --- /dev/null +++ b/optimum/version.py @@ -0,0 +1,15 @@ +# Copyright 2022 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 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. + +__version__ = "1.2.1.dev0" diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000000..b2a989ef21 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,17 @@ +# Copyright 2022 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 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. + +[tool.black] +line-length = 119 +target-version = ['py35'] diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000000..dd64bc5306 --- /dev/null +++ b/setup.cfg @@ -0,0 +1,55 @@ +[isort] +default_section = FIRSTPARTY +ensure_newline_before_comments = True +force_grid_wrap = 0 +include_trailing_comma = True +known_first_party = optimum +known_third_party = + absl + conllu + datasets + elasticsearch + fairseq + faiss-cpu + fastprogress + fire + fugashi + git + h5py + matplotlib + nltk + numpy + packaging + pandas + PIL + psutil + pytest + pytorch_lightning + rouge_score + sacrebleu + seqeval + sklearn + streamlit + tensorboardX + tensorflow + tensorflow_datasets + timeout_decorator + torch + torchaudio + torchtext + torchvision + torch_xla + tqdm + transformers + +line_length = 119 +lines_after_imports = 2 +multi_line_output = 3 +use_parentheses = True + +[flake8] +ignore = E203, E501, E741, W503, W605 +max-line-length = 119 + +[tool:pytest] +doctest_optionflags=NUMBER NORMALIZE_WHITESPACE ELLIPSIS diff --git a/setup.py b/setup.py new file mode 100644 index 0000000000..dfcc0ac5b6 --- /dev/null +++ b/setup.py @@ -0,0 +1,60 @@ +import re + +from setuptools import find_namespace_packages, setup + + +# Ensure we match the version set in optimum/intel/version.py +try: + filepath = "optimum/intel/version.py" + with open(filepath) as version_file: + (__version__,) = re.findall('__version__ = "(.*)"', version_file.read()) +except Exception as error: + assert False, "Error: Could not open '%s' due %s\n" % (filepath, error) + +INSTALL_REQUIRES = [ + "optimum", + "transformers", + "datasets", + "torch", + "sentencepiece", + "scipy", + "neural_compressor", +] + +TESTS_REQUIRE = ["pytest", "parameterized"] + +EXTRAS_REQUIRE = { + "tests": TESTS_REQUIRE, +} + +setup( + name="optimum-intel", + version=__version__, + description="Optimum Library is an extension of the Hugging Face Transformers library, providing a framework to " + "integrate third-party libraries from Hardware Partners and interface with their specific " + "functionality.", + long_description=open("README.md", "r", encoding="utf-8").read(), + long_description_content_type="text/markdown", + classifiers=[ + "Development Status :: 5 - Production/Stable", + "License :: OSI Approved :: Apache Software License", + "Intended Audience :: Developers", + "Intended Audience :: Education", + "Intended Audience :: Science/Research", + "Operating System :: OS Independent", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Topic :: Scientific/Engineering :: Artificial Intelligence", + ], + keywords="transformers, quantization, pruning, knowledge distillation, optimization, training", + url="https://www.intel.com", + author="HuggingFace Inc. Special Ops Team", + author_email="hardware@huggingface.co", + license="Apache", + packages=find_namespace_packages(include=["optimum*"]), + install_requires=INSTALL_REQUIRES, + extras_require=EXTRAS_REQUIRE, + include_package_data=True, + zip_safe=False, +)