Commit 95099cbc authored by zhuwenwen's avatar zhuwenwen
Browse files

fix docstring

parent c7880912
...@@ -2635,6 +2635,9 @@ class LoRAConfig: ...@@ -2635,6 +2635,9 @@ class LoRAConfig:
max_cpu_loras: Optional[int] = None max_cpu_loras: Optional[int] = None
"""Maximum number of LoRAs to store in CPU memory. Must be >= than """Maximum number of LoRAs to store in CPU memory. Must be >= than
`max_loras`.""" `max_loras`."""
merge_lora: bool = False
"""Enable merge lora
"""
lora_target_modules: Optional[List[str]] = None lora_target_modules: Optional[List[str]] = None
"""List of lora module name, If not specified, """List of lora module name, If not specified,
modules will be chosen according to the model architecture. modules will be chosen according to the model architecture.
...@@ -2653,8 +2656,6 @@ class LoRAConfig: ...@@ -2653,8 +2656,6 @@ class LoRAConfig:
specified, only adapters trained with the base model scaling factor are specified, only adapters trained with the base model scaling factor are
allowed.""" allowed."""
bias_enabled: bool = False bias_enabled: bool = False
merge_lora: bool = False
lora_target_modules: Optional[List[str]] = None
"""Enable bias for LoRA adapters.""" """Enable bias for LoRA adapters."""
def compute_hash(self) -> str: def compute_hash(self) -> str:
...@@ -2677,6 +2678,7 @@ class LoRAConfig: ...@@ -2677,6 +2678,7 @@ class LoRAConfig:
factors.append(self.lora_extra_vocab_size) factors.append(self.lora_extra_vocab_size)
factors.append(self.long_lora_scaling_factors) factors.append(self.long_lora_scaling_factors)
factors.append(self.bias_enabled) factors.append(self.bias_enabled)
factors.append(self.merge_lora)
hash_str = hashlib.md5(str(factors).encode(), hash_str = hashlib.md5(str(factors).encode(),
usedforsecurity=False).hexdigest() usedforsecurity=False).hexdigest()
return hash_str return hash_str
......
...@@ -280,7 +280,7 @@ class EngineArgs: ...@@ -280,7 +280,7 @@ class EngineArgs:
max_lora_rank: int = LoRAConfig.max_lora_rank max_lora_rank: int = LoRAConfig.max_lora_rank
fully_sharded_loras: bool = LoRAConfig.fully_sharded_loras fully_sharded_loras: bool = LoRAConfig.fully_sharded_loras
max_cpu_loras: Optional[int] = LoRAConfig.max_cpu_loras max_cpu_loras: Optional[int] = LoRAConfig.max_cpu_loras
merge_lora: bool = False merge_lora: bool = LoRAConfig.merge_lora
lora_target_modules: Optional[List[str]] = LoRAConfig.lora_target_modules lora_target_modules: Optional[List[str]] = LoRAConfig.lora_target_modules
lora_dtype: Optional[Union[str, torch.dtype]] = LoRAConfig.lora_dtype lora_dtype: Optional[Union[str, torch.dtype]] = LoRAConfig.lora_dtype
lora_extra_vocab_size: int = LoRAConfig.lora_extra_vocab_size lora_extra_vocab_size: int = LoRAConfig.lora_extra_vocab_size
...@@ -706,8 +706,9 @@ class EngineArgs: ...@@ -706,8 +706,9 @@ class EngineArgs:
lora_group.add_argument('--max-lora-rank', lora_group.add_argument('--max-lora-rank',
**lora_kwargs["max_lora_rank"]) **lora_kwargs["max_lora_rank"])
lora_group.add_argument('--merge-lora', lora_group.add_argument('--merge-lora',
action=argparse.BooleanOptionalAction, **lora_kwargs["merge-lora"])
help='If set to True, the weights of the base layer will be merged with the weights of Lora.') # action=argparse.BooleanOptionalAction,
# help='If set to True, the weights of the base layer will be merged with the weights of Lora.')
lora_group.add_argument('--lora-target-modules', lora_group.add_argument('--lora-target-modules',
**lora_kwargs["lora_target_modules"]) **lora_kwargs["lora_target_modules"])
lora_group.add_argument('--lora-extra-vocab-size', lora_group.add_argument('--lora-extra-vocab-size',
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment