viethq5
commited on
Commit
·
fd7a844
1
Parent(s):
6095125
update model
Browse files- README.md +58 -0
- chat.txt +7 -0
- gguf-model-q4_0.bin +3 -0
README.md
CHANGED
@@ -1,3 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
license: apache-2.0
|
3 |
---
|
|
|
1 |
+
## Description
|
2 |
+
This repo contains GGUF format model which is a quantization of the model: https://huggingface.co/ngoantech/Llama-2-7b-vietnamese-20k
|
3 |
+
|
4 |
+
# Inference Code Example (Langchain+Python)
|
5 |
+
|
6 |
+
```python
|
7 |
+
from langchain.llms import LlamaCpp
|
8 |
+
from langchain.prompts import PromptTemplate
|
9 |
+
from langchain.chains import LLMChain
|
10 |
+
from langchain.callbacks.manager import CallbackManager
|
11 |
+
from langchain.callbacks.streaming_stdout import StreamingStdOutCallbackHandler
|
12 |
+
|
13 |
+
template = """Transcript of a dialog, where the User interacts with an Assistant named Bob. Bob is helpful, kind, honest, good at writing, and never fails to answer the User's requests immediately and with precision.
|
14 |
+
|
15 |
+
User: Chào Bob.
|
16 |
+
Bob: Chào bạn. Tôi có thể giúp gì cho bạn?
|
17 |
+
User: Thủ đô của Việt Nam là thành phố nào?
|
18 |
+
Bob: Hà Nội là thủ đô của Việt Nam
|
19 |
+
User: {question}"""
|
20 |
+
|
21 |
+
# template = """<<SYS>>\nYou are a helpful assistant. Bạn là một trợ lí hữu ích.\n<</SYS>>\n\n[INST] {question} [/INST] """
|
22 |
+
|
23 |
+
# template = """[INST] <<SYS>>
|
24 |
+
# You are a helpful, respectful and honest assistant. Always answer as helpfully as possible, while being safe. Your answers should not include any harmful, unethical, racist, sexist, toxic, dangerous, or illegal content. Please ensure that your responses are socially unbiased and positive in nature. If a question does not make any sense, or is not factually coherent, explain why instead of answering something not correct. If you don't know the answer to a question, please don't share false information.
|
25 |
+
# <</SYS>>
|
26 |
+
|
27 |
+
# {question} [/INST]
|
28 |
+
# """
|
29 |
+
|
30 |
+
prompt = PromptTemplate(template=template, input_variables=["question"])
|
31 |
+
|
32 |
+
# Callbacks support token-wise streaming
|
33 |
+
callback_manager = CallbackManager([StreamingStdOutCallbackHandler()])
|
34 |
+
|
35 |
+
# Make sure the model path is correct for your system!
|
36 |
+
llm = LlamaCpp(
|
37 |
+
model_path="/path/to/model/gguf-model-q4_0.bin",
|
38 |
+
temperature=0.1,
|
39 |
+
max_tokens=1024,
|
40 |
+
top_p=1,
|
41 |
+
callback_manager=callback_manager,
|
42 |
+
verbose=True, # Verbose is required to pass to the callback manager
|
43 |
+
)
|
44 |
+
|
45 |
+
llm_chain = LLMChain(prompt=prompt, llm=llm)
|
46 |
+
question = "Quốc khánh của Việt Nam diễn ra vào ngày nào?"
|
47 |
+
print(prompt.format(question=question))
|
48 |
+
llm_chain.run(question)
|
49 |
+
```
|
50 |
+
|
51 |
+
# Inference Code Example (Llama.cpp)
|
52 |
+
|
53 |
+
```bash
|
54 |
+
git clone https://github.com/ggerganov/llama.cpp.git
|
55 |
+
cd llama.cpp/
|
56 |
+
./main -m /path/to/model/gguf-model-q4_0.bin --temp 0.1 -t 8 -n 1024 --color -p "VNG Corporation là công ty công nghệ hàng đầu "
|
57 |
+
./main -m /path/to/model/gguf-model-q4_0.bin --temp 0.1 -t 8 -n 1024 --color -r "User:" -f /path/to/chat/prompt/chat.txt
|
58 |
+
```
|
59 |
---
|
60 |
license: apache-2.0
|
61 |
---
|
chat.txt
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Transcript of a dialog, where the User interacts with an Assistant named Bob. Bob is helpful, kind, honest, good at writing, and never fails to answer the User's requests immediately and with precision.
|
2 |
+
|
3 |
+
User: Chào Bob.
|
4 |
+
Bob: Chào bạn. Tôi có thể giúp gì cho bạn?
|
5 |
+
User: Thủ đô của Việt Nam là thành phố nào?
|
6 |
+
Bob: Hà Nội là thủ đô của Việt Nam
|
7 |
+
User: Quốc khánh của Việt Nam diễn ra vào ngày nào?
|
gguf-model-q4_0.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:9d5b4d9974540f06d8d1642fbff046036004adea1a6a7e309b259555cd173c72
|
3 |
+
size 3825807040
|