Add better docs and threading support to bert.

This commit is contained in:
Adam Treat
2023-07-14 14:12:09 -04:00
parent 6c8669cad3
commit f543affa9a
6 changed files with 66 additions and 25 deletions

View File

@@ -1,8 +1,7 @@
# GPT4All Python API
# GPT4All Python Generation API
The `GPT4All` python package provides bindings to our C/C++ model backend libraries.
The source code and local build instructions can be found [here](https://github.com/nomic-ai/gpt4all/tree/main/gpt4all-bindings/python).
## Quickstart
```bash
@@ -109,22 +108,5 @@ with model.chat_session():
print(model.current_chat_session)
```
### Generating embeddings
GPT4All includes a super simple means of generating embeddings for your text documents. The embedding model will automatically be downloaded if not installed.
=== "Embed4All Example"
``` py
from gpt4all import GPT4All, Embed4All
text = 'The quick brown fox jumps over the lazy dog'
embedder = Embed4All()
output = embedder.embed(text)
print(output)
```
=== "Output"
```
[0.034696947783231735, -0.07192722707986832, 0.06923297047615051, ...]
```
### API documentation
::: gpt4all.gpt4all.GPT4All
::: gpt4all.gpt4all.Embed4All

View File

@@ -0,0 +1,35 @@
# GPT4All Python Embedding API
GPT4All includes a super simple means of generating embeddings for your text documents.
## Quickstart
```bash
pip install gpt4all
```
### Generating embeddings
The embedding model will automatically be downloaded if not installed.
=== "Embed4All Example"
``` py
from gpt4all import GPT4All, Embed4All
text = 'The quick brown fox jumps over the lazy dog'
embedder = Embed4All()
output = embedder.embed(text)
print(output)
```
=== "Output"
```
[0.034696947783231735, -0.07192722707986832, 0.06923297047615051, ...]
```
### Speed of embedding generation
The following table lists the generation speed for text documents of N tokens captured on an Intel i913900HX CPU with DDR5 5600 running with 8 threads under stable load.
| Tokens | 2^7 | 2^9 | 2^11 | 2^13 | 2^14 |
| --------------- | ---- | ---- | ---- | ---- | ---- |
| Wall time (s) | .02 | .08 | .24 | .96 | 1.9 |
| Tokens / Second | 6508 | 6431 | 8622 | 8509 | 8369 |
### API documentation
::: gpt4all.gpt4all.Embed4All