From 799426e0b7b7a867d23c783659d4024c4fab0756 Mon Sep 17 00:00:00 2001 From: Steve Reiner Date: Wed, 18 Sep 2024 22:06:52 -0400 Subject: [PATCH 1/8] fix being able build from source on windows In setup,py , added open readme.md with utf-8 encoding for setting the long description. That's all it took to be able to fix being able to build from source on windows --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 672455f..520d0dd 100644 --- a/setup.py +++ b/setup.py @@ -106,7 +106,7 @@ def fix_url_dependencies(req: str) -> str: with open("relik/version.py", "r") as version_file: exec(version_file.read(), VERSION) -with open("README.md", "r") as fh: +with open("README.md", "r", encoding="utf-8") as fh: long_description = fh.read() setuptools.setup( From 25d06f34ffd6ded1a3845ddb80084744d00996c6 Mon Sep 17 00:00:00 2001 From: Steve Reiner Date: Wed, 18 Sep 2024 22:10:31 -0400 Subject: [PATCH 2/8] Update version.py Update from from 1.0.7 to 1.08 (for windows support, and re-enable python 3.12) --- relik/version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/relik/version.py b/relik/version.py index e542a81..7060445 100644 --- a/relik/version.py +++ b/relik/version.py @@ -4,7 +4,7 @@ _MINOR = "0" # On main and in a nightly release the patch should be one ahead of the last # released build. -_PATCH = "7" +_PATCH = "8" # This is mainly for nightly builds which have the suffix ".dev$DATE". See # https://semver.org/#is-v123-a-semantic-version for the semantics. _SUFFIX = os.environ.get("RELIK_VERSION_SUFFIX", "") From 588d0c3295f79334a5e59c2d4e6de46b05013de1 Mon Sep 17 00:00:00 2001 From: Steve Reiner Date: Wed, 18 Sep 2024 22:46:35 -0400 Subject: [PATCH 3/8] Update README.md with Windows use note Note the need to have freeze_support() in your main file on Windows only --- README.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/README.md b/README.md index 2bfe37e..804930e 100644 --- a/README.md +++ b/README.md @@ -307,6 +307,25 @@ Output: ), ) +### Note on use on Windows only +On Windows only, in your main starting file you need freeze_support() even if its just a python file (not the documented "only if frozen to produce an executable"). +Otherwise you can get a RuntimeError: "An attempt has been made to start a new process before the current process has finished its bootstrapping phase." +Also need to have a main function: + +```python +from relik import Relik +from relik.inference.data.objects import RelikOutput +from multiprocessing import freeze_support + +def main(): + relik = Relik.from_pretrained("sapienzanlp/relik-entity-linking-large") + relik_out: RelikOutput = relik("Michael Jordan was one of the best players in the NBA.") + +if __name__ == "__main__": + freeze_support() + main() +``` + ### CLI ReLiK provides a CLI to serve a [FastAPI](https://fastapi.tiangolo.com/) server for the model or to perform inference on a dataset. From 4eecc0d9ab699bc563ac4fc0de04115d16df0e9c Mon Sep 17 00:00:00 2001 From: Steve Reiner Date: Tue, 24 Sep 2024 15:40:54 -0400 Subject: [PATCH 4/8] Update readme Windows note Updated README.md note on use on Windows to indicate only main function needed, not also freeze_support. Also noted that llama index RelikPathExtractor / PropertyGraphIndex runs 8 times slower for me on Windows vs Linux --- README.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 804930e..52ad2d6 100644 --- a/README.md +++ b/README.md @@ -308,9 +308,10 @@ Output: ) ### Note on use on Windows only -On Windows only, in your main starting file you need freeze_support() even if its just a python file (not the documented "only if frozen to produce an executable"). -Otherwise you can get a RuntimeError: "An attempt has been made to start a new process before the current process has finished its bootstrapping phase." -Also need to have a main function: +On Windows only, in your main starting file you need to have code in a function. +Otherwise you can get a RuntimeError: "An attempt has been made to start a new process before the current process has finished its bootstrapping phase" or hang. +Looks like all you need is having the function structure. Don't need freeze_support() unless producing an executable on Windows as documented. +Note: Llamma Index RelikPathExtractor / PropertyGraphIndex.from_documents ran about 8 times slower on Windows vs Linux whether gpu or cpu. See [relik-llama](https://github.com/stevereiner/llama-relik) ```python from relik import Relik @@ -322,7 +323,7 @@ def main(): relik_out: RelikOutput = relik("Michael Jordan was one of the best players in the NBA.") if __name__ == "__main__": - freeze_support() + #freeze_support() main() ``` From b710b0efd9217405b79c39237d20e5fd391f9f9d Mon Sep 17 00:00:00 2001 From: Steve Reiner Date: Tue, 24 Sep 2024 17:34:26 -0400 Subject: [PATCH 5/8] Update README.md Windows note llama-relik project not relik-llama --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 52ad2d6..2cbb430 100644 --- a/README.md +++ b/README.md @@ -311,7 +311,7 @@ Output: On Windows only, in your main starting file you need to have code in a function. Otherwise you can get a RuntimeError: "An attempt has been made to start a new process before the current process has finished its bootstrapping phase" or hang. Looks like all you need is having the function structure. Don't need freeze_support() unless producing an executable on Windows as documented. -Note: Llamma Index RelikPathExtractor / PropertyGraphIndex.from_documents ran about 8 times slower on Windows vs Linux whether gpu or cpu. See [relik-llama](https://github.com/stevereiner/llama-relik) +Note: Llamma Index RelikPathExtractor / PropertyGraphIndex.from_documents ran about 8 times slower on Windows vs Linux whether gpu or cpu. See [llama-relik](https://github.com/stevereiner/llama-relik) ```python from relik import Relik From 341c77ba3ce34064b2f1898dbb06abd1950eed16 Mon Sep 17 00:00:00 2001 From: Steve Reiner Date: Fri, 11 Oct 2024 16:25:43 -0400 Subject: [PATCH 6/8] Revert "Update README.md Windows note" This reverts commit b710b0efd9217405b79c39237d20e5fd391f9f9d. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2cbb430..52ad2d6 100644 --- a/README.md +++ b/README.md @@ -311,7 +311,7 @@ Output: On Windows only, in your main starting file you need to have code in a function. Otherwise you can get a RuntimeError: "An attempt has been made to start a new process before the current process has finished its bootstrapping phase" or hang. Looks like all you need is having the function structure. Don't need freeze_support() unless producing an executable on Windows as documented. -Note: Llamma Index RelikPathExtractor / PropertyGraphIndex.from_documents ran about 8 times slower on Windows vs Linux whether gpu or cpu. See [llama-relik](https://github.com/stevereiner/llama-relik) +Note: Llamma Index RelikPathExtractor / PropertyGraphIndex.from_documents ran about 8 times slower on Windows vs Linux whether gpu or cpu. See [relik-llama](https://github.com/stevereiner/llama-relik) ```python from relik import Relik From 3d82aa8e507faf340102e0d964c1a054602c87c1 Mon Sep 17 00:00:00 2001 From: Steve Reiner Date: Fri, 11 Oct 2024 16:27:19 -0400 Subject: [PATCH 7/8] Revert "Update readme Windows note" This reverts commit 4eecc0d9ab699bc563ac4fc0de04115d16df0e9c. --- README.md | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 52ad2d6..804930e 100644 --- a/README.md +++ b/README.md @@ -308,10 +308,9 @@ Output: ) ### Note on use on Windows only -On Windows only, in your main starting file you need to have code in a function. -Otherwise you can get a RuntimeError: "An attempt has been made to start a new process before the current process has finished its bootstrapping phase" or hang. -Looks like all you need is having the function structure. Don't need freeze_support() unless producing an executable on Windows as documented. -Note: Llamma Index RelikPathExtractor / PropertyGraphIndex.from_documents ran about 8 times slower on Windows vs Linux whether gpu or cpu. See [relik-llama](https://github.com/stevereiner/llama-relik) +On Windows only, in your main starting file you need freeze_support() even if its just a python file (not the documented "only if frozen to produce an executable"). +Otherwise you can get a RuntimeError: "An attempt has been made to start a new process before the current process has finished its bootstrapping phase." +Also need to have a main function: ```python from relik import Relik @@ -323,7 +322,7 @@ def main(): relik_out: RelikOutput = relik("Michael Jordan was one of the best players in the NBA.") if __name__ == "__main__": - #freeze_support() + freeze_support() main() ``` From 20faed6bac549c009ecae51fdf069fdaf98cfee9 Mon Sep 17 00:00:00 2001 From: Steve Reiner Date: Fri, 11 Oct 2024 16:28:02 -0400 Subject: [PATCH 8/8] Revert "Update README.md with Windows use note" This reverts commit 588d0c3295f79334a5e59c2d4e6de46b05013de1. --- README.md | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/README.md b/README.md index 804930e..2bfe37e 100644 --- a/README.md +++ b/README.md @@ -307,25 +307,6 @@ Output: ), ) -### Note on use on Windows only -On Windows only, in your main starting file you need freeze_support() even if its just a python file (not the documented "only if frozen to produce an executable"). -Otherwise you can get a RuntimeError: "An attempt has been made to start a new process before the current process has finished its bootstrapping phase." -Also need to have a main function: - -```python -from relik import Relik -from relik.inference.data.objects import RelikOutput -from multiprocessing import freeze_support - -def main(): - relik = Relik.from_pretrained("sapienzanlp/relik-entity-linking-large") - relik_out: RelikOutput = relik("Michael Jordan was one of the best players in the NBA.") - -if __name__ == "__main__": - freeze_support() - main() -``` - ### CLI ReLiK provides a CLI to serve a [FastAPI](https://fastapi.tiangolo.com/) server for the model or to perform inference on a dataset.