Skip to content

Build quantize binary in setup.py #7

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
119 changes: 0 additions & 119 deletions .github/workflows/build.yaml

This file was deleted.

73 changes: 58 additions & 15 deletions .github/workflows/pypi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,6 @@ on:
types:
- published

permissions:
# allow gh release upload
contents: write
# see https://docs.pypi.org/trusted-publishers/
id-token: write

jobs:
build-package:
name: Build and check packages
Expand All @@ -29,27 +23,73 @@ jobs:
with:
# for setuptools-scm
fetch-depth: 0
submodules: true

- uses: hynek/build-and-inspect-python-package@v2
with:
skip-wheel: 'false'

build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
# macos-13 is an intel runner, macos-14 is apple silicon
os: [ubuntu-latest, ubuntu-24.04-arm, macos-14]

steps:
- uses: actions/checkout@v4
with:
# for setuptools-scm
fetch-depth: 0
submodules: true

- name: Build wheels
uses: pypa/[email protected]

- uses: actions/upload-artifact@v4
with:
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
path: ./wheelhouse/*.whl

build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
# for setuptools-scm
fetch-depth: 0
submodules: true

- name: Build sdist
run: pipx run build --sdist

- uses: actions/upload-artifact@v4
with:
name: cibw-sdist
path: dist/*.tar.gz

publish-test-pypi:
name: Publish packages to test.pypi.org
# environment: publish-test-pypi
# TODO: move to instructlab
permissions:
id-token: write
if: |
github.repository_owner == 'tiran' && (
github.repository_owner == 'instructlab' && (
github.event.action == 'published' ||
(github.event_name == 'push' && github.ref == 'refs/heads/main')
)
runs-on: ubuntu-latest
needs: build-package
needs: [build_wheels, build_sdist]

steps:
- name: Fetch build artifacts
uses: actions/download-artifact@v4
with:
name: Packages
pattern: cibw-*
path: dist
merge-multiple: true

- name: Upload to Test PyPI
uses: pypa/gh-action-pypi-publish@release/v1
Expand All @@ -59,20 +99,23 @@ jobs:
publish-pypi:
name: Publish release to pypi.org
# environment: publish-pypi
# TODO: move to instructlab
permissions:
contents: write
id-token: write
if: |
github.repository_owner == 'tiran' && github.event.action == 'published'
github.repository_owner == 'instructlab' && github.event.action == 'published'
runs-on: ubuntu-latest
needs: build-package
needs: [build_wheels, build_sdist]

steps:
- name: Fetch build artifacts
uses: actions/download-artifact@v4
with:
name: Packages
pattern: cibw-*
path: dist
merge-multiple: true

- uses: sigstore/gh-action-sigstore-python@v2.1.1
- uses: sigstore/gh-action-sigstore-python@v3.0.0
with:
inputs: >-
./dist/*.tar.gz
Expand Down
10 changes: 6 additions & 4 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,21 @@ jobs:
- "3.10"
- "3.11"
- "3.12"
- "3.13-dev"
- "3.13"
steps:
- uses: "actions/checkout@v4"
with:
submodules: true
submodules: true
# for setuptools-scm
fetch-depth: 0

- uses: "actions/setup-python@v5"
with:
python-version: "${{ matrix.python-version }}"
allow-prereleases: true

- name: "Update pip"
run: python -m pip install --upgrade pip setuptools wheel
run: python -m pip install --upgrade pip

- name: "Install tox dependencies"
run: python -m pip install --upgrade tox tox-gh-actions
Expand All @@ -55,7 +57,7 @@ jobs:
submodules: true

- name: "Update pip"
run: python -m pip install --upgrade pip setuptools wheel
run: python -m pip install --upgrade pip

- name: "Install tox dependencies"
run: python -m pip install --upgrade tox
Expand Down
23 changes: 23 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
include tox.ini tests.py .pylintrc
recursive-include llama.cpp *
exclude llama.cpp/.git

global-exclude gguf.inp gguf.out
exclude llama.cpp/models/ggml-vocab-aquila.gguf
exclude llama.cpp/models/ggml-vocab-baichuan.gguf
exclude llama.cpp/models/ggml-vocab-bert-bge.gguf
exclude llama.cpp/models/ggml-vocab-command-r.gguf
exclude llama.cpp/models/ggml-vocab-deepseek-coder.gguf
exclude llama.cpp/models/ggml-vocab-deepseek-llm.gguf
exclude llama.cpp/models/ggml-vocab-falcon.gguf
exclude llama.cpp/models/ggml-vocab-gpt2.gguf
exclude llama.cpp/models/ggml-vocab-gpt-neox.gguf
# used in tests.py
# exclude llama.cpp/models/ggml-vocab-llama-bpe.gguf
exclude llama.cpp/models/ggml-vocab-llama-spm.gguf
exclude llama.cpp/models/ggml-vocab-mpt.gguf
exclude llama.cpp/models/ggml-vocab-phi-3.gguf
exclude llama.cpp/models/ggml-vocab-qwen2.gguf
exclude llama.cpp/models/ggml-vocab-refact.gguf
exclude llama.cpp/models/ggml-vocab-stablelm-3b-4e1t.gguf
exclude llama.cpp/models/ggml-vocab-starcoder.gguf
39 changes: 0 additions & 39 deletions Makefile

This file was deleted.

2 changes: 1 addition & 1 deletion llama.cpp
8 changes: 5 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# SPDX-License-Identifier: Apache-2.0

[build-system]
requires = ["setuptools>=64", "setuptools_scm>=8"]
requires = ["setuptools>=64", "setuptools_scm>=8", "wheel"]
build-backend = "setuptools.build_meta"

[project]
Expand Down Expand Up @@ -34,10 +34,12 @@ dynamic = ["version"]
[project.urls]
# TODO: move the project to instructlab
# homepage = "https://instructlab.io"
source = "https://github.com/tiran/instructlab-quantize"
issues = "https://github.com/tiran/instructlab-quantize/issues"
source = "https://github.com/instructlab/instructlab-quantize"
issues = "https://github.com/instructlab/instructlab-quantize/issues"

[tool.setuptools_scm]
# do not include +gREV local version, required for Test PyPI upload
local_scheme = "no-local-version"

[tool.setuptools]
package-dir = {"" = "src"}
Expand Down
Loading
Loading