[ Misc ] Enable Quantizing All Layers of DeekSeekv2 (#6423)

This commit is contained in:
Robert Shaw
2024-07-14 21:38:42 +00:00
committed by GitHub
parent ccd3c04571
commit 73030b7dae
2 changed files with 6 additions and 1 deletions
@@ -431,6 +431,11 @@ def convert_pyslice_to_tensor(x: Any) -> torch.Tensor:
def default_weight_loader(param: torch.Tensor,
loaded_weight: torch.Tensor) -> None:
"""Default weight loader."""
# If the weight on disk does not have a shape, give it one
# (such scales for AutoFp8).
if len(loaded_weight.shape) == 0:
loaded_weight = loaded_weight.reshape(1)
assert param.size() == loaded_weight.size()
param.data.copy_(loaded_weight)