From 7438f4f6ba28f36d59da5132a5bcf5edb10742d4 Mon Sep 17 00:00:00 2001 From: oobabooga <112222186+oobabooga@users.noreply.github.com> Date: Sat, 22 Apr 2023 12:27:30 -0300 Subject: [PATCH] Change GPTQ triton default settings --- README.md | 6 +++--- modules/GPTQ_loader.py | 8 ++++---- modules/shared.py | 6 +++--- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index bb54d586..681180ba 100644 --- a/README.md +++ b/README.md @@ -230,9 +230,9 @@ Optionally, you can use the following command-line flags: | `--groupsize GROUPSIZE` | Group size. | | `--pre_layer PRE_LAYER` | The number of layers to allocate to the GPU. Setting this parameter enables CPU offloading for 4-bit models. | | `--monkey-patch` | Apply the monkey patch for using LoRAs with quantized models. -| `--no-quant_attn` | (triton) Disable quant attention. If you encounter incoherent results try disabling this. -| `--no-warmup_autotune` | (triton) Disable warmup autotune. -| `--no-fused_mlp` | (triton) Disable fused mlp. If you encounter "Unexpected mma -> mma layout conversion" try disabling this. +| `--quant_attn` | (triton) Enable quant attention. +| `--warmup_autotune` | (triton) Enable warmup autotune. +| `--fused_mlp` | (triton) Enable fused mlp. #### FlexGen diff --git a/modules/GPTQ_loader.py b/modules/GPTQ_loader.py index 3379d27a..a42dbcf3 100644 --- a/modules/GPTQ_loader.py +++ b/modules/GPTQ_loader.py @@ -79,14 +79,14 @@ def _load_quant(model, checkpoint, wbits, groupsize=-1, faster_kernel=False, exc model.load_state_dict(torch.load(checkpoint), strict=False) if is_triton: - if not shared.args.no_quant_attn: + if shared.args.quant_attn: quant.make_quant_attn(model) - if eval and not shared.args.no_fused_mlp: + if eval and shared.args.fused_mlp: quant.make_fused_mlp(model) - if not shared.args.no_warmup_autotune: + if shared.args.warmup_autotune: quant.autotune_warmup_linear(model, transpose=not eval) - if eval and not shared.args.no_fused_mlp: + if eval and shared.args.fused_mlp: quant.autotune_warmup_fused(model) model.seqlen = 2048 diff --git a/modules/shared.py b/modules/shared.py index a08f134f..41c068db 100644 --- a/modules/shared.py +++ b/modules/shared.py @@ -124,9 +124,9 @@ parser.add_argument('--model_type', type=str, help='Model type of pre-quantized parser.add_argument('--groupsize', type=int, default=-1, help='Group size.') parser.add_argument('--pre_layer', type=int, default=0, help='The number of layers to allocate to the GPU. Setting this parameter enables CPU offloading for 4-bit models.') parser.add_argument('--monkey-patch', action='store_true', help='Apply the monkey patch for using LoRAs with quantized models.') -parser.add_argument('--no-quant_attn', action='store_true', help='(triton) Disable quant attention. If you encounter incoherent results try disabling this.') -parser.add_argument('--no-warmup_autotune', action='store_true', help='(triton) Disable warmup autotune.') -parser.add_argument('--no-fused_mlp', action='store_true', help='(triton) Disable fused mlp. If you encounter "Unexpected mma -> mma layout conversion" try disabling this.') +parser.add_argument('--quant_attn', action='store_true', help='(triton) Enable quant attention.') +parser.add_argument('--warmup_autotune', action='store_true', help='(triton) Enable warmup autotune.') +parser.add_argument('--fused_mlp', action='store_true', help='(triton) Enable fused mlp.') # FlexGen parser.add_argument('--flexgen', action='store_true', help='Enable the use of FlexGen offloading.')