mirror of
https://github.com/hiyouga/LlamaFactory.git
synced 2026-06-17 02:27:23 +00:00
[fix] fix liger kernel patch for npu (#10583)
This commit is contained in:
parent
897a44386c
commit
8669a22e9c
1 changed files with 8 additions and 0 deletions
|
|
@ -16,6 +16,7 @@ import inspect
|
|||
from typing import TYPE_CHECKING
|
||||
|
||||
from ...extras import logging
|
||||
from ...extras.misc import get_device_name
|
||||
|
||||
|
||||
if TYPE_CHECKING:
|
||||
|
|
@ -99,5 +100,12 @@ def apply_liger_kernel(
|
|||
else:
|
||||
kwargs = {}
|
||||
|
||||
if get_device_name() == "npu":
|
||||
import torch
|
||||
|
||||
if "Ascend910" not in torch.npu.get_device_name(0):
|
||||
kwargs["swiglu"] = False
|
||||
kwargs["fused_linear_cross_entropy"] = False
|
||||
|
||||
apply_liger_kernel(**kwargs)
|
||||
logger.info_rank0("Liger kernel has been applied to the model.")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue