Skip to content

Commit 94e970c

Browse files
committed
update setup
1 parent 337b492 commit 94e970c

File tree

3 files changed

+33
-4
lines changed

3 files changed

+33
-4
lines changed

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,12 @@ conda install tbb-devel
77
```
88
2. If using python wrapper (Todo: automate pip installation)
99

10-
a. Install pybind11, simply:
10+
a. Using pip:
1111
```
12-
pip install pybind11
12+
pip install -r requirements.txt
13+
pip install .
1314
```
14-
b. Compile greedy_builder
15+
b. Or compile manually e.g. (have to specify links)
1516
```
1617
c++ -O3 -Wall -shared -std=c++20 \
1718
-fPIC $(python3 -m pybind11 --includes) \
@@ -26,7 +27,7 @@ conda install tbb-devel
2627
c. import and use! Examples in [eval_tokenizer_example.ipynb](https://github.com/PreferredAI/aoatt/blob/main/eval_tokenizer_example.ipynb)
2728
3. If using C++ files directly
2829
29-
a. Compile greedy_cache.py
30+
a. Compile greedy_cache.py e.g.:
3031
```
3132
c++ -O3 -std=c++20 \
3233
-I$CONDA_PREFIX/include/ \

requirements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
pybind11
2+
tbb-devel

setup.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import pip
2+
from sysconfig import get_path
3+
from setuptools import setup, Extension
4+
5+
PATH_PREFIX = get_path('data')
6+
module1 = Extension(f'greedy_builder',
7+
extra_compile_args = ["-O3", "-std=c++20"],
8+
define_macros = [('MAJOR_VERSION', '0'),
9+
('MINOR_VERSION', '1')],
10+
include_dirs = [f'{PATH_PREFIX}/include/',
11+
f'{PATH_PREFIX}/include/tbb',
12+
f'{PATH_PREFIX}/include/oneapi'],
13+
library_dirs = [f'{PATH_PREFIX}/lib/'],
14+
libraries = ['tbb'],
15+
sources = ['pcatt/greedy_builder.cpp'])
16+
17+
setup(
18+
name="greedtok",
19+
version="0.1",
20+
description="Partition Cover Approach to Tokenization",
21+
author="JP Lim",
22+
author_email="[email protected]",
23+
license = "MIT",
24+
setup_requires=['pybind11', 'tbb-devel'],
25+
ext_modules = [module1]
26+
)

0 commit comments

Comments
 (0)