-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
103 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
// Use IntelliSense to learn about possible attributes. | ||
// Hover to view descriptions of existing attributes. | ||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"name": "Python: Current File", | ||
"type": "python", | ||
"request": "launch", | ||
"program": "${file}", | ||
"console": "integratedTerminal", | ||
"justMyCode": false | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,23 @@ | ||
from haystack.nodes import PromptNode, PromptModel | ||
from haystack.nodes import PromptModel | ||
from llm_rs.haystack import RustformersInvocationLayer | ||
from llm_rs import KnownModels,SessionConfig | ||
|
||
model = PromptModel("rustformers/open-llama-ggml", | ||
max_length=1024, | ||
invocation_layer_class=RustformersInvocationLayer, | ||
model_kwargs={"model_file":"open_llama_3b-q5_1-ggjt.bin"}) | ||
|
||
pn = PromptNode( | ||
model, | ||
max_length=1024 | ||
) | ||
|
||
pn("Life is",stream=True) | ||
#Enable `use_gpu` to use GPU acceleration | ||
session_config = SessionConfig(use_gpu=False) | ||
|
||
model = PromptModel("TheBloke/Llama-2-7B-Chat-GGML", | ||
max_length=4096, | ||
invocation_layer_class=RustformersInvocationLayer, | ||
model_kwargs={ | ||
"model_file":"llama-2-7b-chat.ggmlv3.q4_K_S.bin", | ||
"session_config":session_config, | ||
"verbose":True, | ||
}) | ||
|
||
prompt= """ | ||
System: You are a helpful, respectful and honest assistant. | ||
User: Tell me a Story about a Lama riding the crab named Ferris in about 1000 words. | ||
Assistant: | ||
""" | ||
model.invoke(prompt=prompt,stream=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters