Skip to content

Commit

Permalink
feat: init CI for upload python script to huggingface
Browse files Browse the repository at this point in the history
  • Loading branch information
nguyenhoangthuan99 committed Jan 6, 2025
1 parent 3774ffe commit 0906a7e
Show file tree
Hide file tree
Showing 2 changed files with 79 additions and 4 deletions.
75 changes: 75 additions & 0 deletions .github/workflows/python-script-package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: Build and Package Python Code

on:
push:
branches:
- feat/python-package-ci
workflow_dispatch:
inputs:
model_dir:
description: "Path to model directory in github repo"
required: true
repo_name:
description: "name of repo to be checked out"
required: true
branch_name:
description: "name of branch to be checked out"
required: true
default: main
hf_repo:
description: "name of huggingface repo to be pushed"
required: true
hf_prefix_branch:
description: "prefix of hf branch"
required: false

env:
MODEL_DIR: deployments/ichigo # ${{ inputs.model_dir }}
REPO_NAME: janhq/ichigo # ${{ inputs.repo_name}}
BRANCH_NAME: feat/ichigo-deployment # ${{ inputs.branch_name }}
HF_REPO: cortexso/test # ${{ inputs.hf_repo }}
HF_PREFIX_BRANCH: fp16 # ${{ inputs.hf_prefix_branch }}

jobs:
build-and-test:
runs-on: ${{ matrix.runs-on }}
timeout-minutes: 3600
strategy:
fail-fast: false
matrix:
include:
- os: "linux"
name: "amd64"
runs-on: "ubuntu-20-04-cuda-12-0"
- os: "mac"
name: "amd64"
runs-on: "macos-selfhosted-12"
- os: "mac"
name: "arm64"
runs-on: "macos-selfhosted-12-arm64"
- os: "windows"
name: "amd64"
runs-on: "windows-cuda-12-0"
steps:
- name: Clone
id: checkout
uses: actions/checkout@v3
with:
submodules: recursive
repository: ${{env.REPO_NAME}}
ref: ${{env.BRANCH_NAME}}
- name: use python
uses: actions/setup-python@v5
with:
python-version: "3.10"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install hf-transfer huggingface_hub
- name: Upload Artifact
run: |
huggingface-cli login --token ${{ secrets.HUGGINGFACE_TOKEN_WRITE }} --add-to-git-credential
cd ${{env.MODEL_DIR}} && huggingface-cli upload ${{env.HF_REPO}} . . --revision ${{env.HF_PREFIX_BRANCH}}-${{ matrix.os }}-${{ matrix.name }}
huggingface-cli logout
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name: Build and Package Python Library
name: Build and Package Python Virtual Environment

on:
workflow_dispatch:
inputs:
model_dir:
description: "Path to model directory in janhq/models repo"
description: "Path to model directory in github repo"
required: true
model_name:
description: "name of model to be release"
Expand All @@ -28,8 +28,8 @@ on:
env:
MODEL_DIR: ${{ inputs.model_dir }}
MODEL_NAME: ${{ inputs.model_name }}
REPO_NAME: ${{ inputs.model_name }}
BRANCH_NAME: ${{ inputs.model_name }}
REPO_NAME: ${{ inputs.repo_name }}
BRANCH_NAME: ${{ inputs.branch_name }}
HF_REPO: ${{ inputs.hf_repo }}
HF_PREFIX_BRANCH: ${{ inputs.hf_prefix_branch }}

Expand Down

0 comments on commit 0906a7e

Please sign in to comment.