Update README.md
Browse files
README.md
CHANGED
|
@@ -13,13 +13,25 @@ tags:
|
|
| 13 |
- text-generation-inference
|
| 14 |
---
|
| 15 |
|
| 16 |
-
### Qwen2.5-7B-PT-BR-Instruct
|
| 17 |
#### Introduction
|
| 18 |
-
Qwen2.5-7B-PT-BR-Instruct is a Brazilian-Portuguese language model (PT-BR-LLM) developed from the base model Qwen2.5-7B
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
|
| 20 |
#### Usage
|
| 21 |
|
| 22 |
-
You can use Qwen2.5-7B-PT-BR-Instruct with the latest HuggingFace Transformers library and we advise you to use the latest version of transformers.
|
| 23 |
|
| 24 |
With transformers<4.37.0, you will encounter the following error:
|
| 25 |
|
|
@@ -28,6 +40,55 @@ KeyError: 'qwen2'
|
|
| 28 |
Below, we have provided a simple example of how to load the model and generate text:
|
| 29 |
|
| 30 |
#### Quickstart
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
|
| 32 |
#### Citation
|
| 33 |
|
|
|
|
| 13 |
- text-generation-inference
|
| 14 |
---
|
| 15 |
|
| 16 |
+
### Amadeus-Verbo-Qwen2.5-7B-PT-BR-Instruct
|
| 17 |
#### Introduction
|
| 18 |
+
Amadeus-Verbo-Qwen2.5-7B-PT-BR-Instruct is a Brazilian-Portuguese language model (PT-BR-LLM) developed from the base model Qwen2.5-7B through fine-tuning, for 2 epochs, with the superset instruction dataset.
|
| 19 |
+
Read our article [here](https://www.).
|
| 20 |
+
|
| 21 |
+
## Details
|
| 22 |
+
|
| 23 |
+
- **Architecture:** a Transformer-based model with RoPE, SwiGLU, RMSNorm, and Attention QKV bias pre-trained via Causal Language Modeling
|
| 24 |
+
- **Parameters:** 7.62B parameters
|
| 25 |
+
- **Number of Parameters (Non-Embedding):** 6.53B
|
| 26 |
+
- **Number of Layers:** 28
|
| 27 |
+
- **Number of Attention Heads (GQA):** 28 for Q and 4 for KV
|
| 28 |
+
- **Context length:** 131,072 tokens
|
| 29 |
+
- **Number of steps:** 78838
|
| 30 |
+
- **Language:** Brazilian Portuguese
|
| 31 |
|
| 32 |
#### Usage
|
| 33 |
|
| 34 |
+
You can use Amadeus-Verbo-Qwen2.5-7B-PT-BR-Instruct with the latest HuggingFace Transformers library and we advise you to use the latest version of transformers.
|
| 35 |
|
| 36 |
With transformers<4.37.0, you will encounter the following error:
|
| 37 |
|
|
|
|
| 40 |
Below, we have provided a simple example of how to load the model and generate text:
|
| 41 |
|
| 42 |
#### Quickstart
|
| 43 |
+
The following code snippet uses apply_chat_template to show how to load the tokenizer, the model, and how to generate content.
|
| 44 |
+
|
| 45 |
+
Using the pipeline:
|
| 46 |
+
```python
|
| 47 |
+
from transformers import pipeline
|
| 48 |
+
|
| 49 |
+
messages = [
|
| 50 |
+
{"role": "user", "content": "Faça uma planilha nutricional para uma alimentação fitness e mediterrânea com todos os dias da semana"},
|
| 51 |
+
]
|
| 52 |
+
pipe = pipeline("text-generation", model="amadeusai/qwen2.5-7B-PT-BR-Instruct")
|
| 53 |
+
pipe(messages)
|
| 54 |
+
```
|
| 55 |
+
|
| 56 |
+
Using the `AutoTokenizer` and `AutoModelForCausalLM`:
|
| 57 |
+
```python
|
| 58 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 59 |
+
|
| 60 |
+
model_name = "amadeusai/qwen2.5-7B-PT-BR-Instruct"
|
| 61 |
+
|
| 62 |
+
model = AutoModelForCausalLM.from_pretrained(
|
| 63 |
+
model_name,
|
| 64 |
+
torch_dtype="auto",
|
| 65 |
+
device_map="auto"
|
| 66 |
+
)
|
| 67 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 68 |
+
|
| 69 |
+
prompt = "Faça uma planilha nutricional para uma alimentação fitness e mediterrânea com todos os dias da semana."
|
| 70 |
+
messages = [
|
| 71 |
+
{"role": "system", "content": "Você é um assistente útil."},
|
| 72 |
+
{"role": "user", "content": prompt}
|
| 73 |
+
]
|
| 74 |
+
text = tokenizer.apply_chat_template(
|
| 75 |
+
messages,
|
| 76 |
+
tokenize=False,
|
| 77 |
+
add_generation_prompt=True
|
| 78 |
+
)
|
| 79 |
+
model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
|
| 80 |
+
|
| 81 |
+
generated_ids = model.generate(
|
| 82 |
+
**model_inputs,
|
| 83 |
+
max_new_tokens=512
|
| 84 |
+
)
|
| 85 |
+
generated_ids = [
|
| 86 |
+
output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
|
| 87 |
+
]
|
| 88 |
+
|
| 89 |
+
response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
|
| 90 |
+
|
| 91 |
+
```
|
| 92 |
|
| 93 |
#### Citation
|
| 94 |
|