Skip to content

feat: init CI for upload python script to huggingface #1

feat: init CI for upload python script to huggingface

feat: init CI for upload python script to huggingface #1

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