diff --git a/.github/workflows/build_documentation.yaml b/.github/workflows/build_documentation.yaml new file mode 100644 index 0000000..8d9efe8 --- /dev/null +++ b/.github/workflows/build_documentation.yaml @@ -0,0 +1,17 @@ +name: Build documentation + +on: + push: + branches: + - main + - doc-builder* + - v*-release + +jobs: + build: + uses: huggingface/doc-builder/.github/workflows/build_main_documentation.yml@main + with: + commit_sha: ${{ github.sha }} + package: kernels + secrets: + hf_token: ${{ secrets.HF_DOC_BUILD_PUSH }} diff --git a/.github/workflows/build_pr_documentation.yaml b/.github/workflows/build_pr_documentation.yaml new file mode 100644 index 0000000..4f4c935 --- /dev/null +++ b/.github/workflows/build_pr_documentation.yaml @@ -0,0 +1,15 @@ +name: Build PR Documentation + +on: pull_request + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +jobs: + build: + uses: huggingface/doc-builder/.github/workflows/build_pr_documentation.yml@main + with: + commit_sha: ${{ github.event.pull_request.head.sha }} + pr_number: ${{ github.event.number }} + package: kernels diff --git a/.github/workflows/upload_pr_documentation.yaml b/.github/workflows/upload_pr_documentation.yaml new file mode 100644 index 0000000..12c469c --- /dev/null +++ b/.github/workflows/upload_pr_documentation.yaml @@ -0,0 +1,16 @@ +name: Upload PR Documentation + +on: + workflow_run: + workflows: ["Build PR Documentation"] + types: + - completed + +jobs: + build: + uses: huggingface/doc-builder/.github/workflows/upload_pr_documentation.yml@main + with: + package_name: kernels + secrets: + hf_token: ${{ secrets.HF_DOC_BUILD_PUSH }} + comment_bot_token: ${{ secrets.COMMENT_BOT_TOKEN }} diff --git a/docs/source/faq.md b/docs/source/faq.md index bc0acc6..4f6d8aa 100644 --- a/docs/source/faq.md +++ b/docs/source/faq.md @@ -2,9 +2,9 @@ ## Why is the kernelization step needed? -In earlier versions of `kernels`, a layer's `forward` was replaced by -`use_kernel_forward_from_hub` and `replace_kernel_forward_from_hub`. The -new `forward` would dispatch to a kernel based on the device type, +In earlier versions of `kernels`, a layer's `forward` method was replaced +by `use_kernel_forward_from_hub` and `replace_kernel_forward_from_hub`. +The new `forward` would dispatch to a kernel based on the device type, whether a model was training, etc. However, this approach was fundamentally incompatible with `torch.compile` since it relied on data-dependent branching.