setup.py 1.96 KB
Newer Older
qwopqwop200's avatar
qwopqwop200 committed
1
import os
2
import sys
qwopqwop200's avatar
qwopqwop200 committed
3
4
5
6
7
8
import torch
from pathlib import Path
from setuptools import setup, find_packages

os.environ["CC"] = "g++"
os.environ["CXX"] = "g++"
Casper's avatar
Casper committed
9
AUTOAWQ_VERSION = "0.1.8"
Casper's avatar
Casper committed
10
PYPI_BUILD = os.getenv("PYPI_BUILD", "0") == "1"
qwopqwop200's avatar
qwopqwop200 committed
11

Casper's avatar
Casper committed
12
13
14
if not PYPI_BUILD:
    try:
        CUDA_VERSION = "".join(os.environ.get("CUDA_VERSION", torch.version.cuda).split("."))[:3]
Casper's avatar
Casper committed
15
        AUTOAWQ_VERSION += f"+cu{CUDA_VERSION}"
Casper's avatar
Casper committed
16
17
    except Exception as ex:
        raise RuntimeError("Your system must have an Nvidia GPU for installing AutoAWQ")
Casper's avatar
Casper committed
18

qwopqwop200's avatar
qwopqwop200 committed
19
common_setup_kwargs = {
Casper's avatar
Casper committed
20
    "version": AUTOAWQ_VERSION,
qwopqwop200's avatar
qwopqwop200 committed
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
    "name": "autoawq",
    "author": "Casper Hansen",
    "license": "MIT",
    "python_requires": ">=3.8.0",
    "description": "AutoAWQ implements the AWQ algorithm for 4-bit quantization with a 2x speedup during inference.",
    "long_description": (Path(__file__).parent / "README.md").read_text(encoding="UTF-8"),
    "long_description_content_type": "text/markdown",
    "url": "https://github.com/casper-hansen/AutoAWQ",
    "keywords": ["awq", "autoawq", "quantization", "transformers"],
    "platforms": ["linux", "windows"],
    "classifiers": [
        "Environment :: GPU :: NVIDIA CUDA :: 11.8",
        "Environment :: GPU :: NVIDIA CUDA :: 12",
        "License :: OSI Approved :: MIT License",
        "Natural Language :: English",
        "Programming Language :: Python :: 3.8",
        "Programming Language :: Python :: 3.9",
        "Programming Language :: Python :: 3.10",
        "Programming Language :: Python :: 3.11",
        "Programming Language :: C++",
    ]
}

requirements = [
45
    "autoawq-kernels",
Casper's avatar
Casper committed
46
    "torch>=2.0.1",
47
    "transformers>=4.35.0",
qwopqwop200's avatar
qwopqwop200 committed
48
49
50
51
52
53
54
55
56
    "tokenizers>=0.12.1",
    "accelerate",
    "sentencepiece",
    "lm_eval",
    "texttable",
    "toml",
    "attributedict",
    "protobuf",
    "torchvision",
57
    "tabulate",
qwopqwop200's avatar
qwopqwop200 committed
58
59
60
61
62
63
]

setup(
    packages=find_packages(),
    install_requires=requirements,
    **common_setup_kwargs
64
)