anekcb commited on
Commit
4eb9600
·
verified ·
1 Parent(s): 0d3fc4f

Delete llama2-local.py

Browse files
Files changed (1) hide show
  1. llama2-local.py +0 -32
llama2-local.py DELETED
@@ -1,32 +0,0 @@
1
- from llama_cpp import Llama
2
- import timeit
3
-
4
- # Load Llama 2 model
5
- llm = Llama(model_path="llama-2-7b-chat.ggmlv3.q2_K.bin",
6
- n_ctx=512,
7
- n_batch=128)
8
-
9
- # Start timer
10
- start = timeit.default_timer()
11
-
12
- # Generate LLM response
13
- prompt = "What is Python?"
14
-
15
- output = llm(prompt,
16
- max_tokens=-1,
17
- echo=False,
18
- temperature=0.1,
19
- top_p=0.9)
20
-
21
- # Stop timer
22
- stop = timeit.default_timer()
23
- duration = stop - start
24
- print("Time: ", duration, '\n\n')
25
-
26
- # Display generated text
27
- print(output['choices'][0]['text'])
28
-
29
- # Write to file
30
- with open("response.txt", "a") as f:
31
- f.write(f"Time: {duration}")
32
- f.write(output['choices'][0]['text'])