diff --git a/.editorconfig b/.editorconfig
index b0815bbc..3fcb4be2 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -9,5 +9,5 @@ charset = utf-8
indent_style = space
indent_size = 2
-[src/openllm/cli/entrypoint.py]
+[openllm-python/src/openllm/cli/entrypoint.py]
indent_size = unset
diff --git a/.gitattributes b/.gitattributes
index 1925cb33..226718d4 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -1,10 +1,10 @@
-nightly-requirements.txt linguist-generated=true
-nightly-requirements-gpu.txt linguist-generated=true
-tests/models/__snapshots__/* linguist-generated=true
+openllm-python/tests/models/__snapshots__/* linguist-generated=true
typings/**/*.pyi linguist-generated=true
Formula/openllm.rb linguist-generated=true
-src/openllm/utils/dummy_*.py linguist-generated=true
-src/openllm/models/__init__.py linguist-generated=true
+openllm-python/src/openllm/utils/dummy_*.py linguist-generated=true
+openllm-python/src/openllm/models/__init__.py linguist-generated=true
+openllm-python/README.md linguist-generated=true
* text=auto eol=lf
# Needed for setuptools-scm-git-archive
.git_archival.txt export-subst
+openllm-python/.git_archival.txt export-subst
diff --git a/.github/actions/create_release_and_archive.sh b/.github/actions/create_release_and_archive.sh
index 30529c09..51e98f18 100755
--- a/.github/actions/create_release_and_archive.sh
+++ b/.github/actions/create_release_and_archive.sh
@@ -26,7 +26,7 @@ All available models: \`\`\`openllm models\`\`\`
To start a LLM: \`\`\`python -m openllm start opt\`\`\`
-To run OpenLLM within a container environment (requires GPUs): \`\`\`docker run --gpus all -it --entrypoint=/bin/bash -P ghcr.io/bentoml/openllm:${TAG} openllm --help\`\`\`
+To run OpenLLM within a container environment (requires GPUs): \`\`\`docker run --gpus all -it -P ghcr.io/bentoml/openllm:${TAG} start opt\`\`\`
Find more information about this release in the [CHANGELOG.md](https://github.com/bentoml/OpenLLM/blob/main/CHANGELOG.md)
diff --git a/.github/actions/release.sh b/.github/actions/release.sh
index 1b91427a..c6525d5a 100755
--- a/.github/actions/release.sh
+++ b/.github/actions/release.sh
@@ -47,11 +47,11 @@ release_package() {
local version="$1"
echo "Releasing version ${version}..."
jq --arg release_version "${version}" '.version = $release_version' < package.json > package.json.tmp && mv package.json.tmp package.json
- pushd src/openllm-node &>/dev/null
+ pushd openllm-node &>/dev/null
jq --arg release_version "${version}" '.version = $release_version' < package.json > package.json.tmp && mv package.json.tmp package.json
popd &>/dev/null
towncrier build --yes --version "${version}"
- git add CHANGELOG.md changelog.d package.json src/openllm-node/package.json
+ git add CHANGELOG.md changelog.d package.json openllm-node/package.json
git commit -S -sm "infra: prepare for release ${version} [generated] [skip ci]"
git push origin main
echo "Releasing tag ${version}..." && git tag -a "v${version}" -sm "Release ${version} [generated by GitHub Actions]"
diff --git a/assets/agent.gif b/.github/assets/agent.gif
similarity index 100%
rename from assets/agent.gif
rename to .github/assets/agent.gif
diff --git a/assets/main-banner.png b/.github/assets/main-banner.png
similarity index 100%
rename from assets/main-banner.png
rename to .github/assets/main-banner.png
diff --git a/assets/output.gif b/.github/assets/output.gif
similarity index 100%
rename from assets/output.gif
rename to .github/assets/output.gif
diff --git a/.github/dependabot.yml b/.github/dependabot.yml
index dc2ca198..9cef2e59 100644
--- a/.github/dependabot.yml
+++ b/.github/dependabot.yml
@@ -1,17 +1,3 @@
-# Copyright 2023 BentoML 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: 2
updates:
- package-ecosystem: github-actions
@@ -22,7 +8,7 @@ updates:
time: '09:00'
# maintain required dependencies
- package-ecosystem: pip
- directory: '/'
+ directory: '/openllm-python'
schedule:
interval: 'weekly'
open-pull-requests-limit: 5
diff --git a/.github/workflows/auto-bot.yml b/.github/workflows/auto-bot.yml
index 4f4cc5e0..a868079c 100644
--- a/.github/workflows/auto-bot.yml
+++ b/.github/workflows/auto-bot.yml
@@ -13,7 +13,7 @@ jobs:
if: ${{ github.actor == 'dependabot[bot]' }}
steps:
- name: Wait for tests to succeed
- uses: lewagon/wait-on-check-action@v1.3.1
+ uses: lewagon/wait-on-check-action@e106e5c43e8ca1edea6383a39a01c5ca495fd812 # ratchet:lewagon/wait-on-check-action@v1.3.1
with:
ref: ${{ github.ref }}
check-name: evergreen
diff --git a/.github/workflows/binary-releases.yml b/.github/workflows/binary-releases.yml
index fc464fa4..aa9d2c92 100644
--- a/.github/workflows/binary-releases.yml
+++ b/.github/workflows/binary-releases.yml
@@ -6,12 +6,14 @@ on:
pull_request:
branches: [main]
paths-ignore:
+ - '*.md'
- 'docs/**'
- 'bazel/**'
- 'typings/**'
- - '*.md'
- 'changelog.d/**'
- 'assets/**'
+ - 'openllm-node/**'
+ - 'Formula/**'
defaults:
run:
shell: bash --noprofile --norc -exo pipefail {0}
@@ -29,7 +31,7 @@ jobs:
runs-on: ubuntu-latest
if: ${{ github.actor != 'dependabot[bot]' }}
steps:
- - uses: actions/checkout@v3
+ - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # ratchet:actions/checkout@v3
with:
fetch-depth: 0
- name: Setup CI
@@ -41,11 +43,12 @@ jobs:
run: python -m pip install --upgrade build
- name: Build
run: python -m build
+ working-directory: ./openllm-python
- name: Upload artifacts
- uses: actions/upload-artifact@v3
+ uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # ratchet:actions/upload-artifact@v3
with:
name: binary-artefacts
- path: dist/*
+ path: openllm-python/dist/*
if-no-files-found: error
binaries:
name: ${{ matrix.job.target }} (${{ matrix.job.os }})
@@ -92,7 +95,7 @@ jobs:
PYAPP_PIP_EXTERNAL: 'true'
steps:
- name: Checkout code
- uses: actions/checkout@v3
+ uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # ratchet:actions/checkout@v3
with:
fetch-depth: 0
- name: Pull latest change
@@ -102,18 +105,18 @@ jobs:
run: >-
mkdir $PYAPP_REPO && curl -L https://github.com/ofek/pyapp/releases/download/v$PYAPP_VERSION/source.tar.gz | tar --strip-components=1 -xzf - -C $PYAPP_REPO
- name: Set up Python ${{ env.PYTHON_VERSION }}
- uses: actions/setup-python@v4
+ uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # ratchet:actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install Hatch
run: pip install -U hatch
- name: Install Rust toolchain
- uses: dtolnay/rust-toolchain@stable
+ uses: dtolnay/rust-toolchain@00b49be78f40fba4e87296b2ead62868750bdd83 # ratchet:dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.job.target }}
- name: Set up cross compiling
if: matrix.job.cross
- uses: taiki-e/install-action@v2
+ uses: taiki-e/install-action@5265bea15b0d6367d8e293f306c880f1d0271190 # ratchet:taiki-e/install-action@v2
with:
tool: cross
- name: Configure cross compiling
@@ -127,7 +130,7 @@ jobs:
fi
- name: Download Python artifacts
if: ${{ !startsWith(github.event.ref, 'refs/tags') }}
- uses: actions/download-artifact@v3
+ uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # ratchet:actions/download-artifact@v3
with:
name: binary-artefacts
path: dist
@@ -173,14 +176,14 @@ jobs:
done
- name: Upload staged archive
if: runner.os != 'Linux'
- uses: actions/upload-artifact@v3
+ uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # ratchet:actions/upload-artifact@v3
with:
name: staged-${{ runner.os }}
path: packaging/*
if-no-files-found: error
- name: Upload archive
if: runner.os == 'Linux'
- uses: actions/upload-artifact@v3
+ uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # ratchet:actions/upload-artifact@v3
with:
name: standalone
path: packaging/*
@@ -194,9 +197,9 @@ jobs:
if: ${{ github.event_name != 'pull_request' }}
steps:
- name: Checkout code
- uses: actions/checkout@v3
+ uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # ratchet:actions/checkout@v3
- name: Set up Python ${{ env.PYTHON_VERSION }}
- uses: actions/setup-python@v4
+ uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # ratchet:actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Pull latest change
@@ -204,7 +207,7 @@ jobs:
- name: Install PyOxidizer ${{ env.PYOXIDIZER_VERSION }}
run: pip install pyoxidizer==${{ env.PYOXIDIZER_VERSION }}
- name: Download staged binaries
- uses: actions/download-artifact@v3
+ uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # ratchet:actions/download-artifact@v3
with:
name: staged-${{ runner.os }}
path: archives
@@ -233,13 +236,13 @@ jobs:
mkdir installers
mv build/*/release/*/*.{exe,msi} installers
- name: Upload binaries
- uses: actions/upload-artifact@v3
+ uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # ratchet:actions/upload-artifact@v3
with:
name: standalone
path: archives/*
if-no-files-found: error
- name: Upload installers
- uses: actions/upload-artifact@v3
+ uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # ratchet:actions/upload-artifact@v3
with:
name: installers
path: installers/*
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 172a4ec9..fe5ee927 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -11,8 +11,8 @@ on:
- "main"
paths:
- ".github/workflows/build.yaml"
- - "src/openllm/bundle/oci/Dockerfile"
- - "src/openllm/**"
+ - "openllm-python/src/openllm/bundle/oci/Dockerfile"
+ - "openllm-python/src/openllm/**"
env:
LINES: 120
COLUMNS: 120
@@ -37,14 +37,14 @@ jobs:
ec2-instance-id: ${{ steps.start-ec2-runner.outputs.ec2-instance-id }}
steps:
- name: Configure AWS credentials
- uses: aws-actions/configure-aws-credentials@v2
+ uses: aws-actions/configure-aws-credentials@5fd3084fc36e372ff1fff382a39b10d03659f355 # ratchet:aws-actions/configure-aws-credentials@v2
with:
aws-access-key-id: ${{ secrets.AWS_PROD_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_PROD_SECRET_ACCESS_KEY }}
aws-region: ${{ env.AWS_REGION }}
- name: Start EC2 Runner
id: start-ec2-runner
- uses: aarnphm/ec2-github-runner@main
+ uses: aarnphm/ec2-github-runner@af796d217e24ecbbc5a2c49e780cd90616e2b962 # ratchet:aarnphm/ec2-github-runner@main
with:
mode: start
github-token: ${{ secrets.OPENLLM_PAT }}
@@ -68,15 +68,15 @@ jobs:
id-token: write
security-events: write
steps:
- - uses: actions/checkout@v3
+ - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # ratchet:actions/checkout@v3
with:
fetch-depth: 1
- name: Inject slug/short variables
- uses: rlespinasse/github-slug-action@v4.4.1
+ uses: rlespinasse/github-slug-action@102b1a064a9b145e56556e22b18b19c624538d94 # ratchet:rlespinasse/github-slug-action@v4.4.1
- name: Set up QEMU
- uses: docker/setup-qemu-action@v2.2.0
+ uses: docker/setup-qemu-action@2b82ce82d56a2a04d2637cd93a637ae1b359c0a7 # ratchet:docker/setup-qemu-action@v2.2.0
- name: Set up Docker Buildx
- uses: docker/setup-buildx-action@v2.9.1
+ uses: docker/setup-buildx-action@4c0219f9ac95b02789c1075625400b2acbff50b1 # ratchet:docker/setup-buildx-action@v2.9.1
with:
install: true
driver-opts: |
@@ -84,18 +84,18 @@ jobs:
network=host
- name: Install cosign
if: github.event_name != 'pull_request'
- uses: sigstore/cosign-installer@v3.1.1
+ uses: sigstore/cosign-installer@6e04d228eb30da1757ee4e1dd75a0ec73a653e06 # ratchet:sigstore/cosign-installer@v3.1.1
with:
cosign-release: 'v2.1.1'
- name: Login to GitHub Container Registry
- uses: docker/login-action@v2.2.0
+ uses: docker/login-action@465a07811f14bebb1938fbed4728c6a1ff8901fc # ratchet:docker/login-action@v2.2.0
if: github.event_name != 'pull_request'
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Login to public ECR
- uses: docker/login-action@v2.2.0
+ uses: docker/login-action@465a07811f14bebb1938fbed4728c6a1ff8901fc # ratchet:docker/login-action@v2.2.0
with:
registry: public.ecr.aws
username: ${{ secrets.AWS_ACCESS_KEY_ID }}
@@ -105,7 +105,7 @@ jobs:
- name: Extract metadata tags and labels on PRs
if: github.event_name == 'pull_request'
id: meta-pr
- uses: docker/metadata-action@v4.6.0
+ uses: docker/metadata-action@818d4b7b91585d195f67373fd9cb0332e31a7175 # ratchet:docker/metadata-action@v4.6.0
with:
images: |
public.ecr.aws/y5w8i4y6/bentoml/openllm
@@ -116,7 +116,7 @@ jobs:
- name: Extract metadata tags and labels for main, release or tag
if: github.event_name != 'pull_request'
id: meta
- uses: docker/metadata-action@v4.6.0
+ uses: docker/metadata-action@818d4b7b91585d195f67373fd9cb0332e31a7175 # ratchet:docker/metadata-action@v4.6.0
with:
flavor: |
latest=auto
@@ -133,13 +133,13 @@ jobs:
org.opencontainers.image.source="https://github.com/bentoml/OpenLLM"
- name: Build and push Docker image
id: build-and-push
- uses: docker/build-push-action@v4
+ uses: docker/build-push-action@2eb1c1961a95fc15694676618e422e8ba1d63825 # ratchet:docker/build-push-action@v4
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_PROD_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_PROD_SECRET_ACCESS_KEY }}
with:
context: .
- file: src/openllm/bundle/oci/Dockerfile
+ file: openllm-python/src/openllm/bundle/oci/Dockerfile
push: true
platforms: 'linux/amd64'
build-args: |
@@ -160,7 +160,7 @@ jobs:
COSIGN_EXPERIMENTAL: "true"
run: echo "${{ steps.meta.outputs.tags }}" | xargs -I {} cosign sign --yes {}@${{ steps.build-and-push.outputs.digest }}
- name: Run Trivy in GitHub SBOM mode and submit results to Dependency Graph
- uses: aquasecurity/trivy-action@master
+ uses: aquasecurity/trivy-action@559eb1224e654a86c844a795e6702a0742c60c72 # ratchet:aquasecurity/trivy-action@master
if: ${{ github.event_name != 'pull_request' }}
with:
image-ref: 'ghcr.io/bentoml/openllm:sha-${{ env.GITHUB_SHA_SHORT }}'
@@ -169,7 +169,7 @@ jobs:
github-pat: ${{ secrets.GITHUB_TOKEN }}
scanners: 'vuln'
- name: Run Trivy vulnerability scanner
- uses: aquasecurity/trivy-action@master
+ uses: aquasecurity/trivy-action@559eb1224e654a86c844a795e6702a0742c60c72 # ratchet:aquasecurity/trivy-action@master
if: ${{ github.event_name != 'pull_request' }}
with:
image-ref: 'ghcr.io/bentoml/openllm:sha-${{ env.GITHUB_SHA_SHORT }}'
@@ -178,7 +178,7 @@ jobs:
severity: 'CRITICAL'
scanners: 'vuln'
- name: Upload Trivy scan results to GitHub Security tab
- uses: github/codeql-action/upload-sarif@v2
+ uses: github/codeql-action/upload-sarif@a09933a12a80f87b87005513f0abb1494c27a716 # ratchet:github/codeql-action/upload-sarif@v2
if: ${{ github.event_name != 'pull_request' }}
with:
sarif_file: 'trivy-results.sarif'
@@ -192,13 +192,13 @@ jobs:
if: ${{ always() }} # required to stop the runner even if the error happened in the previous jobs
steps:
- name: Configure AWS credentials
- uses: aws-actions/configure-aws-credentials@v2
+ uses: aws-actions/configure-aws-credentials@5fd3084fc36e372ff1fff382a39b10d03659f355 # ratchet:aws-actions/configure-aws-credentials@v2
with:
aws-access-key-id: ${{ secrets.AWS_PROD_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_PROD_SECRET_ACCESS_KEY }}
aws-region: ${{ env.AWS_REGION }}
- name: Stop EC2 runner
- uses: aarnphm/ec2-github-runner@main
+ uses: aarnphm/ec2-github-runner@af796d217e24ecbbc5a2c49e780cd90616e2b962 # ratchet:aarnphm/ec2-github-runner@main
with:
mode: stop
github-token: ${{ secrets.OPENLLM_PAT }}
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 0c27ae8a..f86b2c91 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -34,7 +34,7 @@ jobs:
runs-on: ubuntu-latest
name: code-quality
steps:
- - uses: actions/checkout@v3
+ - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # ratchet:actions/checkout@v3
with:
fetch-depth: 0
- name: Setup CI
@@ -42,8 +42,8 @@ jobs:
with:
python-version: ${{ env.STABLE_PYTHON_VERSION }}
- name: Install OpenLLM
- run: pip install -e .
- - uses: pre-commit/action@v3.0.0
+ run: pip install -e ./openllm-python
+ - uses: pre-commit/action@646c83fcd040023954eafda54b4db0192ce70507 # ratchet:pre-commit/action@v3.0.0
with:
extra_args: --verbose
tests:
@@ -58,7 +58,7 @@ jobs:
- os: 'windows-latest'
name: tests (${{ matrix.python-version }}.${{ matrix.os }})
steps:
- - uses: actions/checkout@v3
+ - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # ratchet:actions/checkout@v3
with:
fetch-depth: 0
- name: Setup CI
@@ -70,17 +70,18 @@ jobs:
- name: Disambiguate coverage filename
run: mv .coverage ".coverage.${{ matrix.os }}.${{ matrix.python-version }}"
- name: Upload coverage data
- uses: actions/upload-artifact@v3
+ uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # ratchet:actions/upload-artifact@v3
with:
name: coverage-data
path: .coverage.*
coverage:
name: report-coverage
runs-on: ubuntu-latest
+ if: false
needs:
- tests
steps:
- - uses: actions/checkout@v3
+ - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # ratchet:actions/checkout@v3
with:
fetch-depth: 0
- name: Setup CI
@@ -88,17 +89,17 @@ jobs:
with:
python-version: ${{ env.STABLE_PYTHON_VERSION }}
- name: Download coverage data
- uses: actions/download-artifact@v3
+ uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # ratchet:actions/download-artifact@v3
with:
name: coverage-data
- name: Combine coverage data
run: hatch run coverage:combine
- name: Export coverage reports
run: |
- hatch run coverage:report-xml
- hatch run coverage:report-uncovered-html
+ hatch run coverage:report-xml openllm-python
+ hatch run coverage:report-uncovered-html openllm-python
- name: Upload uncovered HTML report
- uses: actions/upload-artifact@v3
+ uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # ratchet:actions/upload-artifact@v3
with:
name: uncovered-html-report
path: htmlcov
@@ -109,7 +110,7 @@ jobs:
run: hatch run coverage:write-summary-report
- name: Update coverage pull request comment
if: github.event_name == 'pull_request' && !github.event.pull_request.head.repo.fork
- uses: marocchino/sticky-pull-request-comment@v2
+ uses: marocchino/sticky-pull-request-comment@f6a2580ed520ae15da6076e7410b088d1c5dddd9 # ratchet:marocchino/sticky-pull-request-comment@v2
with:
path: coverage-report.md
cli-benchmark:
@@ -118,7 +119,7 @@ jobs:
env:
HYPERFINE_VERSION: '1.12.0'
steps:
- - uses: actions/checkout@v3
+ - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # ratchet:actions/checkout@v3
with:
fetch-depth: 0
- name: Install hyperfine
@@ -130,7 +131,7 @@ jobs:
with:
python-version: ${{ env.STABLE_PYTHON_VERSION }}
- name: Install self
- run: pip install .
+ run: pip install ./openllm-python
- name: Speed
run: hyperfine -m 100 --warmup 10 openllm
brew-dry-run:
@@ -146,7 +147,6 @@ jobs:
evergreen: # https://github.com/marketplace/actions/alls-green#why
if: always()
needs:
- - coverage
- tests
- quality
- cli-benchmark
@@ -154,7 +154,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Decide whether the needed jobs succeeded or failed
- uses: re-actors/alls-green@release/v1
+ uses: re-actors/alls-green@05ac9388f0aebcb5727afa17fcccfecd6f8ec5fe # ratchet:re-actors/alls-green@release/v1
with:
jobs: ${{ toJSON(needs) }}
concurrency:
diff --git a/.github/workflows/cleanup.yml b/.github/workflows/cleanup.yml
index 7b9d7051..0cab3126 100644
--- a/.github/workflows/cleanup.yml
+++ b/.github/workflows/cleanup.yml
@@ -8,7 +8,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out code
- uses: actions/checkout@v3
+ uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # ratchet:actions/checkout@v3
- name: Cleanup
run: "gh extension install actions/gh-actions-cache\n\nREPO=${{ github.repository }}\nBRANCH=\"refs/pull/${{ github.event.pull_request.number }}/merge\"\n\necho \"Fetching list of cache key\"\ncacheKeysForPR=$(gh actions-cache list -R $REPO -B $BRANCH -L 100 | cut -f 1 )\n\n## Setting this to not fail the workflow while deleting cache keys. \nset +e\necho \"Deleting caches...\"\nfor cacheKey in $cacheKeysForPR\ndo\n gh actions-cache delete $cacheKey -R $REPO -B $BRANCH --confirm\ndone\necho \"Done\"\n"
env:
diff --git a/.github/workflows/compile-pypi.yml b/.github/workflows/compile-pypi.yml
index 0aa2b985..e2e8c742 100644
--- a/.github/workflows/compile-pypi.yml
+++ b/.github/workflows/compile-pypi.yml
@@ -35,7 +35,7 @@ jobs:
name: Pure wheels and sdist distribution
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v3
+ - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # ratchet:actions/checkout@v3
with:
fetch-depth: 0
ref: '${{ inputs.tags }}'
@@ -43,15 +43,19 @@ jobs:
uses: ./.github/actions/setup-repo
- name: Build
run: hatch build
+ working-directory: openllm-python
- name: Upload artifacts
- uses: actions/upload-artifact@v3
+ uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # ratchet:actions/upload-artifact@v3
with:
name: python-artefacts
- path: dist/*
+ path: openllm-python/dist/*
if-no-files-found: error
mypyc:
name: Compiled mypyc wheels (${{ matrix.name }})
runs-on: ${{ matrix.os }}
+ defaults:
+ run:
+ working-directory: ./openllm-python
strategy:
fail-fast: false
matrix:
@@ -71,22 +75,26 @@ jobs:
name: macos-universal2
macos_arch: "universal2"
steps:
- - uses: actions/checkout@v3
+ - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # ratchet:actions/checkout@v3
with:
fetch-depth: 0
ref: '${{ inputs.tags }}'
- name: Setup CI
uses: ./.github/actions/setup-repo
with:
- python-version: 3.9
+ python-version: 3.8
- name: Build wheels via cibuildwheel
- uses: pypa/cibuildwheel@v2.15.0
+ uses: pypa/cibuildwheel@39a63b5912f086dd459cf6fcb13dcdd3fe3bc24d # ratchet:pypa/cibuildwheel@v2.15.0
+ with:
+ package-dir: openllm-python
+ config-file: pyproject.toml
env:
+ CIBW_PRERELEASE_PYTHONS: True
CIBW_BEFORE_BUILD_MACOS: "rustup target add aarch64-apple-darwin"
CIBW_ARCHS_MACOS: "${{ matrix.macos_arch }}"
MYPYPATH: /project/typings
- name: Upload wheels as workflow artifacts
- uses: actions/upload-artifact@v3
+ uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # ratchet:actions/upload-artifact@v3
with:
name: ${{ matrix.name }}-mypyc-wheels
path: ./wheelhouse/*.whl
@@ -98,27 +106,27 @@ jobs:
steps:
# NOTE: Keep this section in sync with compile-pypi.yml
- name: Download Python artifacts
- uses: actions/download-artifact@v3
+ uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # ratchet:actions/download-artifact@v3
with:
name: python-artefacts
path: dist
- name: Download Linux x86_64 compiled artifacts
- uses: actions/download-artifact@v3
+ uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # ratchet:actions/download-artifact@v3
with:
name: linux-x86_64-mypyc-wheels
path: dist
- name: Download MacOS x86_64 compiled artifacts
- uses: actions/download-artifact@v3
+ uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # ratchet:actions/download-artifact@v3
with:
name: macos-x86_64-mypyc-wheels
path: dist
- name: Download MacOS arm64 compiled artifacts
- uses: actions/download-artifact@v3
+ uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # ratchet:actions/download-artifact@v3
with:
name: macos-arm64-mypyc-wheels
path: dist
- name: Download MacOS universal2 compiled artifacts
- uses: actions/download-artifact@v3
+ uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # ratchet:actions/download-artifact@v3
with:
name: macos-universal2-mypyc-wheels
path: dist
@@ -134,7 +142,7 @@ jobs:
success: ${{ steps.everygreen.outputs.success }}
steps:
- name: Decide whether the needed jobs succeeded or failed
- uses: re-actors/alls-green@release/v1
+ uses: re-actors/alls-green@05ac9388f0aebcb5727afa17fcccfecd6f8ec5fe # ratchet:re-actors/alls-green@release/v1
id: evergreen
with:
jobs: ${{ toJSON(needs) }}
diff --git a/.github/workflows/create-releases.yml b/.github/workflows/create-releases.yml
index 276a72cf..aef5c489 100644
--- a/.github/workflows/create-releases.yml
+++ b/.github/workflows/create-releases.yml
@@ -30,7 +30,7 @@ jobs:
outputs:
version: ${{ steps.version.outputs.version }}
steps:
- - uses: actions/checkout@v3
+ - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # ratchet:actions/checkout@v3
with:
fetch-depth: 0
token: ${{ secrets.OPENLLM_PAT }}
@@ -40,7 +40,7 @@ jobs:
python-version: '3.11'
- name: Import bot's GPG key for signing commits
id: import-gpg
- uses: crazy-max/ghaction-import-gpg@v5
+ uses: crazy-max/ghaction-import-gpg@72b6676b71ab476b77e676928516f6982eef7a41 # ratchet:crazy-max/ghaction-import-gpg@v5
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.GPG_PASSPHRASE }}
@@ -68,7 +68,7 @@ jobs:
needs:
- release
name: Compile PyPI distribution for OpenLLM
- uses: bentoml/OpenLLM/.github/workflows/compile-pypi.yml@main
+ uses: bentoml/OpenLLM/.github/workflows/compile-pypi.yml@2d33100d729008e322209b090f9dcbb40840b5f4 # ratchet:bentoml/OpenLLM/.github/workflows/compile-pypi.yml@main
with:
tags: ${{ needs.release.outputs.version }}
publish-python:
@@ -78,38 +78,40 @@ jobs:
permissions:
id-token: write
steps:
- - uses: actions/checkout@v3
+ - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # ratchet:actions/checkout@v3
with:
ref: '${{ needs.release.outputs.version }}'
token: ${{ secrets.OPENLLM_PAT }}
# NOTE: Keep this section in sync with compile-pypi.yml
- name: Download Python artifacts
- uses: actions/download-artifact@v3
+ uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # ratchet:actions/download-artifact@v3
with:
name: python-artefacts
path: dist
- name: Download Linux x86_64 compiled artifacts
- uses: actions/download-artifact@v3
+ uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # ratchet:actions/download-artifact@v3
with:
name: linux-x86_64-mypyc-wheels
path: dist
- name: Download MacOS x86_64 compiled artifacts
- uses: actions/download-artifact@v3
+ uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # ratchet:actions/download-artifact@v3
with:
name: macos-x86_64-mypyc-wheels
path: dist
- name: Download MacOS arm64 compiled artifacts
- uses: actions/download-artifact@v3
+ uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # ratchet:actions/download-artifact@v3
with:
name: macos-arm64-mypyc-wheels
path: dist
- name: Download MacOS universal2 compiled artifacts
- uses: actions/download-artifact@v3
+ uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # ratchet:actions/download-artifact@v3
with:
name: macos-universal2-mypyc-wheels
path: dist
+ - name: Smoke test compiled artefacts
+ run: ls -R dist
- name: Publish to PyPI
- uses: pypa/gh-action-pypi-publish@release/v1
+ uses: pypa/gh-action-pypi-publish@b7f401de30cb6434a1e19f805ff006643653240e # ratchet:pypa/gh-action-pypi-publish@release/v1
with:
print-hash: true
prepare-next-dev-cycle:
@@ -122,18 +124,18 @@ jobs:
contents: write
id-token: write
steps:
- - uses: actions/checkout@v3
+ - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # ratchet:actions/checkout@v3
with:
fetch-depth: 0
- name: Setup python
- uses: actions/setup-python@v4
+ uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # ratchet:actions/setup-python@v4
- name: Install dependencies
run: pip install hatch towncrier
- name: Install jq and curl
run: sudo apt-get install -y jq curl
- name: Import bot's GPG key for signing commits
id: import-gpg-key
- uses: crazy-max/ghaction-import-gpg@v5
+ uses: crazy-max/ghaction-import-gpg@72b6676b71ab476b77e676928516f6982eef7a41 # ratchet:crazy-max/ghaction-import-gpg@v5
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.GPG_PASSPHRASE }}
@@ -162,16 +164,16 @@ jobs:
DEV_VERSION="$VNUM1.$VNUM2.$VNUM3.dev0"
echo "Bumping version to ${DEV_VERSION}..."
jq --arg release_version "${DEV_VERSION}" '.version = $release_version' < package.json > package.json.tmp && mv package.json.tmp package.json
- pushd src/openllm-node &>/dev/null
+ pushd openllm-node &>/dev/null
jq --arg release_version "${DEV_VERSION}" '.version = $release_version' < package.json > package.json.tmp && mv package.json.tmp package.json
popd &>/dev/null
- git add package.json src/openllm-node/package.json && git commit -S -sm "infra: bump to dev version of ${DEV_VERSION} [generated] [skip ci]"
+ git add package.json openllm-node/package.json && git commit -S -sm "infra: bump to dev version of ${DEV_VERSION} [generated] [skip ci]"
git push origin HEAD:main
binary-distribution:
if: github.repository_owner == 'bentoml'
needs: compile-pypi
name: Create binary/wheels distribution
- uses: bentoml/OpenLLM/.github/workflows/binary-releases.yml@main
+ uses: bentoml/OpenLLM/.github/workflows/binary-releases.yml@2d33100d729008e322209b090f9dcbb40840b5f4 # ratchet:bentoml/OpenLLM/.github/workflows/binary-releases.yml@main
release-notes:
if: github.repository_owner == 'bentoml'
needs:
@@ -179,7 +181,7 @@ jobs:
- publish-python
- binary-distribution
name: Create release notes and setup for next cycle
- uses: bentoml/OpenLLM/.github/workflows/release-notes.yml@main
+ uses: bentoml/OpenLLM/.github/workflows/release-notes.yml@2d33100d729008e322209b090f9dcbb40840b5f4 # ratchet:bentoml/OpenLLM/.github/workflows/release-notes.yml@main
with:
tags: ${{ needs.release.outputs.version }}
bump-homebrew-tap:
@@ -192,7 +194,7 @@ jobs:
contents: write
id-token: write
steps:
- - uses: actions/checkout@v3
+ - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # ratchet:actions/checkout@v3
with:
fetch-depth: 0
- name: Setup CI
@@ -203,7 +205,7 @@ jobs:
run: sudo apt-get install -y jq curl
- name: Import bot's GPG key for signing commits
id: import-gpg-key
- uses: crazy-max/ghaction-import-gpg@v5
+ uses: crazy-max/ghaction-import-gpg@72b6676b71ab476b77e676928516f6982eef7a41 # ratchet:crazy-max/ghaction-import-gpg@v5
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.GPG_PASSPHRASE }}
diff --git a/.github/workflows/release-notes.yml b/.github/workflows/release-notes.yml
index b0e35acf..dc4a68d1 100644
--- a/.github/workflows/release-notes.yml
+++ b/.github/workflows/release-notes.yml
@@ -24,7 +24,7 @@ jobs:
contents: write
id-token: write
steps:
- - uses: actions/checkout@v3
+ - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # ratchet:actions/checkout@v3
with:
fetch-depth: 0
ref: '${{ inputs.tags }}'
@@ -35,47 +35,47 @@ jobs:
- name: Create release notes
run: ./.github/actions/create_release_and_archive.sh ${{ inputs.tags }}
- name: Download Python artifacts
- uses: actions/download-artifact@v3
+ uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # ratchet:actions/download-artifact@v3
with:
name: python-artefacts
path: dist
- name: Download Linux x86_64 compiled artifacts
- uses: actions/download-artifact@v3
+ uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # ratchet:actions/download-artifact@v3
with:
name: linux-x86_64-mypyc-wheels
path: dist
- name: Download MacOS x86_64 compiled artifacts
- uses: actions/download-artifact@v3
+ uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # ratchet:actions/download-artifact@v3
with:
name: macos-x86_64-mypyc-wheels
path: dist
- name: Download MacOS arm64 compiled artifacts
- uses: actions/download-artifact@v3
+ uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # ratchet:actions/download-artifact@v3
with:
name: macos-arm64-mypyc-wheels
path: dist
- name: Download MacOS universal2 compiled artifacts
- uses: actions/download-artifact@v3
+ uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # ratchet:actions/download-artifact@v3
with:
name: macos-universal2-mypyc-wheels
path: dist
- name: Download binaries
- uses: actions/download-artifact@v3
+ uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # ratchet:actions/download-artifact@v3
with:
name: standalone
path: archives
- name: Download standalone MacOS
- uses: actions/download-artifact@v3
+ uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # ratchet:actions/download-artifact@v3
with:
name: staged-macOS
path: archives
- name: Download installers
- uses: actions/download-artifact@v3
+ uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # ratchet:actions/download-artifact@v3
with:
name: installers
path: installers
- name: Create release
- uses: softprops/action-gh-release@v1
+ uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # ratchet:softprops/action-gh-release@v1
with:
# Use GH feature to populate the changelog automatically
generate_release_notes: true
diff --git a/.gitignore b/.gitignore
index 45dff7a8..5496bede 100644
--- a/.gitignore
+++ b/.gitignore
@@ -141,4 +141,4 @@ pyapp
/target
.pdm-python
-/src/openllm/_version.py
+/openllm-python/src/openllm/_version.py
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 80826181..e754b4ac 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -14,7 +14,7 @@
ci:
autoupdate_schedule: weekly
- skip: [check-models-table-update, changelog-dry-run, pyright, yapf, mypy]
+ skip: [check-models-table-update, changelog-dry-run, pyright, yapf, mypy, sync-readme]
autofix_commit_msg: "ci: auto fixes from pre-commit.ci\n\nFor more information, see https://pre-commit.ci"
autoupdate_commit_msg: 'ci: pre-commit autoupdate [pre-commit.ci]'
autofix_prs: false
@@ -37,7 +37,7 @@ repos:
- id: interrogate
verbose: true
types: [python]
- exclude: ^(docs|tools|tests)
+ exclude: ^(docs|tools|openllm-python/tests)
args: [--config=pyproject.toml]
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.5.0
@@ -49,9 +49,11 @@ repos:
examples/.*|
tools/.*|
tests/.*|
- src/openllm/playground/.*|
+ openllm-python/src/openllm/playground/.*|
+ openllm-python/tests/.*|
.github/.*|
- cz.py
+ cz.py |
+ hatch_build.py
)$
additional_dependencies:
- click==8.1.3
@@ -72,7 +74,7 @@ repos:
verbose: true
exclude: |
(?x)^(
- tests/models/.*
+ openllm-python/tests/models/.*
)$
- id: check-yaml
args: ['--unsafe']
@@ -93,6 +95,12 @@ repos:
language: script
verbose: true
files: README.md
+ - id: sync-readme
+ name: sync readme with python core library
+ entry: ./tools/sync-readme
+ language: script
+ verbose: true
+ files: README.md
- id: changelog-dry-run
name: Running changelog dry-run
entry: hatch run changelog
diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md
index 48d853e5..6061e67d 100644
--- a/DEVELOPMENT.md
+++ b/DEVELOPMENT.md
@@ -65,24 +65,31 @@ Before you can start developing, you'll need to set up your environment:
This will automatically enter a virtual environment and update the relevant
dependencies.
+> [!NOTE]
+> If you want to install editable, make sure to install it from `openllm-python` folder
+
## Project Structure
Here's a high-level overview of our project structure:
-```
+```prolog
openllm/
-├── examples # Usage demonstration scripts
-├── src
-│ ├── openllm # openllm core
-│ └── openllm-node # openllm nodejs library
-├── tests # Automated Tests
-├── tools # Utilities Script
-├── typings # Typing Checking Utilities Module and Classes
-├── DEVELOPMENT.md # The project's Developer Guide
-├── LICENSE # Use terms and conditions
-├── package.json # Node.js or JavaScript dependencies
-├── pyproject.toml # Python Project Specification File (PEP 518)
-└── README.md # The project's README file
+├── ADDING_NEW_MODEL.md # How to add a new model
+├── CHANGELOG.md # Generated changelog
+├── CITATION.cff # Citation File Format
+├── DEVELOPMENT.md # The project's Developer Guide
+├── Formula # Homebrew Formula
+├── LICENSE.md # Use terms and conditions
+├── README.md # The project's README file
+├── STYLE.md # The project's Style Guide
+├── cz.py # code-golf commitizen
+├── examples # Usage demonstration scripts
+├── openllm-node # openll node library
+├── openllm-python # openllm python library
+│ └── src
+│ └── openllm # openllm core implementation
+├── pyproject.toml # Python Project Specification File (PEP 518)
+└── tools # Utilities Script
```
## Development Workflow
@@ -167,13 +174,25 @@ hatch run compile
```
> [!IMPORTANT]
-> This will compiled some performance sensitive modules with mypyc. The compiled `.so` or `.pyd` can be found
-> under `/src/openllm`. If you run into any issue, run `hatch run recompile`
+> This will compiled some performance sensitive modules with mypyc.
+> The compiled `.so` or `.pyd` can be found
+> under `/openllm-python/src/openllm`. If you run into any issue, run `hatch run recompile`
## Style
See [STYLE.md](STYLE.md) for our style guide.
+## Working with OpenLLM's CI/CD
+
+After you change or update any CI related under `.github`, run `./tools/lock-actions` to lock the action version.
+
+## Install from git archive install
+
+```bash
+pip install 'https://github.com/bentoml/OpenLLM/archive/main.tar.gz#subdirectory=openllm-python'
+```
+
+
## Releasing a New Version
To release a new version, use `./tools/run-release-action`. It requires `gh`,
diff --git a/README.md b/README.md
index adbfc459..1327dd53 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-
+
@@ -58,7 +58,7 @@ Images or deploy as serverless endpoint via
-
+
@@ -136,9 +136,9 @@ openllm start flan-t5 --model-id google/flan-t5-large
```
> [!NOTE]
-> `openllm` also supports all variants of fine-tuning weights,
-> custom model path as well as quantized weights for any of the supported models
-> as long as it can be loaded with the model architecture. Refer to
+> `openllm` also supports all variants of fine-tuning weights, custom
+> model path as well as quantized weights for any of the supported models as
+> long as it can be loaded with the model architecture. Refer to
> [supported models](https://github.com/bentoml/OpenLLM/tree/main#-supported-models)
> section for models' architecture.
@@ -532,7 +532,8 @@ client.embed("I like to eat apples")
```
> [!NOTE]
-> Currently, the following model family supports embeddings: Llama, T5 (Flan-T5, FastChat, etc.), ChatGLM
+> Currently, the following model family supports embeddings: Llama, T5
+> (Flan-T5, FastChat, etc.), ChatGLM
## ⚙️ Integrations
@@ -582,8 +583,9 @@ llm("What is the difference between a duck and a goose? And why there are so man
```
> [!IMPORTANT]
-> By default, OpenLLM use `safetensors` format for saving models. If the model doesn't support safetensors,
-> make sure to pass `serialisation="legacy"` to use the legacy PyTorch bin format.
+> By default, OpenLLM use `safetensors` format for saving models.
+> If the model doesn't support safetensors, make sure to pass
+> `serialisation="legacy"` to use the legacy PyTorch bin format.
`langchain.llms.OpenLLM` has the capability to interact with remote OpenLLM
Server. Given there is an OpenLLM server deployed elsewhere, you can connect to
@@ -638,8 +640,8 @@ agent.run("Is the following `text` positive or negative?", text="I don't like ho
```
> [!IMPORTANT]
-> Only `starcoder` is currently supported with Agent integration. The
-> example above was also run with four T4s on EC2 `g4dn.12xlarge`
+> Only `starcoder` is currently supported with Agent integration.
+> The example above was also run with four T4s on EC2 `g4dn.12xlarge`
If you want to use OpenLLM client to ask questions to the running agent, you can
also do so:
@@ -657,7 +659,7 @@ client.ask_agent(
-
+
@@ -751,7 +753,7 @@ OpenLLM collects usage data to enhance user experience and improve the product.
We only report OpenLLM's internal API calls and ensure maximum privacy by
excluding sensitive information. We will never collect user code, model data, or
stack traces. For usage tracking, check out the
-[code](./src/openllm/utils/analytics.py).
+[code](https://github.com/bentoml/OpenLLM/blob/main/openllm-python/src/openllm/utils/analytics.py).
You can opt out of usage tracking by using the `--do-not-track` CLI option:
diff --git a/compile.sh b/compile.sh
index c3e8a361..8b1e843a 100644
--- a/compile.sh
+++ b/compile.sh
@@ -1,4 +1,4 @@
#!/usr/bin/env bash
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &> /dev/null && pwd)
-HATCH_VERBOSE=3 MYPY_CONFIG_FILE_DIR="${SCRIPT_DIR}" HATCH_BUILD_HOOKS_ENABLE=1 MYPYPATH="${SCRIPT_DIR}/typings" python -m build -w -C--global-option=--verbose "$@"
+HATCH_VERBOSE=3 MYPY_CONFIG_FILE_DIR="${SCRIPT_DIR}" HATCH_BUILD_HOOKS_ENABLE=1 MYPYPATH="${SCRIPT_DIR}/typings" python -m build openllm-python -w -C--global-option=--verbose "$@"
hatch clean
diff --git a/cz.py b/cz.py
index e363e732..8068b77a 100755
--- a/cz.py
+++ b/cz.py
@@ -1,29 +1,24 @@
#!/usr/bin/env python3
from __future__ import annotations
-import itertools
-import os
-import token
-import tokenize
-
+import itertools, os, token, tokenize
from tabulate import tabulate
TOKEN_WHITELIST = [token.OP, token.NAME, token.NUMBER, token.STRING]
-
-if __name__ == "__main__":
+def main() -> int:
headers = ["Name", "Lines", "Tokens/Line"]
table = []
- for path, _subdirs, files in os.walk(os.path.join("src", "openllm")):
+ for path, _, files in os.walk(os.path.join("openllm-python", "src", "openllm")):
for name in files:
if not name.endswith(".py"): continue
filepath = os.path.join(path, name)
with tokenize.open(filepath) as file_:
tokens = [t for t in tokenize.generate_tokens(file_.readline) if t.type in TOKEN_WHITELIST]
token_count, line_count = len(tokens), len(set([t.start[0] for t in tokens]))
- table.append([filepath, line_count, token_count / line_count if line_count != 0 else 0])
-
+ table.append([filepath.replace(os.path.join("openllm-python","src"), ""), line_count, token_count / line_count if line_count != 0 else 0])
print(tabulate([headers, *sorted(table, key=lambda x: -x[1])], headers="firstrow", floatfmt=".1f") + "\n")
-
for dir_name, group in itertools.groupby(sorted([(x[0].rsplit("/", 1)[0], x[1]) for x in table]), key=lambda x: x[0]):
- print(f"{dir_name:40s} : {sum([x[1] for x in group]):6d}")
-
+ print(f"{dir_name:35s} : {sum([x[1] for x in group]):6d}")
print(f"\ntotal line count: {sum([x[1] for x in table])}")
+ return 0
+
+if __name__ == "__main__": raise SystemExit(main())
diff --git a/hatch.toml b/hatch.toml
index 027abb15..6a75a848 100644
--- a/hatch.toml
+++ b/hatch.toml
@@ -5,7 +5,7 @@ content-type = "text/markdown"
text = """
-
+
-
+
An open platform for operating large language models (LLMs) in production. + Fine-tune, serve, deploy, and monitor any LLMs with ease.
+ +| Model | +Architecture | +Model Ids | +Installation | +
|---|---|---|---|
| chatglm | +ChatGLMForConditionalGeneration |
++ + + + | ++ +```bash +pip install "openllm[chatglm]" +``` + + | +
| dolly-v2 | +GPTNeoXForCausalLM |
++ + + + | ++ +```bash +pip install openllm +``` + + | +
| falcon | +FalconForCausalLM |
++ + + + | ++ +```bash +pip install "openllm[falcon]" +``` + + | +
| flan-t5 | +T5ForConditionalGeneration |
++ + + + | ++ +```bash +pip install "openllm[flan-t5]" +``` + + | +
| gpt-neox | +GPTNeoXForCausalLM |
++ + + + | ++ +```bash +pip install openllm +``` + + | +
| llama | +LlamaForCausalLM |
+
+
+
|
++ +```bash +pip install "openllm[llama]" +``` + + | +
| mpt | +MPTForCausalLM |
++ + + + | ++ +```bash +pip install "openllm[mpt]" +``` + + | +
| opt | +OPTForCausalLM |
++ + + + | ++ +```bash +pip install "openllm[opt]" +``` + + | +
| stablelm | +GPTNeoXForCausalLM |
++ + + + | ++ +```bash +pip install openllm +``` + + | +
| starcoder | +GPTBigCodeForCausalLM |
++ + + + | ++ +```bash +pip install "openllm[starcoder]" +``` + + | +
| baichuan | +BaiChuanForCausalLM |
++ + + + | ++ +```bash +pip install "openllm[baichuan]" +``` + + | +
{architecture} | \n"
- else:
- model_name = {"dolly_v2": "gpt_neox", "stablelm": "gpt_neox", "starcoder": "gpt_bigcode", "flan_t5": "t5",}.get(cfg_cls.__openllm_model_name__, cfg_cls.__openllm_model_name__)
- arch = f"{architecture} | \n"
- meta.extend([f"\n{name} | \n", arch,]) + if cfg_cls.__openllm_trust_remote_code__: arch = f"{architecture} | \n"
+ else: arch = f"{architecture} | \n"
+ meta.extend([f"\n{name} | \n", arch]) format_with_links: list[str] = [] - for lid in model_ids: - format_with_links.append(f"\n\n
| \n")
meta.append(f"\n\n{installation}\n\n | \n") meta += "