Skip to content

Commit

Permalink
Merge pull request #33 from NexaAI/ethan/cd
Browse files Browse the repository at this point in the history
Ethan/cd
  • Loading branch information
AgainstEntropy authored Aug 22, 2024
2 parents d623721 + 630977c commit e155d59
Show file tree
Hide file tree
Showing 10 changed files with 83 additions and 61 deletions.
68 changes: 68 additions & 0 deletions .github/workflows/build-wheels-cpu-macos.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Build Wheels (CPU) (MacOS)

on: workflow_dispatch

permissions:
contents: write

jobs:

build_wheels_macos:
name: Build wheels on macos-${{ matrix.os }}
runs-on: macos-${{ matrix.os }}
strategy:
matrix:
os: [12, 13, 14]

steps:
- uses: actions/checkout@v4
with:
submodules: "recursive"

# Used to host cibuildwheel
- uses: actions/setup-python@v5
with:
python-version: "3.8"
cache: "pip"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
# python -m pip install -e .
python -m pip install build wheel
- name: Build wheels
uses: pypa/[email protected]
env:
# disable repair
CIBW_REPAIR_WHEEL_COMMAND: ""
CIBW_ENVIRONMENT: CMAKE_ARGS="-DCMAKE_OSX_ARCHITECTURES=arm64;x86_64 "
CIBW_BUILD: "cp310-* cp311-* cp312-*"
MACOSX_DEPLOYMENT_TARGET: ${{ matrix.os }}
CMAKE_BUILD_PARALLEL_LEVEL: 4
with:
package-dir: .
output-dir: wheelhouse

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

release:
name: Release
needs: [build_wheels_macos]
runs-on: ubuntu-latest

steps:
- uses: actions/download-artifact@v4
with:
merge-multiple: true
path: dist

- uses: softprops/action-gh-release@v2
with:
files: dist/*
tag_name: ${{ github.ref_name }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
44 changes: 1 addition & 43 deletions .github/workflows/build-wheels-cpu.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -88,48 +88,6 @@ jobs:
name: wheels-${{ matrix.os }}
path: ./wheelhouse/*.whl

build_wheels_macos:
name: Build wheels on macos-${{ matrix.os }}
runs-on: macos-${{ matrix.os }}
strategy:
matrix:
os: [12, 13, 14]

steps:
- uses: actions/checkout@v4
with:
submodules: "recursive"

# Used to host cibuildwheel
- uses: actions/setup-python@v5
with:
python-version: "3.8"
cache: "pip"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
# python -m pip install -e .
python -m pip install build wheel
- name: Build wheels
uses: pypa/[email protected]
env:
# disable repair
CIBW_REPAIR_WHEEL_COMMAND: ""
CIBW_ENVIRONMENT: CMAKE_ARGS="-DCMAKE_OSX_ARCHITECTURES=arm64;x86_64 "
CIBW_BUILD: "cp310-* cp311-* cp312-*"
MACOSX_DEPLOYMENT_TARGET: ${{ matrix.os }}
CMAKE_BUILD_PARALLEL_LEVEL: 4
with:
package-dir: .
output-dir: wheelhouse

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

build_wheels_arm64:
name: Build arm64 wheels
runs-on: ubuntu-20.04
Expand Down Expand Up @@ -185,7 +143,7 @@ jobs:

release:
name: Release
needs: [build_wheels, build_wheels_macos, build_wheels_arm64, build_sdist]
needs: [build_wheels_linux, build_wheels_win, build_wheels_arm64, build_sdist]
runs-on: ubuntu-latest

steps:
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/build-wheels-cuda-linux.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@ jobs:
$env:VERBOSE = '1'
$env:CMAKE_BUILD_PARALLEL_LEVEL = $(nproc)
cp tomls/pyproject_cuda.toml pyproject.toml
$env:CMAKE_ARGS = '-DSD_CUBLAS=ON -DGGML_CUDA=ON -DCMAKE_CUDA_ARCHITECTURES=all'
$env:CMAKE_ARGS = $env:CMAKE_ARGS + ' -DGGML_CUDA_FORCE_MMQ=ON -DGGML_AVX2=OFF -DGGML_FMA=OFF -DGGML_F16C=OFF'
python -m build --wheel
# write the build tag to the output
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/build-wheels-cuda-win.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@ jobs:
}
$env:VERBOSE = '1'
cp tomls/pyproject_cuda.toml pyproject.toml
$env:CMAKE_ARGS = '-DSD_CUBLAS=ON -DGGML_CUDA=ON -DCMAKE_CUDA_ARCHITECTURES=all'
$env:CMAKE_ARGS = $env:CMAKE_ARGS + ' -DGGML_CUDA_FORCE_MMQ=ON -DGGML_AVX2=OFF -DGGML_FMA=OFF -DGGML_F16C=OFF'
$env:CMAKE_BUILD_PARALLEL_LEVEL = $(nproc)
python -m build --wheel
Expand Down
5 changes: 1 addition & 4 deletions .github/workflows/build-wheels-metal.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,14 @@ jobs:
# python -m pip install -e .
python -m pip install build wheel
- name: Copy pyproject.toml
run: |
cp tomls/pyproject_metal.toml pyproject.toml
- name: Build wheels
uses: pypa/[email protected]
env:
# disable repair
CIBW_REPAIR_WHEEL_COMMAND: ""
CIBW_ARCHS: "arm64"
CIBW_BUILD: "cp310-* cp311-* cp312-*"
CIBW_ENVIRONMENT: CMAKE_ARGS="-DCMAKE_OSX_ARCHITECTURES=arm64 -DCMAKE_APPLE_SILICON_PROCESSOR=arm64 -DGGML_METAL=ON -DSD_METAL=ON"
MACOSX_DEPLOYMENT_TARGET: ${{ matrix.os }}
CMAKE_BUILD_PARALLEL_LEVEL: 4
with:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/generate-index-from-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ jobs:
- name: Build
run: |
./scripts/releases-to-pep-503.sh index/whl/cpu '^[v]?[0-9]+\.[0-9]+\.[0-9]+$'
./scripts/releases-to-pep-503.sh index/whl/cu121 '^[v]?[0-9]+\.[0-9]+\.[0-9]+-cu121$'
./scripts/releases-to-pep-503.sh index/whl/cu122 '^[v]?[0-9]+\.[0-9]+\.[0-9]+-cu122$'
./scripts/releases-to-pep-503.sh index/whl/cu123 '^[v]?[0-9]+\.[0-9]+\.[0-9]+-cu123$'
# ./scripts/releases-to-pep-503.sh index/whl/cu121 '^[v]?[0-9]+\.[0-9]+\.[0-9]+-cu121$'
# ./scripts/releases-to-pep-503.sh index/whl/cu122 '^[v]?[0-9]+\.[0-9]+\.[0-9]+-cu122$'
# ./scripts/releases-to-pep-503.sh index/whl/cu123 '^[v]?[0-9]+\.[0-9]+\.[0-9]+-cu123$'
./scripts/releases-to-pep-503.sh index/whl/cu124 '^[v]?[0-9]+\.[0-9]+\.[0-9]+-cu124$'
./scripts/releases-to-pep-503.sh index/whl/metal '^[v]?[0-9]+\.[0-9]+\.[0-9]+-metal$'
- name: Upload artifact
Expand Down
4 changes: 2 additions & 2 deletions nexa/gguf/nexa_inference_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ def txt2img(self,
)
return images

def loop_txt2img(self):
def run_txt2img(self):
while True:
try:
prompt = nexa_prompt("Enter your prompt: ")
Expand Down Expand Up @@ -315,4 +315,4 @@ def run_streamlit(self, model_path: str):
if args.img2img:
inference.run_img2img()
else:
inference.loop_txt2img()
inference.run_txt2img()
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ sdist.exclude = [".github", "build", "dist", "nexa.egg-info", "dependency/llama.
build.verbose = true
cmake.build-type = "Release"
cmake.version = ">=3.16"
cmake.args = ["-DCMAKE_CXX_FLAGS=-fopenmp"]
# cmake.args = ["-DCMAKE_CXX_FLAGS=-fopenmp"]

[tool.pytest.ini_options]
testpaths = ["tests"]
7 changes: 2 additions & 5 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,13 @@ numpy>=1.20.0
diskcache>=5.6.1
jinja2>=2.11.3
librosa>=0.8.0
boto3>=1.34.148
botocore>=1.34.148
fastapi
uvicorn
pydantic
pillow
prompt_toolkit

# For onnx
optimum[onnxruntime]>=1.7.3 # for CPU version
optimum[onnxruntime] # for CPU version
diffusers # required for image generation
optuna
PyYAML
Expand All @@ -33,7 +30,7 @@ transformers
ttstokenizer

# Shared dependencies
prompt_toolkit
tqdm
importlib-metadata>=1.4.0,<7.0
tabulate
streamlit
2 changes: 1 addition & 1 deletion scripts/releases-to-pep-503.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

package_name="nexaai"
repo_name="nexaai-sdk-cpp"
repo_name="nexa-sdk"

# Get output directory or default to index/whl/cpu
output_dir=${1:-"index/whl/cpu"}
Expand Down

0 comments on commit e155d59

Please sign in to comment.