darkai-1 commited on
Commit
540809c
·
verified ·
1 Parent(s): 40ce5ea

Upload notebook.ipynb

Browse files
Files changed (1) hide show
  1. notebook.ipynb +38 -0
notebook.ipynb ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ !pip install llama-cpp-python
2
+
3
+ from llama_cpp import Llama
4
+
5
+ llm = Llama.from_pretrained(
6
+ repo_id="darkai-1/darkit-1.5-pro",
7
+ filename="darkit-1.5-pro.gguf",
8
+ n_ctx=4096,
9
+ n_threads=4,
10
+ n_gpu_layers=35,
11
+ )
12
+
13
+ messages = [
14
+ {
15
+ "role": "user",
16
+ "content": "Who are you?"
17
+ }
18
+ ]
19
+
20
+ stream = llm.create_chat_completion(
21
+ messages=messages,
22
+ temperature=0.7,
23
+ top_p=0.8,
24
+ top_k=20,
25
+ stream=True
26
+ )
27
+
28
+ full_text = ""
29
+
30
+ for chunk in stream:
31
+ delta = chunk["choices"][0]["delta"]
32
+
33
+ if "content" in delta:
34
+ text = delta["content"]
35
+
36
+ print(text, end="", flush=True)
37
+
38
+ full_text += text