rhaymison commited on
Commit
42c4707
1 Parent(s): 62b9479

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +31 -8
README.md CHANGED
@@ -25,14 +25,37 @@ Remember that verbs are important in your prompt. Tell your model how to act or
25
  Important points like these help models (even smaller models like 7b) to perform much better.
26
 
27
  ```python
28
- !pip install -q -U transformers
29
- !pip install -q -U accelerate
30
- !pip install -q -U bitsandbytes
31
-
32
- prompt = f"""<s>[INST] Abaixo está uma instrução que descreve uma tarefa, juntamente com uma entrada que fornece mais contexto.
33
- Escreva uma resposta que complete adequadamente o pedido.
34
- ### instrução: aja como um professor de matemática e me explique porque 2 + 2 = 4.
35
- [/INST]"""
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36
 
37
 
38
  ```
 
25
  Important points like these help models (even smaller models like 7b) to perform much better.
26
 
27
  ```python
28
+ !git lfs install
29
+ !pip install langchain
30
+ !pip install langchain-community langchain-core
31
+ !pip install llama-cpp-python
32
+
33
+ !git clone https://huggingface.co/rhaymison/Mistral-portuguese-luana-7b-q8-gguf
34
+
35
+ def llamacpp():
36
+ from langchain.llms import LlamaCpp
37
+ from langchain.prompts import PromptTemplate
38
+ from langchain.chains import LLMChain
39
+
40
+ llm = LlamaCpp(
41
+ model_path="/content/Mistral-portuguese-luana-7b-q8-gguf.gguf",
42
+ n_gpu_layers=40,
43
+ n_batch=512,
44
+ verbose=True,
45
+ )
46
+
47
+ template = """<s>[INST] Abaixo está uma instrução que descreve uma tarefa, juntamente com uma entrada que fornece mais contexto.
48
+ Escreva uma resposta que complete adequadamente o pedido.
49
+ ### {question}
50
+ [/INST]"""
51
+
52
+ prompt = PromptTemplate(template=template, input_variables=["question"])
53
+
54
+ llm_chain = LLMChain(prompt=prompt, llm=llm)
55
+
56
+ question = "instrução: aja como um professor de matemática e me explique porque 2 + 2 = 4?"
57
+ response = llm_chain.run({"question": question})
58
+ print(response)
59
 
60
 
61
  ```