# Maintainer: Butui Hu <hot123tea123@gmail.com>

_pkgname=transformers
pkgname=python-transformers
pkgver=5.14.1
pkgrel=2
pkgdesc='State-of-the-art Machine Learning for Pytorch, TensorFlow, and JAX'
arch=('any')
url='https://github.com/huggingface/transformers'
license=('Apache-2.0')
depends=(
  python-av
  python-accelerate
  python-filelock
  python-huggingface-hub
  python-numpy
  python-regex
  python-requests
  python-sacremoses
  python-safetensors
  python-scikit-learn
  python-tokenizers
  python-tqdm
  python-yaml
)
makedepends=(
  python-build
  python-installer
  python-wheel
)
optdepends=(
  python-pytorch
  python-tensorflow
)

source=("${_pkgname}-${pkgver}.tar.gz::https://github.com/huggingface/transformers/archive/refs/tags/v${pkgver}.tar.gz")
sha512sums=('518bad2585b160ddb7f4ab55ce250f067cd56eaaca6fa832d622f6e6257ddb2497463203ec7e592bc6274c04c6838c2b1630fc5eefb157e88b607d6b8f91d2b2')

prepare() {
  cd "${_pkgname}-${pkgver}"
  sed -i -E '/tokenizers/ s/,<=[^",]+//g' \
    setup.py \
    src/transformers/dependency_versions_table.py
}

build() {
  cd "${_pkgname}-${pkgver}"
  python -m build --wheel --no-isolation
}

package() {
  cd "${_pkgname}-${pkgver}"
  python -m installer --destdir="${pkgdir}" dist/*.whl
}
# vim:set ts=2 sw=2 et:
