You can use safely with this layer, ONLY WHEN query_key_value output is query_key_value order.
You can use safely with this layer, ONLY WHEN query_key_value output is query_key_value order.
If you use a different order like ChatGLM
If you use a different order like ChatGLM
...
@@ -95,15 +83,20 @@ class LoraQKV(nn.Module):
...
@@ -95,15 +83,20 @@ class LoraQKV(nn.Module):
self.lora_alpha=lora_alpha
self.lora_alpha=lora_alpha
self.scaling=self.lora_alpha/self.r
self.scaling=self.lora_alpha/self.r
ifqlora:
ifqlora:
self.original=HackLinearNF4(in_dim,out_dim)
try:
self.original=HackLinearNF4(in_dim,out_dim)
except:
raiseException('Build 4bit layer failed. You need to install the latest bitsandbytes. Try `pip install bitsandbytes`. If you still meet error after installation, try running `from bitsandbytes.nn import LinearNF4` with python and fix the error.')
assertnum_attention_headsisnotNoneandhidden_size_per_attention_headisnotNone,"You should set num_attention_heads and hidden_size_per_attention_head if you use head_first=True!"
assertnum_attention_headsisnotNoneandhidden_size_per_attention_headisnotNone,"You should set num_attention_heads and hidden_size_per_attention_head if you use head_first=True!"