You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+15-1Lines changed: 15 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -23,12 +23,26 @@ model = AutoModel.from_pretrained("path/to/model.bin",model_type=KnownModels.Lla
23
23
#generate
24
24
print(model.generate("The meaning of life is"))
25
25
```
26
+
27
+
### Streaming Text
28
+
Text can be yielded from a generator via the `stream` function:
29
+
```python
30
+
from llm_rs import AutoModel, KnownModels
31
+
32
+
#load the model
33
+
model = AutoModel.from_pretrained("path/to/model.bin",model_type=KnownModels.Llama)
34
+
35
+
#generate
36
+
for token in model.stream("The meaning of life is"):
37
+
print(token)
38
+
```
39
+
26
40
### Running GGML models from the Hugging Face Hub
27
41
GGML converted models can be directly downloaded and run from the hub.
28
42
```python
29
43
from llm_rs import AutoModel
30
44
31
-
model = AutoModel.from_pretrained("LLukas22/mpt-7b-ggml",model_file="mpt-7b-q4_0-ggjt.bin")
45
+
model = AutoModel.from_pretrained("rustformers/mpt-7b-ggml",model_file="mpt-7b-q4_0-ggjt.bin")
32
46
```
33
47
If there are multiple models in a repo the `model_file` has to be specified.
34
48
If you want to load repositories which were not created throught this library, you have to specify the `model_type` parameter as the metadata files needed to infer the architecture are missing.
0 commit comments