lrds-code commited on
Commit
d9249ae
·
verified ·
1 Parent(s): ffd9e4e

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +100 -0
README.md ADDED
@@ -0,0 +1,100 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: afl-3.0
3
+ datasets:
4
+ - ju-resplande/rebel-pt
5
+ - paulofinardi/OIG_small_chip2_portuguese_brasil
6
+ - Guilherme34/Cabrita-lora-ptbr
7
+ - dominguesm/Canarim-Instruct-PTBR-Dataset
8
+ language:
9
+ - pt
10
+ - en
11
+ pipeline_tag: text-generation
12
+ library_name: transformers
13
+ widget:
14
+ - text: |
15
+ Pergunta: Quantos planetas existem no sistema solar?
16
+ tags:
17
+ - llama
18
+ - peft
19
+ - portuguese
20
+ ---
21
+ # Boana-7B
22
+
23
+ <p align="center">
24
+ <img width="250" alt="Boana Logo" src="https://cdn-uploads.huggingface.co/production/uploads/658c21f4c1229bf113295773/BE5877BjlswYK3Ue1FiOK.png">
25
+ </p>
26
+
27
+ Boana-7B is an LLM trained on portuguese language data. The model is based on [LLaMA2-7B](https://huggingface.co/meta-llama/Llama-2-7b-chat-hf), a 7B parameter version of LLaMA-2. The LLM Boana project aims to provide more LLM options in portuguese, while also providing less complex models so that users with less computational power can take advantage of the LLMs.
28
+
29
+ In support of portuguese-speaking countries: Angola, Brasil, Cabo Verde, Guinea-Bissau, Equatorial Guinea, Mozambique, Portugal, São Tomé e Príncipe and Timor-Leste.
30
+
31
+ <p align="center">
32
+ <img width="250" alt="Countries Logo" src="https://cdn-uploads.huggingface.co/production/uploads/658c21f4c1229bf113295773/d3twZrXng5eDjg_LbH4pF.png">
33
+ </p>
34
+
35
+ ## Future Updates
36
+
37
+ - Add more data from the portuguese language.
38
+
39
+ ### Model Description
40
+
41
+ - **Developed by:** [Leonardo Souza](https://huggingface.co/lrds-code)
42
+ - **Model type:** LLaMA-Based
43
+ - **License:** Academic Free License v3.0
44
+ - **Finetuned from model:** [LLaMA2-7B](https://huggingface.co/meta-llama/Llama-2-7b-chat-hf)
45
+
46
+ ## Prompt Style
47
+
48
+ We used the same prompt used in the fine-tune of the [Cabrita](https://huggingface.co/22h/cabrita-lora-v0-1) model. You can find out more in the official repository on [GitHub](https://github.com/22-hours/cabrita/blob/main/notebooks/train_lora.ipynb).
49
+
50
+ ## How to Use
51
+
52
+ ```python
53
+ from transformers import AutoModelForCausalLM, AutoTokenizer, GenerationConfig
54
+
55
+ def GeneratePrompt(input, instruction):
56
+ if input!='' and instruction!=0:
57
+ return f'''Abaixo está uma instrução que descreve uma tarefa, juntamente com uma entrada que fornece mais contexto. Escreva uma resposta que complete adequadamente o pedido.
58
+ ### Instrução:
59
+ {instruction}
60
+ ### Entrada:
61
+ {input}'''
62
+ else:
63
+ return f'''Abaixo está uma instrução que descreve uma tarefa. Escreva uma resposta que complete adequadamente o pedido.
64
+ ### Instrução:
65
+ {instruction}
66
+ ### '''
67
+
68
+ model_config = GenerationConfig.from_model_config(model.generation_config)
69
+ model.generation_config.temperature = 0.9 # You can vary this value between 0 and 1.
70
+ # We observed that, with very low values, the model tends to use English and Portuguese in the response.
71
+
72
+ model = AutoModelForCausalLM.from_pretrained('lrds-code/boana-7b')
73
+ tokenizer = AutoTokenizer.from_pretrained('lrds-code/boana-7b')
74
+
75
+ instruction = 'Como desenvolver habilidades de programação em python?'
76
+ text = GeneratePrompt(input='', instruction=instruction)
77
+ inputs = tokenizer(text, return_tensors='pt')
78
+ outputs = model.generate(input_ids=inputs['input_ids'], attention_mask=inputs['attention_mask'], generation_config=model_config, repetition_penalty=1.1)
79
+
80
+ # repetition_penalty:
81
+ # We observed that in some input cases the model began to repeat words excessively in its output.
82
+ # This parameter is used to try to reduce this behavior.
83
+ # Setting a very high value for this parameter can cause the model to search excessively for new words and, therefore, may use English words in the output.
84
+
85
+ print(tokenizer.decode(outputs[0], skip_special_tokens=True))
86
+
87
+
88
+ ## Pergunta: Como desenvolver habilidades de programação em python?
89
+ ## Resposta: 1. Crie um projeto simples: Comece criando um projeto simples, como um programa que lê um arquivo .txt e exibe os dados.
90
+ ## 2. Estudar o código: Estudar o código do projeto que você criou anteriormente.
91
+ ## 3. Revisar o código: Revisar o código para verificar se ele está correto e se está funcionando corretamente.
92
+ ## 4. Testar o código: Testar o código para verificar se ele está funcionando corretamente.
93
+ ## 5. Modificar o código: Modificar o código para corrigir problemas ou adicionar novos recursos.
94
+ ## 6. Documentar o código: Documentar o código para que outros desenvolvedores possam ler e usar o código.
95
+ ## 7. Depurar o código: Depurar o código para verificar se ele está funcionando corretamente.
96
+ ## 8. Fazer testes de integração: Fazer testes de integração para verificar se o código funciona corretamente com outros programas.
97
+ ## 9. Fazer testes de desempenho: Fazer testes de desempenho para verificar se o código funciona corretamente em diferentes sistemas e configurações.
98
+ ## 10. Fazer testes de segurança: Fazer testes de segurança para verificar se o código é seguro e não pode ser usado para invasão de segurança.
99
+
100
+ ```