Skip to content
Draft
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions exllamav2/architecture.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,7 @@ class Params:
layer_keys_llama_mlp
self.lm.expect_keys += \
expect_keys_llama
self.lm.supports_tp = True

self.vt_prefix = "vision_tower."
self.vt.keys.update({
Expand Down Expand Up @@ -478,6 +479,7 @@ class Params:
self.lm.attention_bias_qkv = True
self.lm.mrope = True
self.lm.rope_freq_half = True
self.lm.supports_tp = True

self.vt_prefix = "visual."
if arch_string == "Qwen2VLForConditionalGeneration":
Expand Down
22 changes: 15 additions & 7 deletions exllamav2/tensor_p.py
Original file line number Diff line number Diff line change
Expand Up @@ -351,16 +351,24 @@ def allgather(
return bc_tensors


def copy_pinned(
self,
buffer: int,
inputs: torch.Tensor
):
# def copy_pinned(
# self,
# buffer: int,
# inputs: torch.Tensor
# ):
# pt = self.pinned_temp[buffer][:inputs.numel()]
# pt = pt.view(inputs.shape)
# pt.copy_(inputs)
# return pt

def copy_pinned(self, buffer: int, inputs: torch.Tensor):
pt = self.pinned_temp[buffer][:inputs.numel()]
pt = pt.view(inputs.shape)
pt.copy_(inputs)
return pt

# Bypass PyTorch entirely - direct memory copy
import ctypes
ctypes.memmove(pt.data_ptr(), inputs.data_ptr(), inputs.numel() * inputs.element_size())
return pt

def add_residual(
self,
Expand Down