Views
No views yet

1import torch
2from transformers import AutoTokenizer, AutoModelForCausalLM
3tokenizer = AutoTokenizer.from_pretrained("recogna-nlp/internlm-chatbode-7b", trust_remote_code=True)
4model = AutoModelForCausalLM.from_pretrained("recogna-nlp/internlm-chatbode-7b", torch_dtype=torch.float16, trust_remote_code=True).cuda()
5model = model.eval()
6response, history = model.chat(tokenizer, "Olá", history=[])
7print(response)
8response, history = model.chat(tokenizer, "O que é o Teorema de Pitágoras? Me dê um exemplo", history=history)
9print(response)stream_chat:1import torch
2from transformers import AutoModelForCausalLM, AutoTokenizer
3
4model_path = "recogna-nlp/internlm-chatbode-7b"
5model = AutoModelForCausalLM.from_pretrained(model_path, torch_dtype=torch.float16, trust_remote_code=True).cuda()
6tokenizer = AutoTokenizer.from_pretrained(model_path, trust_remote_code=True)
7
8model = model.eval()
9length = 0
10for response, history in model.stream_chat(tokenizer, "Olá", history=[]):
11 print(response[length:], flush=True, end="")
12 length = len(response)| Metric | Value |
|---|---|
| Average | 69.54 |
| ENEM Challenge (No Images) | 63.05 |
| BLUEX (No Images) | 51.46 |
| OAB Exams | 42.32 |
| Assin2 RTE | 91.33 |
| Assin2 STS | 80.69 |
| FaQuAD NLI | 79.80 |
| HateBR Binary | 87.99 |
| PT Hate Speech Binary | 68.09 |
| tweetSentBR | 61.11 |
@misc {chatbode_2024,
author = { Gabriel Lino Garcia, Pedro Henrique Paiola and and João Paulo Papa},
title = { Chatbode },
year = {2024},
url = { https://huggingface.co/recogna-nlp/internlm-chatbode-7b/ },
doi = { 10.57967/hf/3317 },
publisher = { Hugging Face }
}