vdpappu commited on
Commit
d6f5b34
1 Parent(s): cca2438

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +44 -3
README.md CHANGED
@@ -1,3 +1,44 @@
1
- ---
2
- license: apache-2.0
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ datasets:
4
+ - jkhedri/psychology-dataset
5
+ ---
6
+
7
+ **Usage**
8
+ ```
9
+ from llama_cpp import Llama
10
+ from typing import Optional
11
+ import time
12
+ from huggingface_hub import hf_hub_download
13
+
14
+ def generate_prompt(input_text: str, instruction: Optional[str] = None) -> str:
15
+ text = f"### Question: {input_text}\n\n### Answer: "
16
+ if instruction:
17
+ text = f"### Instruction: {instruction}\n\n{text}"
18
+ return text
19
+
20
+ # Set up the parameters
21
+ repo_id = "vdpappu/gemma2_stocks_analysis_gguf"
22
+ filename = "gemma2_stocks_analysis.gguf"
23
+ local_dir = "."
24
+
25
+ downloaded_file_path = hf_hub_download(repo_id=repo_id, filename=filename, local_dir=local_dir)
26
+ print(f"File downloaded to: {downloaded_file_path}")
27
+
28
+ # Load the model
29
+ llm = Llama(model_path=downloaded_file_path) #1 is thug
30
+ question = "I feel lonely. What should I do?"
31
+ prompt = generate_prompt(input_text=question)
32
+
33
+ start = time.time()
34
+ output = llm(prompt,
35
+ temperature=0.7,
36
+ top_p=0.9,
37
+ top_k=50,
38
+ repeat_penalty=1.5,
39
+ max_tokens=200,
40
+ stop=["Question:","<eos>"])
41
+ end = time.time()
42
+ print(f"Inference time: {end-start:.2f} seconds \n")
43
+ print(output['choices'][0]['text'])
44
+ ```