MuntasirHossain
commited on
Commit
•
9c562f3
1
Parent(s):
f7ce236
Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Model description
|
2 |
+
|
3 |
+
This is a GGUF version of the [Meta-Llama-3-8B-OpenOrca](https://huggingface.co/MuntasirHossain/Meta-Llama-3-8B-OpenOrca) model which itself is a fine-tuned version of the [meta-llama/Meta-Llama-3-8B](meta-llama/Meta-Llama-3-8B) on 1.5k subsamples of the
|
4 |
+
[OpenOrca](https://huggingface.co/datasets/Open-Orca/OpenOrca) dataset.
|
5 |
+
|
6 |
+
This LLM follows the popular follows the ChatML template!
|
7 |
+
|
8 |
+
# How to use
|
9 |
+
|
10 |
+
````
|
11 |
+
# Download the Q4_K_M.gguf or Q6_K.gguf version of the MuntasirHossain/Meta-Llama-3-8B-OpenOrca-GGUF model
|
12 |
+
!huggingface-cli download MuntasirHossain/Meta-Llama-3-8B-OpenOrca-GGUF Q4_K_M.gguf --local-dir . --local-dir-use-symlinks False
|
13 |
+
|
14 |
+
from llama_cpp import Llama
|
15 |
+
|
16 |
+
llm = Llama(
|
17 |
+
model_path="./content/Q4_K_M.gguf",
|
18 |
+
n_ctx=0, # input text context length, 0 = from model
|
19 |
+
verbose = False
|
20 |
+
)
|
21 |
+
|
22 |
+
# Define a function for inference
|
23 |
+
def llm_response(input_text = '', max_tokens=256):
|
24 |
+
system_prompt = "You are a helpful AI assistant."
|
25 |
+
prompt = f"<|im_start|>system\n{system_prompt}<|im_end|>\n<|im_start|>user\n{input_text}<|im_end|>\n<|im_start|>assistant"
|
26 |
+
output = llm(
|
27 |
+
prompt,
|
28 |
+
max_tokens=max_tokens,
|
29 |
+
stop=["<|im_end|>"],
|
30 |
+
)
|
31 |
+
return output
|
32 |
+
|
33 |
+
# generate model response
|
34 |
+
input_text = "Explain artificial general intelligence (AGI) in a few lines."
|
35 |
+
result = llm_response(input_text)
|
36 |
+
result['choices'][0]['text']
|
37 |
+
````
|