Model: amadeusai/Amadeus-Verbo-MI-Qwen-2.5-3B-PT-BR-Instruct-Experimental Source: Original Platform
162 lines
4.5 KiB
Markdown
162 lines
4.5 KiB
Markdown
---
|
|
base_model:
|
|
- Qwen/Qwen2.5-3B-Instruct
|
|
- amadeusai/AV-BI-Qwen2.5-3B-PT-BR-Instruct
|
|
library_name: transformers
|
|
tags:
|
|
- mergekit
|
|
- merge
|
|
license: apache-2.0
|
|
language:
|
|
- pt
|
|
metrics:
|
|
- accuracy
|
|
- f1
|
|
- pearsonr
|
|
pipeline_tag: text-generation
|
|
---
|
|
# merge_3B
|
|
|
|
This is a merge of pre-trained language models created using [mergekit](https://github.com/cg123/mergekit).
|
|
|
|
## Merge Details
|
|
### Merge Method
|
|
|
|
This model was merged using the [SLERP](https://en.wikipedia.org/wiki/Slerp) merge method.
|
|
|
|
### Models Merged
|
|
|
|
The following models were included in the merge:
|
|
* [Qwen/Qwen2.5-3B-Instruct](https://huggingface.co/Qwen/Qwen2.5-3B-Instruct)
|
|
* [amadeusai/AV-BI-Qwen2.5-3B-PT-BR-Instruct](https://huggingface.co/amadeusai/AV-BI-Qwen2.5-3B-PT-BR-Instruct)
|
|
|
|
### Configuration
|
|
|
|
The following YAML configuration was used to produce this model:
|
|
|
|
```yaml
|
|
|
|
slices:
|
|
- sources:
|
|
- model: Qwen/Qwen2.5-3B-Instruct
|
|
layer_range: [0, 36]
|
|
- model: amadeusai/AV-BI-Qwen2.5-3B-PT-BR-Instruct
|
|
layer_range: [0, 36]
|
|
merge_method: slerp
|
|
base_model: Qwen/Qwen2.5-3B-Instruct
|
|
parameters:
|
|
t:
|
|
- filter: self_attn
|
|
value: [0, 0.5, 0.3, 0.7, 1]
|
|
- filter: mlp
|
|
value: [1, 0.5, 0.7, 0.3, 0]
|
|
- value: 0.5
|
|
dtype: bfloat16
|
|
|
|
```
|
|
#### Usage
|
|
|
|
You can use Amadeus-Verbo--MI-Qwen2.5-3B-PT-BR-Instruct with the latest HuggingFace Transformers library and we advise you to use the latest version of Transformers.
|
|
|
|
With transformers<4.37.0, you will encounter the following error:
|
|
|
|
KeyError: 'qwen2'
|
|
|
|
Below, we have provided a simple example of how to load the model and generate text:
|
|
|
|
#### Quickstart
|
|
The following code snippet uses `pipeline`, `AutoTokenizer`, `AutoModelForCausalLM` and apply_chat_template to show how to load the tokenizer, the model, and how to generate content.
|
|
|
|
Using the pipeline:
|
|
```python
|
|
from transformers import pipeline
|
|
|
|
messages = [
|
|
{"role": "user", "content": "Faça uma planilha nutricional para uma alimentação fitness e mediterrânea com todos os dias da semana"},
|
|
]
|
|
pipe = pipeline("text-generation", model="amadeusai/AV-MI-Qwen2.5-3B-PT-BR-Instruct")
|
|
pipe(messages)
|
|
```
|
|
OR
|
|
```python
|
|
from transformers import AutoModelForCausalLM, AutoTokenizer
|
|
|
|
model_name = "amadeusai/AV-MI-Qwen2.5-3B-PT-BR-Instruct"
|
|
|
|
model = AutoModelForCausalLM.from_pretrained(
|
|
model_name,
|
|
torch_dtype="auto",
|
|
device_map="auto"
|
|
)
|
|
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
|
|
|
prompt = "Faça uma planilha nutricional para uma alimentação fitness e mediterrânea com todos os dias da semana."
|
|
messages = [
|
|
{"role": "system", "content": "Você é um assistente útil."},
|
|
{"role": "user", "content": prompt}
|
|
]
|
|
text = tokenizer.apply_chat_template(
|
|
messages,
|
|
tokenize=False,
|
|
add_generation_prompt=True
|
|
)
|
|
model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
|
|
|
|
generated_ids = model.generate(
|
|
**model_inputs,
|
|
max_new_tokens=512
|
|
)
|
|
generated_ids = [
|
|
output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
|
|
]
|
|
|
|
response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
|
|
```
|
|
OR
|
|
```python
|
|
from transformers import GenerationConfig, TextGenerationPipeline, AutoTokenizer, AutoModelForCausalLM
|
|
import torch
|
|
|
|
# Specify the model and tokenizer
|
|
model_id = "amadeusai/AV-MI-Qwen2.5-3B-PT-BR-Instruct"
|
|
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
|
model = AutoModelForCausalLM.from_pretrained(model_id)
|
|
|
|
# Specify the generation parameters as you like
|
|
generation_config = GenerationConfig(
|
|
**{
|
|
"do_sample": True,
|
|
"max_new_tokens": 512,
|
|
"renormalize_logits": True,
|
|
"repetition_penalty": 1.2,
|
|
"temperature": 0.1,
|
|
"top_k": 50,
|
|
"top_p": 1.0,
|
|
"use_cache": True,
|
|
}
|
|
)
|
|
|
|
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
|
generator = TextGenerationPipeline(model=model, task="text-generation", tokenizer=tokenizer, device=device)
|
|
|
|
# Generate text
|
|
prompt = "Faça uma planilha nutricional para uma alimentação fitness e mediterrânea com todos os dias da semana"
|
|
completion = generator(prompt, generation_config=generation_config)
|
|
print(completion[0]['generated_text'])
|
|
```
|
|
|
|
|
|
#### Citation
|
|
|
|
If you find our work helpful, feel free to cite it.
|
|
```
|
|
@misc{cruzcastañeda2025amadeusverbotechnicalreportpowerful,
|
|
title={Amadeus-Verbo Technical Report: The powerful Qwen2.5 family models trained in Portuguese},
|
|
author={William Alberto Cruz-Castañeda and Marcellus Amadeus},
|
|
year={2025},
|
|
eprint={2506.00019},
|
|
archivePrefix={arXiv},
|
|
primaryClass={cs.CL},
|
|
url={https://arxiv.org/abs/2506.00019},
|
|
}
|
|
``` |