From 2187a8debe1f0084cc893f0dc2170e5ac90f5ba0 Mon Sep 17 00:00:00 2001 From: namtranase Date: Sat, 23 Dec 2023 00:35:47 +0700 Subject: [PATCH] update: cicd --- awq-py/README.md | 4 ++-- awq-py/awq/apply_awq.py | 4 ++-- awq-py/requirements.txt | 2 +- convert-hf-to-gguf.py | 4 ++-- convert.py | 6 +++--- gguf-py/gguf/tensor_mapping.py | 2 +- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/awq-py/README.md b/awq-py/README.md index bb7d3f657..9878ad26c 100644 --- a/awq-py/README.md +++ b/awq-py/README.md @@ -4,7 +4,7 @@ **Supported models:** - [X] LLaMA -- [x] LLaMA 2 +- [x] LLaMA 2 - [X] MPT - [X] Mistral AI v0.1 - [ ] Bloom @@ -33,7 +33,7 @@ Install requirements pip install -r requirements.txt ``` Get the pre-computed AWQ search results for multiple model families, including LLaMA, LLaMA2, MPT, OPT -```bash +```bash git clone https://huggingface.co/datasets/mit-han-lab/awq-model-zoo awq_cache ``` diff --git a/awq-py/awq/apply_awq.py b/awq-py/awq/apply_awq.py index d2d7507ef..5f2ca9d91 100644 --- a/awq-py/awq/apply_awq.py +++ b/awq-py/awq/apply_awq.py @@ -170,7 +170,7 @@ def apply_scale(module, scales_list, input_feat_dict=None): Args: module (nn.Module): The module containing the layers to be scaled. scales_list (List[Tuple[str, List[str], torch.Tensor]]): A list of tuples containing: - * prev_op_name (str): The name of the preceding operation or module, + * prev_op_name (str): The name of the preceding operation or module, relative to which the layers to be scaled are located. * layer_names (List[str]): A list of names of the layers to be scaled, relative to the preceding operation. * scales (torch.Tensor): A 1D tensor of size (num_features,) containing the scaling factors for each feature. @@ -237,7 +237,7 @@ def apply_clip(module, clip_list): def add_scale_weights(model_path, scale_path, tmp_path): """ - Adds pre-computed Activation Weight Quantization (AWQ) results to a model, + Adds pre-computed Activation Weight Quantization (AWQ) results to a model, including scaling factors and clipping bounds. Args: diff --git a/awq-py/requirements.txt b/awq-py/requirements.txt index 097a0b6c0..5fe604329 100644 --- a/awq-py/requirements.txt +++ b/awq-py/requirements.txt @@ -1,2 +1,2 @@ torch>=2.0.0 -transformers>=4.32.0 \ No newline at end of file +transformers>=4.32.0 diff --git a/convert-hf-to-gguf.py b/convert-hf-to-gguf.py index 78add8fae..200608722 100755 --- a/convert-hf-to-gguf.py +++ b/convert-hf-to-gguf.py @@ -1041,7 +1041,7 @@ dir_model = args.model if args.awq_path: sys.path.insert(1, str(Path(__file__).parent / 'awq-py')) - from awq.apply_awq import add_scale_weights + from awq.apply_awq import add_scale_weights tmp_model_path = args.model / "weighted_model" dir_model = tmp_model_path if tmp_model_path.is_dir(): @@ -1050,7 +1050,7 @@ if args.awq_path: tmp_model_path.mkdir(parents=True, exist_ok=True) print("Saving new weighted model ...") add_scale_weights(str(args.model), str(args.awq_path), str(tmp_model_path)) - print(f"Saved weighted model at {tmp_model_path}.") + print(f"Saved weighted model at {tmp_model_path}.") if not dir_model.is_dir(): print(f'Error: {args.model} is not a directory', file=sys.stderr) diff --git a/convert.py b/convert.py index 24fa449eb..0a39f998c 100755 --- a/convert.py +++ b/convert.py @@ -1201,7 +1201,7 @@ def main(args_in: list[str] | None = None) -> None: args = parser.parse_args(args_in) if args.awq_path: sys.path.insert(1, str(Path(__file__).parent / 'awq-py')) - from awq.apply_awq import add_scale_weights + from awq.apply_awq import add_scale_weights tmp_model_path = args.model / "weighted_model" if tmp_model_path.is_dir(): print(f"{tmp_model_path} exists as a weighted model.") @@ -1209,9 +1209,9 @@ def main(args_in: list[str] | None = None) -> None: tmp_model_path.mkdir(parents=True, exist_ok=True) print("Saving new weighted model ...") add_scale_weights(str(args.model), str(args.awq_path), str(tmp_model_path)) - print(f"Saved weighted model at {tmp_model_path}.") + print(f"Saved weighted model at {tmp_model_path}.") args.model = tmp_model_path - + if args.dump_single: model_plus = lazy_load_file(args.model) do_dump_model(model_plus) diff --git a/gguf-py/gguf/tensor_mapping.py b/gguf-py/gguf/tensor_mapping.py index be70f7249..cd063957c 100644 --- a/gguf-py/gguf/tensor_mapping.py +++ b/gguf-py/gguf/tensor_mapping.py @@ -180,7 +180,7 @@ class TensorNameMap: "layers.{bid}.feed_forward.experts.{xid}.w3", # mixtral "model.layers.{bid}.block_sparse_moe.experts.{xid}.w3", # mixtral ), - + # AWQ-activation gate MODEL_TENSOR.FFN_ACT: ( "transformer.blocks.{bid}.ffn.act", # mpt