Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/transformers/integrations/hub_kernels.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@ def use_kernel_forward_from_hub(layer_name: str):
)
},
"npu": {
Mode.INFERENCE: LayerRepository(
repo_id="kernels-community/liger_kernels",
layer_name="LigerRMSNorm",
Mode.TRAINING: LayerRepository(
repo_id="kernels-ext-npu/rmsnorm",
layer_name="rmsnorm",
Comment on lines -88 to +90
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for inference should we still keep liger_kernels ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also @zheliuyu, I have a few concerns about including kernels from other communities that may not yet be fully mature in the default mapping of Transformers, since it's code being run on users devices, and we need to keep control of what's being executed. I would kindly suggest using the KernelConfig directly and specifying the desired mapping there instead of using the default one for now. For example:

kernel_config = KernelConfig(kernel_mapping={"RMSNorm": "kernels-ext-npu/rmsnorm:rmsnorm"})
model = AutoModelForCausalLM.from_pretrained(
            "unsloth/Llama-3.2-1B-Instruct", use_kernels=True, device_map=torch_device, kernel_config=kernel_config
        )

Once the npu community is mature enough we can consider adding kernels to the default mapping directly.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your guidance.

)
},
},
Expand Down