Instructions to use recogna-nlp/bode-13b-alpaca-pt-br-gguf with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use recogna-nlp/bode-13b-alpaca-pt-br-gguf with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="recogna-nlp/bode-13b-alpaca-pt-br-gguf")# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("recogna-nlp/bode-13b-alpaca-pt-br-gguf", dtype="auto") - llama-cpp-python
How to use recogna-nlp/bode-13b-alpaca-pt-br-gguf with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="recogna-nlp/bode-13b-alpaca-pt-br-gguf", filename="bode-13b-alpaca-f16.gguf", )
output = llm( "Once upon a time,", max_tokens=512, echo=True ) print(output)
- Notebooks
- Google Colab
- Kaggle
- Local Apps
- llama.cpp
How to use recogna-nlp/bode-13b-alpaca-pt-br-gguf with llama.cpp:
Install from brew
brew install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf recogna-nlp/bode-13b-alpaca-pt-br-gguf:Q4_K_M # Run inference directly in the terminal: llama-cli -hf recogna-nlp/bode-13b-alpaca-pt-br-gguf:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf recogna-nlp/bode-13b-alpaca-pt-br-gguf:Q4_K_M # Run inference directly in the terminal: llama-cli -hf recogna-nlp/bode-13b-alpaca-pt-br-gguf:Q4_K_M
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf recogna-nlp/bode-13b-alpaca-pt-br-gguf:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf recogna-nlp/bode-13b-alpaca-pt-br-gguf:Q4_K_M
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf recogna-nlp/bode-13b-alpaca-pt-br-gguf:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf recogna-nlp/bode-13b-alpaca-pt-br-gguf:Q4_K_M
Use Docker
docker model run hf.co/recogna-nlp/bode-13b-alpaca-pt-br-gguf:Q4_K_M
- LM Studio
- Jan
- vLLM
How to use recogna-nlp/bode-13b-alpaca-pt-br-gguf with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "recogna-nlp/bode-13b-alpaca-pt-br-gguf" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "recogna-nlp/bode-13b-alpaca-pt-br-gguf", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/recogna-nlp/bode-13b-alpaca-pt-br-gguf:Q4_K_M
- SGLang
How to use recogna-nlp/bode-13b-alpaca-pt-br-gguf with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "recogna-nlp/bode-13b-alpaca-pt-br-gguf" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "recogna-nlp/bode-13b-alpaca-pt-br-gguf", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "recogna-nlp/bode-13b-alpaca-pt-br-gguf" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "recogna-nlp/bode-13b-alpaca-pt-br-gguf", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Ollama
How to use recogna-nlp/bode-13b-alpaca-pt-br-gguf with Ollama:
ollama run hf.co/recogna-nlp/bode-13b-alpaca-pt-br-gguf:Q4_K_M
- Unsloth Studio new
How to use recogna-nlp/bode-13b-alpaca-pt-br-gguf with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for recogna-nlp/bode-13b-alpaca-pt-br-gguf to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for recogna-nlp/bode-13b-alpaca-pt-br-gguf to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for recogna-nlp/bode-13b-alpaca-pt-br-gguf to start chatting
- Docker Model Runner
How to use recogna-nlp/bode-13b-alpaca-pt-br-gguf with Docker Model Runner:
docker model run hf.co/recogna-nlp/bode-13b-alpaca-pt-br-gguf:Q4_K_M
- Lemonade
How to use recogna-nlp/bode-13b-alpaca-pt-br-gguf with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull recogna-nlp/bode-13b-alpaca-pt-br-gguf:Q4_K_M
Run and chat with the model
lemonade run user.bode-13b-alpaca-pt-br-gguf-Q4_K_M
List all available models
lemonade list
BODE - GGUF VERSION
Este repositório contém o modelo Bode de 13B de parâmetros em formato GGUF, na versão de 16 bits e também nas versões quantizadas de 8, 5 e 4 bits.
Bode é um modelo de linguagem (LLM) para o português desenvolvido a partir do modelo Llama 2 por meio de fine-tuning no dataset Alpaca, traduzido para o português pelos autores do Cabrita. Este modelo é projetado para tarefas de processamento de linguagem natural em português, como geração de texto, tradução automática, resumo de texto e muito mais. O objetivo do desenvolvimento do BODE é suprir a escassez de LLMs para a língua portuguesa. Modelos clássicos, como o próprio LLaMa, são capazes de responder prompts em português, mas estão sujeitos a muitos erros de gramática e, por vezes, geram respostas na língua inglesa. Ainda há poucos modelos em português disponíveis para uso gratuito e, segundo nosso conhecimento, não modelos disponíveis com 13b de parâmetros ou mais treinados especificamente com dados em português.
Acesse o artigo para mais informações sobre o Bode.
Sobre o formato GGUF
O modelo no formato GGUF permite seu uso para inferência usando o llama.cpp, permitindo tanto o uso de CPU como de GPU, e outras bibliotecas e ferramentas compatíveis, como:
Detalhes do Modelo
- Modelo Base: Llama 2
- Dataset de Treinamento: Alpaca
- Idioma: Português
Versões disponíveis
| Quantidade de parâmetros | PEFT | Modelo |
|---|---|---|
| 7b | ✓ | recogna-nlp/bode-7b-alpaca-pt-br |
| 13b | ✓ | recogna-nlp/bode-13b-alpaca-pt-br |
| 7b | recogna-nlp/bode-7b-alpaca-pt-br-no-peft | |
| 13b | recogna-nlp/bode-13b-alpaca-pt-br-no-peft | |
| 7b-gguf | recogna-nlp/bode-7b-alpaca-pt-br-gguf | |
| 13b-gguf | recogna-nlp/bode-13b-alpaca-pt-br-gguf |
Uso
Segue um exemplo de uso da versão quantizada de 5 bits utilizando o ctransformers e o LangChain:
# Downloads necessários
!pip install ctransformers
!pip install langchain
from transformers import AutoModelForCausalLM, AutoTokenizer, GenerationConfig
from langchain.chains import LLMChain
from langchain.prompts import PromptTemplate
from langchain.llms import CTransformers
template = """Abaixo está uma instrução que descreve uma tarefa. Escreva uma resposta que complete adequadamente o pedido.
### Instrução:
{instruction}
### Resposta:"""
prompt = PromptTemplate(template=template, input_variables=["question"])
llm = CTransformers(model="recogna-nlp/bode-7b-alpaca-pt-br-gguf", model_file="bode-7b-alpaca-q8_0.gguf", model_type='llama')
llm_chain = LLMChain(prompt=prompt, llm=llm)
response = llm_chain.run("O que é um bode?")
print(response)
#Exemplo de resposta obtida (pode variar devido a temperatura): Um bode é um animal de quatro patas e membros postiados atrás, com um corpo alongado e coberto por pelagem escura.
Treinamento e Dados
O modelo Bode foi treinado por fine-tuning a partir do modelo Llama 2 usando o dataset Alpaca em português, que consiste em um Instruction-based dataset. O treinamento foi realizado no Supercomputador Santos Dumont do LNCC, através do projeto da Fundunesp 2019/00697-8.
Citação
Se você deseja utilizar o Bode em sua pesquisa, pode citar este artigo que discute o modelo com mais detalhes. Cite-o da seguinte maneira:
@misc{bode2024,
title={Introducing Bode: A Fine-Tuned Large Language Model for Portuguese Prompt-Based Task},
author={Gabriel Lino Garcia and Pedro Henrique Paiola and Luis Henrique Morelli and Giovani Candido and Arnaldo Cândido Júnior and Danilo Samuel Jodas and Luis C. S. Afonso and Ivan Rizzo Guilherme and Bruno Elias Penteado and João Paulo Papa},
year={2024},
eprint={2401.02909},
archivePrefix={arXiv},
primaryClass={cs.CL}
}
Contribuições
Contribuições para a melhoria deste modelo são bem-vindas. Sinta-se à vontade para abrir problemas e solicitações pull.
Agradecimentos
Agradecemos ao Laboratório Nacional de Computação Científica (LNCC/MCTI, Brasil) por prover os recursos de CAD do supercomputador SDumont.
- Downloads last month
- 125
4-bit
5-bit
8-bit
16-bit