mirror of
https://github.com/wassname/alignment-handbook.git
synced 2026-08-06 12:51:01 +08:00
Add fsdp+qlora support (#160)
This commit is contained in:
@@ -185,6 +185,9 @@ class ModelArguments:
|
||||
default="nf4", metadata={"help": "precise the quantization type (fp4 or nf4)"}
|
||||
)
|
||||
use_bnb_nested_quant: bool = field(default=False, metadata={"help": "use nested quantization"})
|
||||
bnb_4bit_quant_storage: Optional[str] = field(
|
||||
default="uint8", metadata={"help": "storage type to pack the quanitzed 4-bit prarams."}
|
||||
)
|
||||
|
||||
def __post_init__(self):
|
||||
if self.load_in_8bit and self.load_in_4bit:
|
||||
|
||||
@@ -51,6 +51,7 @@ def get_quantization_config(model_args: ModelArguments) -> BitsAndBytesConfig |
|
||||
bnb_4bit_compute_dtype=compute_dtype,
|
||||
bnb_4bit_quant_type=model_args.bnb_4bit_quant_type,
|
||||
bnb_4bit_use_double_quant=model_args.use_bnb_nested_quant,
|
||||
bnb_4bit_quant_storage=model_args.bnb_4bit_quant_storage,
|
||||
)
|
||||
elif model_args.load_in_8bit:
|
||||
quantization_config = BitsAndBytesConfig(
|
||||
|
||||
Reference in New Issue
Block a user