Skip to content

Commit 85d28ee

Browse files
committed
Update installation and build instructions
1 parent 7270083 commit 85d28ee

File tree

1 file changed

+27
-9
lines changed

1 file changed

+27
-9
lines changed

README.md

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,28 +16,42 @@ embeddings as rust2vec:
1616
* Memory-mapped
1717
* Quantized
1818

19-
## Building the module
19+
## Installation
2020

21-
First, you need `pyo3-pack`:
21+
The finalfusion module is
22+
[available](https://pypi.org/project/finalfusion/#files) on PyPi for some
23+
platforms. You can use `pip` to install the module:
24+
25+
~~~shell
26+
$ pip install --upgrade finalfusion
27+
~~~
28+
29+
## Building from source
30+
31+
finalfusion can also be built from source. This requires a Rust toolchain
32+
that is installed through rustup. First, you need `pyo3-pack`:
2233

2334
~~~shell
2435
$ cargo install pyo3-pack
2536
~~~
2637

27-
Now you can build finalfusion-python in a virtual environment:
38+
finalfusion currently requires a nightly version of Rust. You can use rustup
39+
to switch to a nightly build:
2840

2941
~~~shell
30-
$ python3 -m venv ff-env
31-
$ source ff-env/bin/activate
32-
$ pyo3-pack develop --release
42+
# Use the nightly toolchain in the current directory.
43+
$ rustup override set nightly
3344
~~~
3445

35-
To build a wheel:
46+
Now you can build finalfusion-python wheels for Python versions that are
47+
detected by `pyo3-pack`:
3648

3749
~~~shell
3850
$ pyo3-pack build --release
3951
~~~
4052

53+
The wheels are then in the `target/wheels` directory.
54+
4155
## Getting embeddings
4256

4357
rust2vec uses its own embedding format, which supports memory mapping,
@@ -55,10 +69,10 @@ finalfusion embeddings can be loaded as follows:
5569

5670
~~~python
5771
import finalfusion
58-
embeds = finalfusion.Embeddings("/Users/daniel/twe.fifu")
72+
embeds = finalfusion.Embeddings("myembeddings.fifu")
5973

6074
# Or if you want to memory-map the embedding matrix:
61-
embeds = finalfusion.Embeddings("/Users/daniel/twe.fifu", mmap=True)
75+
embeds = finalfusion.Embeddings("myembeddings", mmap=True)
6276
~~~
6377

6478
You can then compute an embedding, perform similarity queries, or analogy
@@ -70,6 +84,10 @@ embeds.similarity("Tübingen")
7084
embeds.analogy("Berlin", "Deutschland", "Amsterdam")
7185
~~~
7286

87+
More usage examples can be found in the
88+
[examples](https://github.com/danieldk/finalfusion-python/tree/master/examples)
89+
directory.
90+
7391
## Where to go from here
7492

7593
* [finalfrontier](https://github.com/danieldk/finalfrontier)

0 commit comments

Comments
 (0)