diff --git a/README.md b/README.md index 7206b665..8c646f27 100644 --- a/README.md +++ b/README.md @@ -90,6 +90,12 @@ We have provided the hyper-parameters of some models to achieve the state-of-the We are still trying more hyper-parameters and more training strategies (e.g., adversarial training and label smoothing regularization) for these models. Hence, this table is still in change. We welcome everyone to help us update this table and hyper-parameters. +## Pip Install + +``` sh +./build.sh # build wheel file +pip install openke_***.whl # install +``` ## Installation diff --git a/build.sh b/build.sh new file mode 100755 index 00000000..65fa8b71 --- /dev/null +++ b/build.sh @@ -0,0 +1,6 @@ +python setup.py bdist_wheel -d ./ + +rm -rf *.so +rm -rf *.egg-info +rm -rf build +rm -rf dist diff --git a/setup.py b/setup.py new file mode 100644 index 00000000..fad4f8cd --- /dev/null +++ b/setup.py @@ -0,0 +1,29 @@ +from setuptools import setup, find_packages, Extension + +version = '0.1.0' + +# g++ ./base/Base.cpp -fPIC -shared -o Base.so -pthread -O3 -march=native + +setup( + name="openke", + version=version, + license='MIT', + description='Pytorch Wrapper of C++ OpenKE-PyTorch', + author='thunlp', + url='https://github.com/thunlp/OpenKE', + packages=find_packages(), + ext_modules=[ + Extension( + 'base', + extra_compile_args=["-fPIC", "-shared", "-pthread", "-O3", "-march=native"], + extra_link_args=["-o", "OpenKEBase.so"], + sources=['./openke/base/Base.cpp'] + ) + ], + data_files=[('lib', ['OpenKEBase.so'])], + install_requires=[ + 'numpy==1.16.4', + 'scipy', + 'torch==1.2.0' + ], +)