File tree Expand file tree Collapse file tree 3 files changed +33
-4
lines changed
Expand file tree Collapse file tree 3 files changed +33
-4
lines changed Original file line number Diff line number Diff line change @@ -7,11 +7,12 @@ conda install tbb-devel
77```
882 . 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)
27283. 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/ \
Original file line number Diff line number Diff line change 1+ pybind11
2+ tbb-devel
Original file line number Diff line number Diff line change 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+ 23+ license = "MIT" ,
24+ setup_requires = ['pybind11' , 'tbb-devel' ],
25+ ext_modules = [module1 ]
26+ )
You can’t perform that action at this time.
0 commit comments