Update llama.py
This commit is contained in:
parent
8e5054bbea
commit
fd753fed99
1 changed files with 7 additions and 7 deletions
|
|
@ -2063,9 +2063,9 @@ class FastLlamaModel:
|
|||
(getattr(gate_proj, "base_layer", gate_proj).bias is None) and \
|
||||
(getattr( up_proj, "base_layer", up_proj).bias is None) and \
|
||||
(getattr(down_proj, "base_layer", down_proj).bias is None) and \
|
||||
(len(getattr(gate_proj, "lora_magnitude_vector", [])) == 0) and \
|
||||
(len(getattr( up_proj, "lora_magnitude_vector", [])) == 0) and \
|
||||
(len(getattr(down_proj, "lora_magnitude_vector", [])) == 0):
|
||||
(len(getattr(gate_proj, "lora_magnitude_vector", []) or []) == 0) and \
|
||||
(len(getattr( up_proj, "lora_magnitude_vector", []) or []) == 0) and \
|
||||
(len(getattr(down_proj, "lora_magnitude_vector", []) or []) == 0):
|
||||
|
||||
# https://stackoverflow.com/questions/50599045/python-replacing-a-function-within-a-class-of-a-module
|
||||
layer.mlp.forward = types.MethodType(apply_lora_mlp, layer.mlp)
|
||||
|
|
@ -2087,9 +2087,9 @@ class FastLlamaModel:
|
|||
(getattr(q_proj, "base_layer", q_proj).bias is None) and \
|
||||
(getattr(k_proj, "base_layer", k_proj).bias is None) and \
|
||||
(getattr(v_proj, "base_layer", v_proj).bias is None) and \
|
||||
(len(getattr(q_proj, "lora_magnitude_vector", [])) == 0) and \
|
||||
(len(getattr(k_proj, "lora_magnitude_vector", [])) == 0) and \
|
||||
(len(getattr(v_proj, "lora_magnitude_vector", [])) == 0):
|
||||
(len(getattr(q_proj, "lora_magnitude_vector", []) or []) == 0) and \
|
||||
(len(getattr(k_proj, "lora_magnitude_vector", []) or []) == 0) and \
|
||||
(len(getattr(v_proj, "lora_magnitude_vector", []) or []) == 0):
|
||||
|
||||
layer.self_attn.apply_qkv = apply_lora_qkv
|
||||
n_qkv += 1
|
||||
|
|
@ -2106,7 +2106,7 @@ class FastLlamaModel:
|
|||
o_proj = layer.self_attn.o_proj
|
||||
if hasattr(o_proj, "lora_A") and \
|
||||
(getattr(o_proj, "base_layer", o_proj).bias is None) and \
|
||||
(len(getattr(o_proj, "lora_magnitude_vector", [])) == 0):
|
||||
(len(getattr(o_proj, "lora_magnitude_vector", []) or []) == 0):
|
||||
|
||||
layer.self_attn.apply_o = apply_lora_o
|
||||
n_o += 1
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue