Tilegym Monkey Patch Kernels To Transformers

nvidia/skills/skills/tilegym-monkey-patch-kernels-to-transformers

作者 nvidiacf5224d14250CC-BY-4.0 AND Apache-2.03.5K 个星标收录于 2026年10月8日更新于 2026年10月8日仓库今天更新

Integrate TileGym kernels into Hugging Face `transformers` models by replacing the library's submodule(s) and certain class(es)' implementations, and patching certain class(es)' init/forward/load weight methods prior to instantiating models. Used when the user requires integrating TileGym kernels into `transformers` models.

AI 生成的概览

通过非侵入式 monkey-patch 将 TileGym cuTile 内核集成到 Hugging Face transformers 模型,并自动生成新内核。

功能
引导智能体将 TileGym 内核集成到目标 Hugging Face transformers 模型中,在实例化前替换子模块并修补类的 init、forward 和权重加载方法,使模型在运行时调用 TileGym 内核。它还会运行自动研究式循环,为未覆盖的 PyTorch 代码创建并集成新的 cuTile 内核,最后进行总结和报告。产出包括修补后的模型集成、新内核定义和报告。
适用场景
适用于用户希望将 TileGym 内核集成到特定 transformers 模型以验证端到端正确性和吞吐量提升的场景。它面向 transformer 模型的内核集成与内核生成工作,而非通用模型训练或推理任务。
运行要求
需要 AI 智能体环境(已在 Claude Code、CodeX 和 Cursor Agent 模式上验证),并可访问 TileGym 项目和 Hugging Face transformers。它引用环境设置、内核集成、自动内核化和内核清单模式文档,且不附带脚本。

Integrate and create cuTile kernels into 🤗 Transformers

The main purpose of TileGym project is to provide performant kernels for LLM training and inference. We will integrate proper kernels available in TileGym project to LLM models provided by Hugging Face transformers library to validate end-to-end functional correctness and performance improvements. Instead of modifying transformers source code, we will take a non-intrusive monkey-patch approach: We will replace certain modules/classes/methods in transformers library that implement the Transformer model we would like to integrate, such that at model instantiation, that model's core components will be replaced by TileGym implementations. At runtime the model will actually invoke TileGym kernels under the hood. In addition, we will follow an auto-research-style agent harness loop to create and integrate new cuTile kernels to the target model to improve kernel coverage and end-to-end throughput.

Instructions

This is for human readers: Simply prompt your favorite AI Agent with skill name and target model ID. E.g.,:

Claude/CodeX
Hi, please /monkey-patch-kernels-to-transformers Qwen/Qwen3.5-0.8B.

The Agent might ask you several questions. Make clarifications and give a go confirmation.

Workflow

  1. Prepare experiment environment. Follow environment-setup.md
  2. Integrate existing TileGym kernels to the target model. Follow kernel-integration.md
  3. Autonomously create new cuTile kernels for uncovered PyTorch code. Follow auto-kernelize.md
    • Feel free to add new cuTile kernels with constraints in mind
    • Do not stop until meet auto-kernelize loop stop conditions
  4. Summarize and report

Disciplines

This is for AI Agents executing this workflow.

Kernel inventory

Reusable transformer-local kernels must be represented with FlashInfer-Bench-style Definition and Solution metadata. Follow kernel-inventory-schema.md when researching compute requirements, inventorying existing kernels, proposing candidates, or creating new generated kernels.

来源与署名

来源:nvidia/skills位于skills/tilegym-monkey-patch-kernels-to-transformers提交cf5224d

许可证: CC-BY-4.0 AND Apache-2.0

内容归原作者所有。SourceWeft 从公开仓库中收录这些内容。

举报或申请下架