Instructions to use QuantFactory/gemma-portuguese-luana-2b-GGUF with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use QuantFactory/gemma-portuguese-luana-2b-GGUF with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="QuantFactory/gemma-portuguese-luana-2b-GGUF") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("QuantFactory/gemma-portuguese-luana-2b-GGUF", dtype="auto") - llama-cpp-python
How to use QuantFactory/gemma-portuguese-luana-2b-GGUF with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="QuantFactory/gemma-portuguese-luana-2b-GGUF", filename="gemma-portuguese-luana-2b.Q2_K.gguf", )
llm.create_chat_completion( messages = [ { "role": "user", "content": "What is the capital of France?" } ] ) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use QuantFactory/gemma-portuguese-luana-2b-GGUF with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf QuantFactory/gemma-portuguese-luana-2b-GGUF:Q4_K_M # Run inference directly in the terminal: llama cli -hf QuantFactory/gemma-portuguese-luana-2b-GGUF:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf QuantFactory/gemma-portuguese-luana-2b-GGUF:Q4_K_M # Run inference directly in the terminal: llama cli -hf QuantFactory/gemma-portuguese-luana-2b-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 QuantFactory/gemma-portuguese-luana-2b-GGUF:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf QuantFactory/gemma-portuguese-luana-2b-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 QuantFactory/gemma-portuguese-luana-2b-GGUF:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf QuantFactory/gemma-portuguese-luana-2b-GGUF:Q4_K_M
Use Docker
docker model run hf.co/QuantFactory/gemma-portuguese-luana-2b-GGUF:Q4_K_M
- LM Studio
- Jan
- vLLM
How to use QuantFactory/gemma-portuguese-luana-2b-GGUF with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "QuantFactory/gemma-portuguese-luana-2b-GGUF" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "QuantFactory/gemma-portuguese-luana-2b-GGUF", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/QuantFactory/gemma-portuguese-luana-2b-GGUF:Q4_K_M
- SGLang
How to use QuantFactory/gemma-portuguese-luana-2b-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 "QuantFactory/gemma-portuguese-luana-2b-GGUF" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "QuantFactory/gemma-portuguese-luana-2b-GGUF", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'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 "QuantFactory/gemma-portuguese-luana-2b-GGUF" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "QuantFactory/gemma-portuguese-luana-2b-GGUF", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Ollama
How to use QuantFactory/gemma-portuguese-luana-2b-GGUF with Ollama:
ollama run hf.co/QuantFactory/gemma-portuguese-luana-2b-GGUF:Q4_K_M
- Unsloth Studio
How to use QuantFactory/gemma-portuguese-luana-2b-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 QuantFactory/gemma-portuguese-luana-2b-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 QuantFactory/gemma-portuguese-luana-2b-GGUF to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for QuantFactory/gemma-portuguese-luana-2b-GGUF to start chatting
- Atomic Chat new
- Docker Model Runner
How to use QuantFactory/gemma-portuguese-luana-2b-GGUF with Docker Model Runner:
docker model run hf.co/QuantFactory/gemma-portuguese-luana-2b-GGUF:Q4_K_M
- Lemonade
How to use QuantFactory/gemma-portuguese-luana-2b-GGUF with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull QuantFactory/gemma-portuguese-luana-2b-GGUF:Q4_K_M
Run and chat with the model
lemonade run user.gemma-portuguese-luana-2b-GGUF-Q4_K_M
List all available models
lemonade list
llm.create_chat_completion(
messages = [
{
"role": "user",
"content": "What is the capital of France?"
}
]
)QuantFactory/gemma-portuguese-luana-2b-GGUF
This is quantized version of rhaymison/gemma-portuguese-luana-2b created using llama.cpp
Original Model Card
gemma-portuguese-2b-luana
Model description
updated: 2024-04-10 20:06
The gemma-portuguese-2b model is a portuguese model trained with the superset dataset with 250,000 instructions. The model is mainly focused on text generation and instruction. The model was not trained on math and code tasks. The model is generalist with focus on understand portuguese inferences. With this fine tuning for portuguese, you can adjust the model for a specific field.
How to Use
from transformers import AutoTokenizer, pipeline
import torch
model = "rhaymison/gemma-portuguese-luana-2b"
tokenizer = AutoTokenizer.from_pretrained(model)
pipeline = pipeline(
"text-generation",
model=model,
model_kwargs={"torch_dtype": torch.bfloat16},
device="cuda",
)
messages = [
{
"role": "system",
"content": "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."
},
{"role": "user", "content": "Me conte sobre a ida do homem a Lua."},
]
prompt = pipeline.tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
outputs = pipeline(
prompt,
max_new_tokens=256,
do_sample=True,
temperature=0.2,
top_k=50,
top_p=0.95
)
print(outputs[0]["generated_text"][len(prompt):].replace("model",""))
#A viagem à Lua foi um esforço monumental realizado pela Agência Espacial dos EUA entre 1969 e 1972.
#Foi um marco significativo na exploração espacial e na ciência humana.
#Aqui está uma visão geral de sua jornada: 1. O primeiro voo espacial humano foi o de Yuri Gagarin, que voou a Terra em 12 de abril de 1961.
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer2 = AutoTokenizer.from_pretrained("rhaymison/gemma-portuguese-luana-2b")
model2 = AutoModelForCausalLM.from_pretrained("rhaymison/gemma-portuguese-luana-2b", device_map={"":0})
tokenizer2.pad_token = tokenizer2.eos_token
tokenizer2.add_eos_token = True
tokenizer2.add_bos_token, tokenizer2.add_eos_token
tokenizer2.padding_side = "right"
text = f"""<start_of_turn>user
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.
###instrução:Me conte sobre a ida do homem a Lua.<end_of_turn>
<start_of_turn>model """
device = "cuda:0"
inputs = tokenizer2(text, return_tensors="pt").to(device)
outputs = model2.generate(**inputs, max_new_tokens=256, do_sample=False)
output = tokenizer2.decode(outputs[0], skip_special_tokens=True, skip_prompt=True)
print(output.replace("model"," "))
#A viagem à Lua foi um esforço monumental realizado pela Agência Espacial dos EUA entre 1969 e 1972.
#Foi um marco significativo na exploração espacial e na ciência humana.
#Aqui está uma visão geral de sua jornada: 1. O primeiro voo espacial humano foi o de Yuri Gagarin, que voou a Terra em 12 de abril de 1961.
text = f"""<start_of_turn>user
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.
###instrução:Me explique como funciona um computador.<end_of_turn>
<start_of_turn>model """
device = "cuda:0"
inputs = tokenizer2(text, return_tensors="pt").to(device)
outputs = model2.generate(**inputs, max_new_tokens=256, do_sample=False)
output = tokenizer2.decode(outputs[0], skip_special_tokens=True, skip_prompt=True)
print(output.replace("model"," "))
#Um computador é um dispositivo eletrônico que pode executar tarefas que um humano pode fazer.
#Ele usa um conjunto de circuitos elétricos, componentes eletrônicos e software para processar informações e executar tarefas.
#Os componentes de um computador incluem um processador, memória, unidade de armazenamento, unidade de processamento gráfica,
#unidade de controle, unidade de entrada e saída,e dispositivos de entrada e saída.
#O processador é o coração do computador e executa instruções de software.A memória é onde o computador armazena
Open Portuguese LLM Leaderboard Evaluation Results
Detailed results can be found here and on the 🚀 Open Portuguese LLM Leaderboard
| Metric | Value |
|---|---|
| Average | 34.94 |
| ENEM Challenge (No Images) | 24.42 |
| BLUEX (No Images) | 24.34 |
| OAB Exams | 27.11 |
| Assin2 RTE | 70.86 |
| Assin2 STS | 1.51 |
| FaQuAD NLI | 43.97 |
| HateBR Binary | 40.05 |
| PT Hate Speech Binary | 51.83 |
| tweetSentBR | 30.42 |
Comments
Any idea, help or report will always be welcome.
email: rhaymisoncristian@gmail.com
- Downloads last month
- 196
2-bit
3-bit
4-bit
5-bit
6-bit
8-bit
Dataset used to train QuantFactory/gemma-portuguese-luana-2b-GGUF
Evaluation results
- accuracy on ENEM Challenge (No Images)Open Portuguese LLM Leaderboard24.420
- accuracy on BLUEX (No Images)Open Portuguese LLM Leaderboard24.340
- accuracy on OAB ExamsOpen Portuguese LLM Leaderboard27.110
- f1-macro on Assin2 RTEtest set Open Portuguese LLM Leaderboard70.860
- pearson on Assin2 STStest set Open Portuguese LLM Leaderboard1.510
- f1-macro on FaQuAD NLItest set Open Portuguese LLM Leaderboard43.970
- f1-macro on HateBR Binarytest set Open Portuguese LLM Leaderboard40.050
- f1-macro on PT Hate Speech Binarytest set Open Portuguese LLM Leaderboard51.830
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="QuantFactory/gemma-portuguese-luana-2b-GGUF", filename="", )