Text Generation
Transformers
Safetensors
Portuguese
gemma3
image-text-to-text
gemma
lora
portuguese
brazil
conversational
text-generation-inference
Instructions to use guifav/caramelo with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use guifav/caramelo with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="guifav/caramelo") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("guifav/caramelo") model = AutoModelForMultimodalLM.from_pretrained("guifav/caramelo", device_map="auto") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] inputs = processor.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use guifav/caramelo with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "guifav/caramelo" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "guifav/caramelo", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/guifav/caramelo
- SGLang
How to use guifav/caramelo 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 "guifav/caramelo" \ --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": "guifav/caramelo", "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 "guifav/caramelo" \ --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": "guifav/caramelo", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use guifav/caramelo with Docker Model Runner:
docker model run hf.co/guifav/caramelo
Upload README.md with huggingface_hub
Browse files
README.md
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: gemma
|
| 3 |
+
base_model: google/gemma-3-4b-it
|
| 4 |
+
language:
|
| 5 |
+
- pt
|
| 6 |
+
library_name: transformers
|
| 7 |
+
pipeline_tag: text-generation
|
| 8 |
+
tags:
|
| 9 |
+
- gemma
|
| 10 |
+
- lora
|
| 11 |
+
- portuguese
|
| 12 |
+
- brazil
|
| 13 |
+
- conversational
|
| 14 |
+
---
|
| 15 |
+
|
| 16 |
+
# Caramelo 3.4.2
|
| 17 |
+
|
| 18 |
+
Um assistente de IA brasileiro, com a cara do Gui. **Gemma 3 4B** com fine-tune LoRA na voz e no estilo de escrita de **Guilherme Favaron** ([guifav.github.io](https://guifav.github.io)).
|
| 19 |
+
|
| 20 |
+
> Versão **3.4.2**: `3.4` é a base (Gemma **3**, **4**B); `.2` é a segunda iteração do fine-tune do Caramelo.
|
| 21 |
+
|
| 22 |
+
É o **decoder de texto** do Gemma 3 4B — as capacidades de visão da base não estão incluídas.
|
| 23 |
+
|
| 24 |
+
## O que muda em relação ao Gemma base
|
| 25 |
+
|
| 26 |
+
O Caramelo responde no estilo do Gui: vai direto ao ponto, abre com a conclusão ou uma cena concreta, argumenta com dados e exemplos, tom de conversa, sem hype e sem emoji.
|
| 27 |
+
|
| 28 |
+
### Avaliação (win-rate em A/B cego vs Gemma 3 4B base, mesma persona e sampling, n=24 prompts held-out)
|
| 29 |
+
|
| 30 |
+
| Juiz | Estilo | Qualidade |
|
| 31 |
+
|---|---|---|
|
| 32 |
+
| GLM-5.2 | 91% | 70% |
|
| 33 |
+
| Codex | 100% | 66% |
|
| 34 |
+
|
| 35 |
+
A iteração anterior (3.4.1), treinada nos artigos crus, havia regredido vs base; a 3.4.2 usa um dataset conversacional reescrito no estilo do Gui.
|
| 36 |
+
|
| 37 |
+
## Uso
|
| 38 |
+
|
| 39 |
+
```python
|
| 40 |
+
from transformers import pipeline
|
| 41 |
+
|
| 42 |
+
pipe = pipeline("text-generation", model="guifav/caramelo", torch_dtype="bfloat16", device_map="auto")
|
| 43 |
+
msgs = [{"role": "user", "content": "me explica RAG em duas frases"}]
|
| 44 |
+
print(pipe(msgs, max_new_tokens=300)[0]["generated_text"][-1]["content"])
|
| 45 |
+
```
|
| 46 |
+
|
| 47 |
+
Ou via API compatível com OpenAI em [ia-caramelo.com](https://ia-caramelo.com) (CLI: `npm i -g caramelo-chat`). Sem o `pipeline`, aplique o chat template com `tokenizer.apply_chat_template`.
|
| 48 |
+
|
| 49 |
+
## Treino
|
| 50 |
+
|
| 51 |
+
- **Base:** `google/gemma-3-4b-it`.
|
| 52 |
+
- **Dataset:** ~414 pares `{pergunta → resposta no estilo do Gui}`, construídos por correção de estilo (prompts diversos → rascunho do Gemma base → reescrita no estilo do Gui ancorada em artigos reais → filtro de estilo por marcadores).
|
| 53 |
+
- **Método:** QLoRA 4-bit (r=16, alpha=32), 3 épocas.
|
| 54 |
+
|
| 55 |
+
## Segurança
|
| 56 |
+
|
| 57 |
+
Atenção: estes pesos são o **modelo de estilo**. A **camada adicional de segurança** do Caramelo (recusa de conteúdo perigoso) é aplicada **server-side pelo gateway** em ia-caramelo.com e **não** está embutida nestes pesos. Além disso, o fine-tune de estilo pode ter enfraquecido os guardrails residuais do Gemma base. **Não use sem moderação própria.** Uso proibido: ver a [política do Gemma](https://ai.google.dev/gemma/prohibited_use_policy).
|
| 58 |
+
|
| 59 |
+
## Licença
|
| 60 |
+
|
| 61 |
+
Herda os [termos de uso do Gemma](https://ai.google.dev/gemma/terms) (Google). Ao redistribuir os pesos, inclua a atribuição ao Gemma e a política de uso proibido.
|
| 62 |
+
|
| 63 |
+
## Créditos
|
| 64 |
+
|
| 65 |
+
Desenvolvido, treinado e mantido por **Guilherme Favaron** — [guifav.github.io](https://guifav.github.io) · [guilhermefavaron.com.br](https://www.guilhermefavaron.com.br).
|