Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Core] Refactor GGUF parameters packing and forwarding #8859

Merged
merged 7 commits into from
Oct 7, 2024
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
code format
  • Loading branch information
Isotr0py committed Sep 28, 2024
commit ce6620eef1c5de0064f985b37f7194ee98d657e0
2 changes: 1 addition & 1 deletion vllm/model_executor/layers/linear.py
Original file line number Diff line number Diff line change
@@ -776,7 +776,7 @@ def weight_loader(self,
param.data[idx_map[loaded_shard_id]].copy_(loaded_weight)
param.shard_weight_type[loaded_shard_id] = loaded_weight.item()
return

if is_gguf_weight:
tp_size = get_tensor_model_parallel_world_size()
tp_rank = get_tensor_model_parallel_rank()
12 changes: 8 additions & 4 deletions vllm/model_executor/layers/quantization/gguf.py
Original file line number Diff line number Diff line change
@@ -125,9 +125,9 @@ def apply(self,
qweight = layer.qweight.unbind(0)
result = []
for id in shard_id:
q_idx = layer.qweight.shard_id_map[id]
qweight_type = layer.qweight_type.shard_weight_type[id]
qweight_idx = layer.qweight.shard_id_map[id]
result.append(_fuse_mul_mat(x, qweight[qweight_idx], qweight_type))
result.append(_fuse_mul_mat(x, qweight[q_idx], qweight_type))
out = torch.cat(result, axis=1)
else:
qweight = layer.qweight
@@ -166,9 +166,13 @@ class GGUFUninitializedParameter(UninitializedParameter):
data_container: List[torch.Tensor]

def materialize_nested(self) -> Parameter:
nested_data = torch.nested.nested_tensor(self.data_container, device=self.device, dtype=torch.uint8)
nested_data = torch.nested.nested_tensor(self.data_container,
device=self.device,
dtype=torch.uint8)
self.data_container.clear()
param = torch.Tensor._make_subclass(self.cls_to_become, nested_data, require_grad=False)
param = torch.Tensor._make_subclass(self.cls_to_become,
nested_data,
require_grad=False)
for k, v in self.__dict__.items():
setattr(param, k, v)
return param
Loading