From 7261a0c49e689ea000364c1f8623c2dc40bf213d Mon Sep 17 00:00:00 2001 From: nlp4whp Date: Wed, 9 Jun 2021 15:34:50 +0800 Subject: [PATCH 1/3] add setup.py --- build.sh | 6 ++++++ setup.py | 29 +++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100755 build.sh create mode 100644 setup.py 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' + ], +) From c51603162b7109f7c7ea0b91950f6e0c7d94a489 Mon Sep 17 00:00:00 2001 From: nlp4whp Date: Wed, 9 Jun 2021 15:37:15 +0800 Subject: [PATCH 2/3] add setup.py note --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index 7206b665..11687575 100644 --- a/README.md +++ b/README.md @@ -90,6 +90,13 @@ 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 +twine upload -r openke-***.whl +pip install openke -i +``` ## Installation From 612d15c52f31d1cf0769d0deb9ac56220b352f4b Mon Sep 17 00:00:00 2001 From: nlp4whp <41564365+nlp4whp@users.noreply.github.com> Date: Sat, 15 Oct 2022 11:30:44 +0800 Subject: [PATCH 3/3] Update README.md pip install with wheel file --- README.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 11687575..8c646f27 100644 --- a/README.md +++ b/README.md @@ -93,9 +93,8 @@ We have provided the hyper-parameters of some models to achieve the state-of-the ## Pip Install ``` sh -./build.sh -twine upload -r openke-***.whl -pip install openke -i +./build.sh # build wheel file +pip install openke_***.whl # install ``` ## Installation