[PyPI] Packaging for PyPI distribution (#140)
This commit is contained in:
parent
456941cfe4
commit
376725ce74
1
.gitignore
vendored
1
.gitignore
vendored
@ -7,6 +7,7 @@
|
||||
*.csv
|
||||
build/
|
||||
docs/build/
|
||||
dist/
|
||||
|
||||
*.pkl
|
||||
*.png
|
||||
|
4
MANIFEST.in
Normal file
4
MANIFEST.in
Normal file
@ -0,0 +1,4 @@
|
||||
include LICENSE
|
||||
include requirements.txt
|
||||
|
||||
recursive-include csrc *
|
@ -5,6 +5,8 @@ from cacheflow.server.arg_utils import ServerArgs
|
||||
from cacheflow.server.llm_server import LLMServer
|
||||
from cacheflow.server.ray_utils import initialize_cluster
|
||||
|
||||
__version__ = "0.1.0"
|
||||
|
||||
__all__ = [
|
||||
"LLM",
|
||||
"SamplingParams",
|
||||
|
0
cacheflow/core/__init__.py
Normal file
0
cacheflow/core/__init__.py
Normal file
0
cacheflow/entrypoints/__init__.py
Normal file
0
cacheflow/entrypoints/__init__.py
Normal file
0
cacheflow/entrypoints/openai/__init__.py
Normal file
0
cacheflow/entrypoints/openai/__init__.py
Normal file
0
cacheflow/model_executor/layers/__init__.py
Normal file
0
cacheflow/model_executor/layers/__init__.py
Normal file
0
cacheflow/server/__init__.py
Normal file
0
cacheflow/server/__init__.py
Normal file
0
cacheflow/worker/__init__.py
Normal file
0
cacheflow/worker/__init__.py
Normal file
@ -32,7 +32,7 @@ You can install CacheFlow using pip:
|
||||
$ conda activate myenv
|
||||
|
||||
$ # Install CacheFlow.
|
||||
$ pip install cacheflow
|
||||
$ pip install cacheflow # This may take 5-10 minutes.
|
||||
|
||||
|
||||
.. _build_from_source:
|
||||
@ -46,5 +46,4 @@ You can also build and install CacheFlow from source.
|
||||
|
||||
$ git clone https://github.com/WoosukKwon/cacheflow.git
|
||||
$ cd cacheflow
|
||||
$ pip install -r requirements.txt
|
||||
$ pip install -e . # This may take 5-10 minutes.
|
||||
|
9
pyproject.toml
Normal file
9
pyproject.toml
Normal file
@ -0,0 +1,9 @@
|
||||
[build-system]
|
||||
requires = [
|
||||
"ninja",
|
||||
"packaging",
|
||||
"setuptools",
|
||||
"torch >= 2.0.0",
|
||||
"wheel",
|
||||
]
|
||||
build-backend = "setuptools.build_meta"
|
60
setup.py
60
setup.py
@ -1,17 +1,24 @@
|
||||
import io
|
||||
import os
|
||||
import re
|
||||
import subprocess
|
||||
from typing import List, Set
|
||||
|
||||
from packaging.version import parse, Version
|
||||
import setuptools
|
||||
import torch
|
||||
from torch.utils.cpp_extension import BuildExtension, CUDAExtension
|
||||
from torch.utils.cpp_extension import CUDA_HOME
|
||||
from torch.utils.cpp_extension import BuildExtension, CUDAExtension, CUDA_HOME
|
||||
|
||||
ROOT_DIR = os.path.dirname(__file__)
|
||||
|
||||
# Compiler flags.
|
||||
CXX_FLAGS = ["-g", "-O2"]
|
||||
CXX_FLAGS = ["-g", "-O2", "-std=c++17"]
|
||||
# TODO(woosuk): Should we use -O3?
|
||||
NVCC_FLAGS = ["-O2"]
|
||||
NVCC_FLAGS = ["-O2", "-std=c++17"]
|
||||
|
||||
ABI = 1 if torch._C._GLIBCXX_USE_CXX11_ABI else 0
|
||||
CXX_FLAGS += [f"-D_GLIBCXX_USE_CXX11_ABI={ABI}"]
|
||||
NVCC_FLAGS += [f"-D_GLIBCXX_USE_CXX11_ABI={ABI}"]
|
||||
|
||||
if not torch.cuda.is_available():
|
||||
raise RuntimeError(
|
||||
@ -102,15 +109,58 @@ activation_extension = CUDAExtension(
|
||||
ext_modules.append(activation_extension)
|
||||
|
||||
|
||||
def get_path(*filepath) -> str:
|
||||
return os.path.join(ROOT_DIR, *filepath)
|
||||
|
||||
|
||||
def find_version(filepath: str):
|
||||
"""Extract version information from the given filepath.
|
||||
|
||||
Adapted from https://github.com/ray-project/ray/blob/0b190ee1160eeca9796bc091e07eaebf4c85b511/python/setup.py
|
||||
"""
|
||||
with open(filepath) as fp:
|
||||
version_match = re.search(
|
||||
r"^__version__ = ['\"]([^'\"]*)['\"]", fp.read(), re.M)
|
||||
if version_match:
|
||||
return version_match.group(1)
|
||||
raise RuntimeError("Unable to find version string.")
|
||||
|
||||
|
||||
def read_readme() -> str:
|
||||
"""Read the README file."""
|
||||
return io.open(get_path("README.md"), "r", encoding="utf-8").read()
|
||||
|
||||
|
||||
def get_requirements() -> List[str]:
|
||||
"""Get Python package dependencies from requirements.txt."""
|
||||
with open("requirements.txt") as f:
|
||||
with open(get_path("requirements.txt")) as f:
|
||||
requirements = f.read().strip().split("\n")
|
||||
return requirements
|
||||
|
||||
|
||||
setuptools.setup(
|
||||
name="cacheflow",
|
||||
version=find_version(get_path("cacheflow", "__init__.py")),
|
||||
author="CacheFlow Team",
|
||||
author_email="cacheflow@gmail.com",
|
||||
license="Apache 2.0",
|
||||
description="CacheFlow: A high-performance LLM Serving System",
|
||||
long_description=read_readme(),
|
||||
long_description_content_type="text/markdown",
|
||||
url="https://github.com/WoosukKwon/cacheflow",
|
||||
project_urls={
|
||||
"Homepage": "https://github.com/WoosukKwon/cacheflow",
|
||||
"Documentation": "https://cacheflow.readthedocs.io/en/latest/",
|
||||
},
|
||||
classifiers=[
|
||||
"Programming Language :: Python :: 3.8",
|
||||
"Programming Language :: Python :: 3.9",
|
||||
"Programming Language :: Python :: 3.10",
|
||||
"License :: OSI Approved :: Apache Software License",
|
||||
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
||||
],
|
||||
packages=setuptools.find_packages(
|
||||
exclude=("benchmarks", "csrc", "docs", "examples", "tests")),
|
||||
python_requires=">=3.8",
|
||||
install_requires=get_requirements(),
|
||||
ext_modules=ext_modules,
|
||||
|
Loading…
x
Reference in New Issue
Block a user