-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
92 changed files
with
12,568 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
* text=auto eol=lf | ||
|
||
**/go.sum linguist-generated=true | ||
**/zz_generated.*.go linguist-generated=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
name: ci | ||
|
||
permissions: | ||
contents: read | ||
pull-requests: read | ||
actions: read | ||
|
||
defaults: | ||
run: | ||
shell: bash | ||
|
||
on: | ||
push: | ||
branches: | ||
- 'main' | ||
paths-ignore: | ||
- "docs/**" | ||
- "**.md" | ||
- "**.mdx" | ||
- "**.png" | ||
- "**.jpg" | ||
- "packs/**" | ||
- ".github/workflows/pack.yml" | ||
pull_request: | ||
branches: | ||
- 'main' | ||
paths-ignore: | ||
- "docs/**" | ||
- "**.md" | ||
- "**.mdx" | ||
- "**.png" | ||
- "**.jpg" | ||
- "packs/**" | ||
- ".github/workflows/pack.yml" | ||
|
||
jobs: | ||
ci: | ||
timeout-minutes: 15 | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 1 | ||
persist-credentials: false | ||
- name: Setup Go | ||
timeout-minutes: 15 | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: "1.22.6" | ||
cache-dependency-path: | | ||
**/go.sum | ||
- name: Setup Toolbox | ||
timeout-minutes: 5 | ||
uses: actions/cache@v4 | ||
with: | ||
key: toolbox-${{ runner.os }} | ||
path: | | ||
${{ github.workspace }}/.sbin | ||
- name: Make | ||
run: make ci | ||
env: | ||
LINT_DIRTY: "true" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
name: cmd | ||
|
||
permissions: | ||
contents: write | ||
actions: read | ||
id-token: write | ||
|
||
defaults: | ||
run: | ||
shell: bash | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
paths-ignore: | ||
- "docs/**" | ||
- "**.md" | ||
- "**.mdx" | ||
- "**.png" | ||
- "**.jpg" | ||
- "packs/**" | ||
- ".github/workflows/pack.yml" | ||
tags: | ||
- "v*.*.*" | ||
|
||
jobs: | ||
build: | ||
timeout-minutes: 15 | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 1 | ||
persist-credentials: false | ||
- name: Setup Go | ||
timeout-minutes: 15 | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: "1.22.6" | ||
cache-dependency-path: | | ||
**/go.sum | ||
- name: Make | ||
run: make build | ||
env: | ||
VERSION: "${{ github.ref_name }}" | ||
- name: Upload Artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
path: ${{ github.workspace }}/.dist/* | ||
- name: Release | ||
if: ${{ startsWith(github.ref, 'refs/tags/') }} | ||
uses: softprops/action-gh-release@v2 | ||
with: | ||
fail_on_unmatched_files: true | ||
tag_name: "${{ github.ref_name }}" | ||
prerelease: ${{ contains(github.ref, 'rc') }} | ||
files: ${{ github.workspace }}/.dist/* | ||
|
||
publish: | ||
needs: | ||
- build | ||
permissions: | ||
contents: write | ||
actions: read | ||
id-token: write | ||
timeout-minutes: 15 | ||
runs-on: ubuntu-22.04 | ||
env: | ||
PACKAGE_REGISTRY: "thxcode" | ||
PACKAGE_IMAGE: "gguf-packer" | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 1 | ||
persist-credentials: false | ||
- name: Setup QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
with: | ||
image: tonistiigi/binfmt:qemu-v7.0.0 | ||
platforms: "arm64" | ||
- name: Setup Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
- name: Login DockerHub | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.CI_DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.CI_DOCKERHUB_PASSWORD }} | ||
- name: Download Artifact | ||
uses: actions/download-artifact@v4 | ||
with: | ||
path: ${{ github.workspace }}/.dist | ||
merge-multiple: true | ||
- name: Get Metadata | ||
id: metadata | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: "${{ env.PACKAGE_REGISTRY }}/${{ env.PACKAGE_IMAGE }}" | ||
- name: Package | ||
uses: docker/build-push-action@v6 | ||
with: | ||
push: true | ||
file: ${{ github.workspace }}/Dockerfile | ||
context: ${{ github.workspace }} | ||
platforms: "linux/amd64,linux/arm64" | ||
tags: ${{ steps.metadata.outputs.tags }} | ||
labels: ${{ steps.metadata.outputs.labels }} | ||
cache-from: | | ||
type=registry,ref=${{ env.PACKAGE_REGISTRY }}/${{ env.PACKAGE_IMAGE }}:build-cache | ||
cache-to: | | ||
type=registry,mode=max,oci-mediatypes=false,compression=gzip,ref=${{ env.PACKAGE_REGISTRY }}/${{ env.PACKAGE_IMAGE }}:build-cache,ignore-error=true | ||
provenance: true | ||
sbom: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
name: pack | ||
|
||
permissions: | ||
contents: write | ||
actions: read | ||
id-token: write | ||
|
||
defaults: | ||
run: | ||
shell: bash | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
model_repository: | ||
description: "Model Repository" | ||
required: true | ||
type: string | ||
default: "thxcode" | ||
model_name: | ||
description: "Model Name" | ||
required: true | ||
type: string | ||
default: "" | ||
model_tag: | ||
description: "Model Tag" | ||
required: true | ||
type: string | ||
default: "" | ||
convert_huggingface_model: | ||
description: "Convert HuggingFace Model" | ||
type: string | ||
default: "" | ||
|
||
jobs: | ||
convert: | ||
if: ${{ github.event.inputs.convert_huggingface_model != '' }} | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: Maximize Space | ||
# see https://github.com/easimon/maximize-build-space/blob/master/action.yml. | ||
run: | | ||
sudo rm -rf /usr/share/dotnet | ||
sudo rm -rf /usr/local/lib/android | ||
sudo rm -rf /opt/ghc | ||
sudo rm -rf /opt/hostedtoolcache/CodeQL | ||
sudo docker image prune --all --force | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 1 | ||
persist-credentials: false | ||
- name: Download Model | ||
env: | ||
HF_TOKEN: ${{ secrets.CI_HUGGINGFACE_TOKEN }} | ||
run: | | ||
#!/bin/bash | ||
git lfs install | ||
git clone https://thxCode:${HF_TOKEN}@huggingface.co/${{ github.event.inputs.convert_huggingface_model }} ${{ github.workspace }}/packs/model | ||
- name: Setup Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
- name: Login DockerHub | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.CI_DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.CI_DOCKERHUB_PASSWORD }} | ||
- name: Package | ||
uses: docker/build-push-action@v6 | ||
with: | ||
push: true | ||
target: convert | ||
file: "${{ github.workspace }}/packs/Dockerfile.${{ github.event.inputs.model_name }}" | ||
context: "${{ github.workspace }}/packs" | ||
tags: "${{ github.event.inputs.model_repository }}/${{ github.event.inputs.model_name }}:${{ github.event.inputs.model_tag }}-f16" | ||
cache-from: | | ||
type=registry,ref=${{ github.event.inputs.model_repository }}/build-cache:${{ github.event.inputs.model_name}}-${{ github.event.inputs.model_tag }} | ||
cache-to: | | ||
type=registry,ref=${{ github.event.inputs.model_repository }}/build-cache:${{ github.event.inputs.model_name}}-${{ github.event.inputs.model_tag }} | ||
quantize: | ||
needs: | ||
- convert | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
type: [ Q3_K_M, Q4_K_M, Q5_K_M, Q6_K, Q8_0 ] | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: Maximize Space | ||
# see https://github.com/easimon/maximize-build-space/blob/master/action.yml. | ||
run: | | ||
sudo rm -rf /usr/share/dotnet | ||
sudo rm -rf /usr/local/lib/android | ||
sudo rm -rf /opt/ghc | ||
sudo rm -rf /opt/hostedtoolcache/CodeQL | ||
sudo docker image prune --all --force | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 1 | ||
persist-credentials: false | ||
- name: Setup Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
- name: Login DockerHub | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.CI_DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.CI_DOCKERHUB_PASSWORD }} | ||
- name: Get Suffix | ||
id: suffix | ||
run: | | ||
#!/bin/bash | ||
suffix=$(echo "${QUANTIZE_TYPE}" | tr '[:upper:]' '[:lower:]' | sed 's/_/-/g') | ||
echo "value=${suffix}" >> "$GITHUB_OUTPUT" | ||
- name: Package | ||
uses: docker/build-push-action@v6 | ||
with: | ||
build-args: | | ||
QUANTIZE_TYPE=${{ matrix.type }} | ||
push: true | ||
target: quantize | ||
no-cache: true | ||
file: "${{ github.workspace }}/packs/Dockerfile.${{ github.event.inputs.model_name }}" | ||
context: "${{ github.workspace }}/packs" | ||
tags: | | ||
"${{ github.event.inputs.model_repository }}/${{ github.event.inputs.model_name }}:${{ github.event.inputs.model_tag }}-${{ steps.suffix.outputs.value }}" | ||
"${{ matrix.type == 'Q4_K_M' && format('{0}/{1}:latest', github.event.inputs.model_repository, github.event.inputs.model_name) || '' }}" | ||
cache-from: | | ||
type=registry,ref=${{ github.event.inputs.model_repository }}/build-cache:${{ github.event.inputs.model_name}}-${{ github.event.inputs.model_tag }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Files | ||
.DS_Store | ||
*.lock | ||
*.test | ||
*.out | ||
*.swp | ||
*.swo | ||
*.db | ||
*.exe | ||
*.exe~ | ||
*.dll | ||
*.so | ||
*.dylib | ||
*.log | ||
go.work | ||
go.work.* | ||
|
||
# Dirs | ||
/.idea | ||
/.vscode | ||
/.kube | ||
/.terraform | ||
/.vagrant | ||
/.bundle | ||
/.cache | ||
/.docker | ||
/.entc | ||
/.sbin | ||
/.dist | ||
/log | ||
/certs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
[submodule "examples/models/Qwen2-0.5B-Instruct"] | ||
path = examples/models/Qwen2-0.5B-Instruct | ||
url = https://huggingface.co/Qwen/Qwen2-0.5B-Instruct | ||
[submodule "examples/ggufpackerfiles/single-stage-convert-from-local/Qwen2-0.5B-Instruct"] | ||
path = examples/ggufpackerfiles/single-stage-convert-from-local/Qwen2-0.5B-Instruct | ||
url = https://huggingface.co/Qwen/Qwen2-0.5B-Instruct | ||
[submodule "examples/ggufpackerfiles/multi-stages-convert-from-local/Qwen2-0.5B-Instruct"] | ||
path = examples/ggufpackerfiles/multi-stages-convert-from-local/Qwen2-0.5B-Instruct | ||
url = https://huggingface.co/Qwen/Qwen2-0.5B-Instruct | ||
[submodule "examples/ggufpackerfiles/multi-stages/Qwen2-0.5B-Instruct"] | ||
path = examples/ggufpackerfiles/multi-stages/Qwen2-0.5B-Instruct | ||
url = https://huggingface.co/Qwen/Qwen2-0.5B-Instruct | ||
[submodule "examples/ggufpackerfiles/single-stage/Qwen2-0.5B-Instruct"] | ||
path = examples/ggufpackerfiles/single-stage/Qwen2-0.5B-Instruct | ||
url = https://huggingface.co/Qwen/Qwen2-0.5B-Instruct |
Oops, something went wrong.