Skip to content

Commit

Permalink
Update README.md with Windows use note
Browse files Browse the repository at this point in the history
Note the need to have freeze_support()  in your main file on Windows only
  • Loading branch information
stevereiner authored Sep 19, 2024
1 parent 25d06f3 commit 588d0c3
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 588d0c3

Please sign in to comment.