Skip to content

Commit

Permalink
release (#204)
Browse files Browse the repository at this point in the history
  • Loading branch information
IlyasMoutawwakil authored May 16, 2024
1 parent 981a175 commit 466c44a
Show file tree
Hide file tree
Showing 3 changed files with 118 additions and 3 deletions.
69 changes: 69 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: PYPI Release

on:
release:
types: [created]

jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Assert vX.X.X tag
run: |
if [[ ! $GITHUB_REF =~ ^refs/tags/v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "Tag name must be vX.X.X"
exit 1
fi
- name: Assert version in tag matches version in optimum_benchmark/version.py (__version__ = "X.X.X")
run: |
VERSION=$(echo $GITHUB_REF | sed -E 's/^refs\/tags\/v([0-9]+\.[0-9]+\.[0-9]+)$/\1/')
if [[ $(grep -E '__version__ = "[0-9]+\.[0-9]+\.[0-9]+"' optimum_benchmark/version.py) != "__version__ = \"$VERSION\"" ]]; then
echo "Version in tag does not match version in optimum_benchmark/version.py"
exit 1
fi
- name: Set up Python 3.10
uses: actions/setup-python@v3
with:
python-version: "3.10"

- name: Install requirements
run: |
pip install --upgrade pip
pip install setuptools wheel twine
- name: Build
run: |
python setup.py sdist bdist_wheel
- name: Check
run: |
twine check dist/*
- name: Assert one wheel
run: |
WHEELS=$(ls dist/*.whl)
if [ $(echo "$WHEELS" | wc -l) -ne 1 ]; then
echo "Expected one wheel, got:"
echo "$WHEELS"
exit 1
fi
- name: Install the wheel
run: |
pip install dist/*.whl
- name: Test
run: |
optimum-benchmark --config-dir examples --config-name pytorch_bert
- name: Publish
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
run: |
twine upload --repository pypi dist/*
15 changes: 15 additions & 0 deletions optimum_benchmark/version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Copyright 2024 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__ = "0.2.0"
37 changes: 34 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
import importlib.util
import os
import re
import subprocess

from setuptools import find_packages, setup

OPTIMUM_BENCHMARK_VERSION = "0.2.0"
# Ensure we match the version set in src/optimum-benchmark/version.py
try:
filepath = "optimum_benchmark/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)

MIN_OPTIMUM_VERSION = "1.16.0"
INSTALL_REQUIRES = [
Expand Down Expand Up @@ -88,9 +95,33 @@

setup(
packages=find_packages(),
name="optimum-benchmark",
version=OPTIMUM_BENCHMARK_VERSION,
install_requires=INSTALL_REQUIRES,
extras_require=EXTRAS_REQUIRE,
entry_points={"console_scripts": ["optimum-benchmark=optimum_benchmark.cli:main"]},
description="Optimum-Benchmark is a unified multi-backend utility for benchmarking "
"Transformers, Timm, Diffusers and Sentence-Transformers with full support of Optimum's "
"hardware optimizations & quantization schemes.",
long_description=open("README.md", "r", encoding="utf-8").read(),
long_description_content_type="text/markdown",
classifiers=[
"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",
"Programming Language :: Python :: 3.10",
"Topic :: Scientific/Engineering :: Artificial Intelligence",
],
keywords="benchmaek, transformers, quantization, pruning, optimization, training, inference, onnx, onnx runtime, intel, "
"habana, graphcore, neural compressor, ipex, ipu, hpu, llm-swarm, py-txi, vllm, auto-gptq, autoawq, "
"sentence-transformers, bitsandbytes, codecarbon, flash-attn, deepspeed, diffusers, timm, peft",
url="https://github.com/huggingface/optimum-benchmark",
author="HuggingFace Inc. Special Ops Team",
include_package_data=True,
name="optimum-benchmark",
version=__version__,
license="Apache",
)

0 comments on commit 466c44a

Please sign in to comment.