From 8ac821f0b76c40bf007f0b61e44c72a07cd5b825 Mon Sep 17 00:00:00 2001 From: Brando Date: Sun, 27 Oct 2024 16:13:35 -0400 Subject: [PATCH 1/4] fix: Use absolute imports - Switch to absolute imports in `vptq/__init__.py` to ensure `vptq.ops` is correctly located on a local setup. - Allow running `vptq` as a script without requiring the `-m` flag. - Resolve Issue #89 where CUDA kernel was not found in local setups due to relative imports. --- vptq/__init__.py | 2 +- vptq/__main__.py | 2 +- vptq/app_utils.py | 2 +- vptq/layers/__init__.py | 2 +- vptq/layers/model_base.py | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/vptq/__init__.py b/vptq/__init__.py index 3cda50f..9a18e94 100644 --- a/vptq/__init__.py +++ b/vptq/__init__.py @@ -4,4 +4,4 @@ # -------------------------------------------------------------------------- __version__ = "0.0.2.post1" -from .layers import AutoModelForCausalLM as AutoModelForCausalLM +from vptq.layers import AutoModelForCausalLM as AutoModelForCausalLM diff --git a/vptq/__main__.py b/vptq/__main__.py index e125043..bdf2ecf 100644 --- a/vptq/__main__.py +++ b/vptq/__main__.py @@ -3,6 +3,6 @@ # Licensed under the MIT License. # -------------------------------------------------------------------------- -from .app_utils import main +from vptq.app_utils import main main() diff --git a/vptq/app_utils.py b/vptq/app_utils.py index 6271279..b7e514a 100644 --- a/vptq/app_utils.py +++ b/vptq/app_utils.py @@ -9,7 +9,7 @@ import transformers -from .layers.model_base import AutoModelForCausalLM as VQAutoModelQuantization +from vptq.layers.model_base import AutoModelForCausalLM as VQAutoModelQuantization def define_basic_args(): diff --git a/vptq/layers/__init__.py b/vptq/layers/__init__.py index f68bf61..2035f9d 100644 --- a/vptq/layers/__init__.py +++ b/vptq/layers/__init__.py @@ -3,4 +3,4 @@ # Licensed under the MIT License. # -------------------------------------------------------------------------- -from .model_base import AutoModelForCausalLM as AutoModelForCausalLM \ No newline at end of file +from vptq.layers.model_base import AutoModelForCausalLM as AutoModelForCausalLM diff --git a/vptq/layers/model_base.py b/vptq/layers/model_base.py index 03f0880..05a2547 100644 --- a/vptq/layers/model_base.py +++ b/vptq/layers/model_base.py @@ -14,7 +14,7 @@ import transformers from tqdm import tqdm -from .vqlinear import VQuantLinear +from vptq.layers.vqlinear import VQuantLinear def set_op_by_name(layer, name, new_module): From f8686dd3dd61b0991ad30ad91e2caa01f66b1104 Mon Sep 17 00:00:00 2001 From: Yang Wang Date: Mon, 28 Oct 2024 15:30:20 +0800 Subject: [PATCH 2/4] Update app_utils.py fix format check --- vptq/app_utils.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/vptq/app_utils.py b/vptq/app_utils.py index b7e514a..e746e4a 100644 --- a/vptq/app_utils.py +++ b/vptq/app_utils.py @@ -9,7 +9,8 @@ import transformers -from vptq.layers.model_base import AutoModelForCausalLM as VQAutoModelQuantization +from vptq.layers.model_base import ( + AutoModelForCausalLM as VQAutoModelQuantization) def define_basic_args(): From 7b530ffbf2ca4930df7a03dd9c1c71ddf9752024 Mon Sep 17 00:00:00 2001 From: Yang Wang Date: Mon, 28 Oct 2024 16:12:00 +0800 Subject: [PATCH 3/4] Update app_utils.py --- vptq/app_utils.py | 1 - 1 file changed, 1 deletion(-) diff --git a/vptq/app_utils.py b/vptq/app_utils.py index 6ea9aa3..ec85017 100644 --- a/vptq/app_utils.py +++ b/vptq/app_utils.py @@ -9,7 +9,6 @@ import transformers - from vptq.layers.model_base import AutoModelForCausalLM as VQAutoModelQuantization From dad1b989f65353812a6ea8b8af927d4f7a644c4c Mon Sep 17 00:00:00 2001 From: Yang Wang Date: Mon, 28 Oct 2024 16:12:51 +0800 Subject: [PATCH 4/4] Update model_base.py --- vptq/layers/model_base.py | 1 - 1 file changed, 1 deletion(-) diff --git a/vptq/layers/model_base.py b/vptq/layers/model_base.py index 1c7b3ac..bf7107e 100644 --- a/vptq/layers/model_base.py +++ b/vptq/layers/model_base.py @@ -14,7 +14,6 @@ import transformers from tqdm import tqdm - from vptq.layers.vqlinear import VQuantLinear