Update Inference Types #34
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
name: Update Inference Types | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: "0 3 * * *" # Every day at 3am | |
concurrency: | |
group: update-inference-types | |
cancel-in-progress: true | |
jobs: | |
pull_request: | |
runs-on: ubuntu-latest | |
steps: | |
# Setup Python | |
- uses: actions/checkout@v3 | |
with: | |
repository: huggingface/huggingface_hub | |
path: ./huggingface_hub | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: "3.10" | |
- name: Setup uv | |
run: | | |
pip install --upgrade uv | |
- name: Install dependencies | |
run: uv pip install --system "huggingface_hub[dev] @ ." | |
working-directory: ./huggingface_hub | |
# Setup JS | |
- uses: actions/checkout@v3 | |
with: | |
repository: huggingface/huggingface.js | |
path: huggingface.js | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: "20" | |
- name: Install pnpm | |
uses: pnpm/action-setup@v2 | |
with: | |
package_json_file: ./huggingface.js/packages/tasks-gen/package.json | |
- name: Install dependencies | |
run: pnpm install | |
working-directory: ./huggingface.js/packages/tasks-gen | |
# Generate specs | |
- run: pnpm run inference-codegen | |
working-directory: ./huggingface.js/packages/tasks-gen | |
# Copy Python types to huggingface_hub | |
- run: cp -r ./huggingface.js/packages/tasks/.python_generated/* ./huggingface_hub/src/huggingface_hub/inference/_generated/types | |
# Post-process | |
- run: make inference_update | |
working-directory: ./huggingface_hub | |
- run: make style | |
working-directory: ./huggingface_hub | |
# Check changes | |
- run: git status | |
working-directory: ./huggingface_hub | |
# Create or update Pull Request | |
- name: Create Pull Request | |
uses: peter-evans/create-pull-request@v7 | |
with: | |
path: ./huggingface_hub | |
token: ${{ secrets.TOKEN_INFERENCE_SYNC_BOT }} | |
commit-message: Update inference types (automated commit) | |
branch: update-inference-types-automated-pr | |
delete-branch: true | |
title: "[Bot] Update inference types" | |
body: | | |
This PR updates the inference types. It has been generated by running: | |
```sh | |
# Generate Python code | |
pnpm run inference-codegen # from @huggingface/tasks-gen | |
# Copy to this repository | |
cp -r ./huggingface.js/packages/tasks/.python_generated/* ./huggingface_hub/src/huggingface_hub/inference/_generated/types | |
# Clean things | |
make inference_update | |
make style | |
``` | |
This PR was automatically created by the [Update Inference Types workflow](https://github.com/huggingface/huggingface_hub/blob/main/.github/update-inference-types.yml). | |
Make sure the changes are correct before merging. | |
labels: | | |
specs | |
reviewers: | | |
Wauplin | |
hanouticelina |