[NPU]fix rl update weights 'Parameter' object has no attribute 'weight_LOADER' (#31796)
This commit is contained in:
@@ -333,11 +333,6 @@ class NPUW8A8Int8MoEMethod(_NPUMoEMethodBase):
|
|||||||
# Process weight
|
# Process weight
|
||||||
weight: torch.Tensor = getattr(layer, f"{weight_prefix}_weight")
|
weight: torch.Tensor = getattr(layer, f"{weight_prefix}_weight")
|
||||||
weight.data = npu_format_cast(weight.data.transpose(1, 2))
|
weight.data = npu_format_cast(weight.data.transpose(1, 2))
|
||||||
setattr(
|
|
||||||
layer,
|
|
||||||
f"{weight_prefix}_weight",
|
|
||||||
torch.nn.Parameter(weight, requires_grad=False),
|
|
||||||
)
|
|
||||||
|
|
||||||
# Set dispatcher output dtype
|
# Set dispatcher output dtype
|
||||||
if weight_prefix == "w13":
|
if weight_prefix == "w13":
|
||||||
@@ -442,11 +437,6 @@ class NPUW4A8Int8MoEMethod(_NPUMoEMethodBase):
|
|||||||
weight = getattr(layer, f"{weight_prefix}_weight")
|
weight = getattr(layer, f"{weight_prefix}_weight")
|
||||||
weight.data = npu_format_cast(weight.data.transpose(1, 2))
|
weight.data = npu_format_cast(weight.data.transpose(1, 2))
|
||||||
weight.data = self._pack_to_int32(weight.data)
|
weight.data = self._pack_to_int32(weight.data)
|
||||||
setattr(
|
|
||||||
layer,
|
|
||||||
f"{weight_prefix}_weight",
|
|
||||||
torch.nn.Parameter(weight, requires_grad=False),
|
|
||||||
)
|
|
||||||
|
|
||||||
# Set dispatcher output dtype
|
# Set dispatcher output dtype
|
||||||
if weight_prefix == "w13":
|
if weight_prefix == "w13":
|
||||||
@@ -579,11 +569,6 @@ class NPUWNA16Int4MoEMethod(_NPUMoEMethodBase):
|
|||||||
.int()
|
.int()
|
||||||
)
|
)
|
||||||
weight.data = self._pack_to_int32(unpacked_weight)
|
weight.data = self._pack_to_int32(unpacked_weight)
|
||||||
setattr(
|
|
||||||
layer,
|
|
||||||
f"{weight_prefix}_weight",
|
|
||||||
torch.nn.Parameter(weight, requires_grad=False),
|
|
||||||
)
|
|
||||||
|
|
||||||
# Set dispatcher output dtype
|
# Set dispatcher output dtype
|
||||||
if weight_prefix == "w13":
|
if weight_prefix == "w13":
|
||||||
@@ -704,11 +689,6 @@ class NPUUnquantMoEMethod(_NPUMoEMethodBase):
|
|||||||
|
|
||||||
weight: torch.Tensor = getattr(layer, f"{weight_prefix}_weight")
|
weight: torch.Tensor = getattr(layer, f"{weight_prefix}_weight")
|
||||||
weight.data = npu_format_cast(weight)
|
weight.data = npu_format_cast(weight)
|
||||||
setattr(
|
|
||||||
layer,
|
|
||||||
f"{weight_prefix}_weight",
|
|
||||||
torch.nn.Parameter(weight, requires_grad=False),
|
|
||||||
)
|
|
||||||
|
|
||||||
if weight_prefix == "w13":
|
if weight_prefix == "w13":
|
||||||
self._set_dispatcher_output_dtype(layer, "bf16")
|
self._set_dispatcher_output_dtype(layer, "bf16")
|
||||||
|
|||||||
Reference in New Issue
Block a user