Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
AutoAWQ
Commits
870a9dc9
Commit
870a9dc9
authored
Aug 24, 2023
by
Casper Hansen
Browse files
Refactor into one setup.py
parent
d9bab50c
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
56 additions
and
54 deletions
+56
-54
awq/kernels/setup.py
awq/kernels/setup.py
+0
-26
pyproject.toml
pyproject.toml
+0
-28
setup.py
setup.py
+56
-0
No files found.
awq/kernels/setup.py
deleted
100644 → 0
View file @
d9bab50c
from
setuptools
import
find_packages
,
setup
from
torch.utils.cpp_extension
import
BuildExtension
,
CUDAExtension
,
CppExtension
extra_compile_args
=
{
"cxx"
:
[
"-g"
,
"-O3"
,
"-fopenmp"
,
"-lgomp"
,
"-std=c++17"
],
"nvcc"
:
[
"-O3"
,
"-std=c++17"
],
}
setup
(
name
=
"awq_inference_engine"
,
packages
=
find_packages
(),
ext_modules
=
[
CUDAExtension
(
name
=
"awq_inference_engine"
,
sources
=
[
"csrc/pybind.cpp"
,
"csrc/quantization/gemm_cuda_gen.cu"
,
"csrc/layernorm/layernorm.cu"
,
"csrc/position_embedding/pos_encoding_kernels.cu"
],
extra_compile_args
=
extra_compile_args
,
),
],
cmdclass
=
{
"build_ext"
:
BuildExtension
},
install_requires
=
[
"torch"
],
)
pyproject.toml
deleted
100644 → 0
View file @
d9bab50c
[build-system]
requires
=
["setuptools>=61.0"]
build-backend
=
"setuptools.build_meta"
[project]
name
=
"awq"
version
=
"0.1.0"
description
=
"An efficient and accurate low-bit weight quantization(INT3/4) method for LLMs."
readme
=
"README.md"
requires-python
=
">=3.8"
classifiers
=
[
"Programming Language :: Python :: 3"
,
"License :: OSI Approved :: Apache Software License"
,
]
dependencies
=
[
"accelerate"
,
"sentencepiece"
,
"tokenizers>=0.12.1"
,
"torch>=2.0.0"
,
"torchvision"
,
"transformers>=4.31.0"
,
"lm_eval"
,
"texttable"
,
"toml"
,
"attributedict"
,
"protobuf"
]
[tool.setuptools.packages.find]
exclude
=
[
"results*"
,
"scripts*"
,
"examples*"
]
[tool.wheel]
exclude
=
[
"results*"
,
"scripts*"
,
"examples*"
]
setup.py
0 → 100644
View file @
870a9dc9
import
os
from
setuptools
import
setup
,
find_packages
from
torch.utils.cpp_extension
import
BuildExtension
,
CUDAExtension
# Get environment variables
build_cuda_extension
=
os
.
environ
.
get
(
'BUILD_CUDA_EXT'
,
'1'
)
==
'1'
torch_is_prebuilt
=
os
.
environ
.
get
(
'TORCH_IS_PREBUILT'
,
'0'
)
==
'1'
# Define dependencies
dependencies
=
[
"accelerate"
,
"sentencepiece"
,
"tokenizers>=0.12.1"
,
"transformers>=4.32.0"
,
"lm_eval"
,
"texttable"
,
"toml"
,
"attributedict"
,
"protobuf"
]
if
not
torch_is_prebuilt
:
dependencies
.
extend
([
"torch>=2.0.0"
,
"torchvision"
])
# Setup CUDA extension
ext_modules
=
[]
if
build_cuda_extension
:
ext_modules
.
append
(
CUDAExtension
(
name
=
"awq_inference_engine"
,
sources
=
[
"awq/kernels/csrc/pybind.cpp"
,
"awq/kernels/csrc/quantization/gemm_cuda_gen.cu"
,
"awq/kernels/csrc/layernorm/layernorm.cu"
,
"awq/kernels/csrc/position_embedding/pos_encoding_kernels.cu"
],
extra_compile_args
=
{
"cxx"
:
[
"-g"
,
"-O3"
,
"-fopenmp"
,
"-lgomp"
,
"-std=c++17"
],
"nvcc"
:
[
"-O3"
,
"-std=c++17"
]
},
)
)
setup
(
name
=
"awq"
,
version
=
"0.1.0"
,
description
=
"An efficient and accurate low-bit weight quantization(INT3/4) method for LLMs."
,
long_description
=
open
(
"README.md"
,
"r"
).
read
(),
long_description_content_type
=
"text/markdown"
,
python_requires
=
">=3.8"
,
classifiers
=
[
"Programming Language :: Python :: 3"
,
"License :: OSI Approved :: Apache Software License"
,
],
install_requires
=
dependencies
,
packages
=
find_packages
(
exclude
=
[
"results*"
,
"scripts*"
,
"examples*"
]),
ext_modules
=
ext_modules
,
cmdclass
=
{
"build_ext"
:
BuildExtension
}
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment