This commit is contained in:
Daniel Han-Chen 2024-03-18 03:18:11 +11:00
commit 353deb6a64
2 changed files with 2 additions and 6 deletions

View file

@ -87,7 +87,6 @@ class LoRA_MLP(torch.autograd.Function):
downW, downW_quant, downA, downB, downS,
_forward_function, _backward_function,):
dtype = X.dtype
print("MLP Forward ", dtype)
e = matmul_lora(X, gateW, gateW_quant, gateA, gateB, gateS)
g = matmul_lora(X, upW, upW_quant, upA, upB, upS)
@ -123,7 +122,6 @@ class LoRA_MLP(torch.autograd.Function):
e = e .view(-1, e .shape[-1])
g = g .view(-1, g .shape[-1])
dtype = X.dtype
print("MLP Backward ", dtype)
DW = matmul_lora(dY, downW.t(), downW_quant, downB, downA, downS)
DW, e, g = _backward_function(DW, e, g)

View file

@ -505,13 +505,10 @@ def LlamaModel_fast_forward(
position_ids = position_ids.repeat((batch_size, 1))
pass
# embed positions
# Embed positions
if inputs_embeds is None:
inputs_embeds = self.embed_tokens(input_ids)
# Downcast to the correct dtype ie float32 to float16
inputs_embeds = inputs_embeds.to(self.config.torch_dtype)
# Normalized from Gemma
IS_GEMMA = self.config.model_type == "gemma"
train_embed_tokens = self.embed_tokens.weight.requires_grad
@ -759,6 +756,7 @@ def CausalLM_fast_forward(fast_forward_inference):
else:
logits = self.lm_head(hidden_states)
pass
print(logits.dtype)
loss = None
if labels is not None: