|
| 1 | +name: Update Inference Types |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + schedule: |
| 6 | + - cron: "0 3 * * *" # Every day at 3am |
| 7 | + |
| 8 | +concurrency: |
| 9 | + group: update-inference-types |
| 10 | + cancel-in-progress: true |
| 11 | + |
| 12 | +jobs: |
| 13 | + pull_request: |
| 14 | + runs-on: ubuntu-latest |
| 15 | + steps: |
| 16 | + # Setup Python |
| 17 | + - uses: actions/checkout@v3 |
| 18 | + with: |
| 19 | + repository: huggingface/huggingface_hub |
| 20 | + path: ./huggingface_hub |
| 21 | + - name: Set up Python |
| 22 | + uses: actions/setup-python@v2 |
| 23 | + with: |
| 24 | + python-version: "3.10" |
| 25 | + - name: Setup uv |
| 26 | + run: | |
| 27 | + pip install --upgrade uv |
| 28 | + - name: Install dependencies |
| 29 | + run: uv pip install --system "huggingface_hub[dev] @ ." |
| 30 | + working-directory: ./huggingface_hub |
| 31 | + |
| 32 | + # Setup JS |
| 33 | + - uses: actions/checkout@v3 |
| 34 | + with: |
| 35 | + repository: huggingface/huggingface.js |
| 36 | + path: huggingface.js |
| 37 | + - uses: actions/setup-node@v3 |
| 38 | + with: |
| 39 | + node-version: "20" |
| 40 | + - name: Install pnpm |
| 41 | + uses: pnpm/action-setup@v2 |
| 42 | + with: |
| 43 | + package_json_file: ./huggingface.js/packages/tasks-gen/package.json |
| 44 | + - name: Install dependencies |
| 45 | + run: pnpm install |
| 46 | + working-directory: ./huggingface.js/packages/tasks-gen |
| 47 | + |
| 48 | + # Generate specs |
| 49 | + - run: pnpm run inference-codegen |
| 50 | + working-directory: ./huggingface.js/packages/tasks-gen |
| 51 | + |
| 52 | + # Copy Python types to huggingface_hub |
| 53 | + - run: cp -r ./huggingface.js/packages/tasks/.python_generated/* ./huggingface_hub/src/huggingface_hub/inference/_generated/types |
| 54 | + |
| 55 | + # Post-process |
| 56 | + - run: make inference_update |
| 57 | + working-directory: ./huggingface_hub |
| 58 | + - run: make style |
| 59 | + working-directory: ./huggingface_hub |
| 60 | + |
| 61 | + # Check changes |
| 62 | + - run: git status |
| 63 | + working-directory: ./huggingface_hub |
| 64 | + |
| 65 | + # Create or update Pull Request |
| 66 | + - name: Create Pull Request |
| 67 | + uses: peter-evans/create-pull-request@v7 |
| 68 | + with: |
| 69 | + path: ./huggingface_hub |
| 70 | + token: ${{ secrets.TOKEN_INFERENCE_SYNC_BOT }} |
| 71 | + commit-message: Update inference types (automated commit) |
| 72 | + branch: update-inference-types-automated-pr |
| 73 | + delete-branch: true |
| 74 | + title: "[Bot] Update inference types" |
| 75 | + body: | |
| 76 | + This PR updates the inference types. It has been generated by running: |
| 77 | + ```sh |
| 78 | + # Generate Python code |
| 79 | + pnpm run inference-codegen # from @huggingface/tasks-gen |
| 80 | +
|
| 81 | + # Copy to this repository |
| 82 | + cp -r ./huggingface.js/packages/tasks/.python_generated/* ./huggingface_hub/src/huggingface_hub/inference/_generated/types |
| 83 | +
|
| 84 | + # Clean things |
| 85 | + make inference_update |
| 86 | + make style |
| 87 | + ``` |
| 88 | +
|
| 89 | + This PR was automatically created by the [Update Inference Types workflow](https://github.com/huggingface/huggingface_hub/blob/main/.github/update-inference-types.yml). |
| 90 | + |
| 91 | + Make sure the changes are correct before merging. |
| 92 | + labels: | |
| 93 | + specs |
| 94 | + reviewers: | |
| 95 | + Wauplin |
| 96 | + hanouticelina |
0 commit comments