-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsetup.py
47 lines (42 loc) · 1.43 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
from sysconfig import get_path
from setuptools import setup, Extension
from pathlib import Path
PATH_PREFIXES = [get_path(p) for p in ['data', 'platlib']]
modules = []
include_dirs = [
path
for prefix in PATH_PREFIXES
for path in [
f"{prefix}/include/",
f"{prefix}/include/tbb",
f"{prefix}/pybind11/include"
]
]
for code in ["greedy_builder", "greedy_encoder", "pco_tokenizer"]:
modules.append(
Extension(
f"pcatt.{code}",
extra_compile_args=["-O3", "-std=c++23"],
define_macros=[("MAJOR_VERSION", "0"), ("MINOR_VERSION", "14-beta")],
include_dirs=include_dirs,
library_dirs=[f"{prefix}/lib/" for prefix in PATH_PREFIXES] ,
libraries=["tbb"],
sources=[f"pcatt/{code}.cpp"],
)
)
this_directory = Path(__file__).parent
long_description = (this_directory / "README.md").read_text()
setup(
name="greedtok",
version="0.14-beta",
description="Partition Cover Approach to Tokenization",
author="JP Lim",
author_email="[email protected]",
license="MIT",
setup_requires=["pybind11", "tbb-devel", "transformers>=4.4"],
url="https://github.com/PreferredAI/pcatt/",
download_url="https://github.com/PreferredAI/pcatt/archive/refs/tags/v0.14-beta8.tar.gz",
ext_modules=modules,
long_description=long_description,
long_description_content_type="text/markdown",
)