Skip to content

Commit

Permalink
Dev update libraries (#19)
Browse files Browse the repository at this point in the history
Co-authored-by: wl-zhao <[email protected]>
  • Loading branch information
yuxumin and wl-zhao authored Sep 20, 2024
1 parent 8f14ae2 commit a2e17f4
Showing 1 changed file with 167 additions and 0 deletions.
167 changes: 167 additions & 0 deletions .github/workflows/package-and-upload.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@

name: "Release To HF"

on:
workflow_dispatch:
inputs:
git_tag:
description: 'Git Branch Tag'
required: true
type: string
default: "main"
cu:
description: 'CUDA Version'
required: true
type: string
default: "124"
python_minor:
description: 'Python Minor Version'
required: true
type: string
default: "10"
python_patch:
description: 'Python Patch Version'
required: true
type: string
default: "10"
version:
description: 'Release Version Tag'
required: true
type: string
default: "beta"

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
ref: ${{ inputs.git_tag }}

- uses: pnpm/action-setup@v2
with:
version: 9
run_install: false

- uses: actions/setup-node@v4
with:
node-version: "20"
cache: "pnpm"
cache-dependency-path: "web/pnpm-lock.yaml"

- working-directory: "./web"
run: pnpm install

- working-directory: "./web"
run: pnpm turbo run build --filter=web

- uses: actions/upload-artifact@v3
with:
name: web-build
path: web/apps/web/dist

package_shellagent_windows:
permissions:
contents: "write"
packages: "write"
pull-requests: "read"
needs: build
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.git_tag }}
fetch-depth: 0
persist-credentials: false
submodules: recursive
- uses: actions/setup-python@v5
with:
python-version: 3.${{ inputs.python_minor }}.${{ inputs.python_patch }}

- name: Download web-build artifact
uses: actions/download-artifact@v3
with:
name: web-build
path: ./servers/web-build

- shell: bash
run: |
cd ..
cp -r ShellAgent ShellAgent_copy
curl -L https://huggingface.co/XuminYu/git_embed/resolve/main/git.7z?download=true -o git.7z
"C:\Program Files\7-Zip\7z.exe" x git.7z -ogit
curl https://www.python.org/ftp/python/3.${{ inputs.python_minor }}.${{ inputs.python_patch }}/python-3.${{ inputs.python_minor }}.${{ inputs.python_patch }}-embed-amd64.zip -o python_embeded.zip
unzip python_embeded.zip -d python_embeded
cd python_embeded
echo 'import site' >> ./python3${{ inputs.python_minor }}._pth
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
./python.exe get-pip.py
cp -r ../ShellAgent/.ci/python_dependencies_wins/include ./include
cp -r ../ShellAgent/.ci/python_dependencies_wins/Library ./Library
cp -r ../ShellAgent/.ci/python_dependencies_wins/libs ./libs
./python.exe -s -m pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu${{ inputs.cu }}
./python.exe -s -m pip install --use-pep517 pygit2 Cython scikit_build_core enscons pytoml cmake==3.21
./python.exe -s -m pip install --use-pep517 -r ../ShellAgent/requirements.txt
./python.exe -s -m pip install onnx==1.16.1 flask PyExecJS docx2txt fuzzywuzzy git cloudpickle
sed -i '1i../ShellAgent' ./python3${{ inputs.python_minor }}._pth
cd ..
mkdir ShellAgent_windows_portable
mv python_embeded ShellAgent_windows_portable
mv git ShellAgent_windows_portable
mv ShellAgent_copy ShellAgent_windows_portable/ShellAgent
cd ShellAgent_windows_portable
cp -r ShellAgent/.ci/windows_base_files/* ./
cd ShellAgent
mkdir -p models/insightface/models
ls models/insightface/
curl -L https://huggingface.co/MonsterMMORPG/tools/resolve/main/antelopev2.zip -o models/insightface/models/antelopev2.zip
ls models/insightface/models/
unzip models/insightface/models/antelopev2.zip -d models/insightface/models/
mkdir -p models/vae_approx
ls models
git clone --depth 1 https://github.com/comfyanonymous/taesd
cp taesd/*.pth models/vae_approx
../python_embeded/python.exe -m pip install -e .
../python_embeded/python.exe -m pip show proconfig
# ../python_embeded/python.exe servers/main.py
cd ..
cd ..
"C:\Program Files\7-Zip\7z.exe" a -t7z -m0=lzma2 -mx=8 -mfb=64 -md=32m -ms=on -mf=BCJ2 ShellAgent_windows_portable.7z ShellAgent_windows_portable/*
mv ShellAgent_windows_portable.7z ShellAgent/ShellAgent_windows_portable.7z
ls
- name: Install Hugging Face Hub SDK
run: pip install huggingface_hub

- name: Upload binaries to Hugging Face
run: |
from huggingface_hub import HfApi
api = HfApi()
# Set repository and file paths
repo_id = "myshell-ai/ShellAgent"
file_path = "ShellAgent_windows_portable.7z"
# Upload the file to Hugging Face repository
api.upload_file(
path_or_fileobj=file_path,
path_in_repo="ShellAgent_${{ inputs.version }}.7z",
repo_id=repo_id,
repo_type="model", # or 'dataset' depending on your use case
token="${{ secrets.HF_TOKEN }}"
)
shell: python

0 comments on commit a2e17f4

Please sign in to comment.