Skip to content

Commit a9941db

Browse files
committed
Add build and usage instructions to the README.
1 parent c2f9ca1 commit a9941db

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

README.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,47 @@ finalfrontier-python is a Python module for
77
finalfrontier-python is still under development, precompiled modules will be
88
made available in the future.
99

10+
## Building the module
11+
12+
First, you need `pyo3-pack`:
13+
14+
~~~shell
15+
$ cargo install pyo3-pack
16+
~~~
17+
18+
Now you can build finalfrontier-python in a virtual environment:
19+
20+
~~~shell
21+
$ python3 -m venv ff-env
22+
$ source ff-env/bin/activate
23+
$ pyo3-pack develop --release
24+
~~~
25+
26+
To build a wheel:
27+
28+
~~~shell
29+
$ pyo3-pack build --release
30+
~~~
31+
32+
## Usage
33+
34+
A finalfrontier model can be loaded as follows:
35+
36+
~~~python
37+
import finalfrontier
38+
model = finalfrontier.Model("/Users/daniel/git/finalfrontier/throwaway.bin")
39+
~~~
40+
41+
You can then compute an embedding, perform similarity queries, or analogy
42+
queries:
43+
44+
~~~python
45+
e = model.embedding("Tübingen")
46+
model.similarity("Tübingen")
47+
model.analogy("Berlin", "Deutschland", "Amsterdam")
48+
~~~
49+
50+
1051
## Where to go from here
1152

1253
* [finalfrontier](https://git.danieldk.eu/finalfrontier/about)

0 commit comments

Comments
 (0)