Instructions to use guifav/caramelo-gemma4-e4b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use guifav/caramelo-gemma4-e4b with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="guifav/caramelo-gemma4-e4b") 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-gemma4-e4b") model = AutoModelForMultimodalLM.from_pretrained("guifav/caramelo-gemma4-e4b") 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]:])) - llama-cpp-python
How to use guifav/caramelo-gemma4-e4b with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="guifav/caramelo-gemma4-e4b", filename="caramelo-4.4.1-Q4_K_M.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 guifav/caramelo-gemma4-e4b 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 guifav/caramelo-gemma4-e4b:Q4_K_M # Run inference directly in the terminal: llama cli -hf guifav/caramelo-gemma4-e4b:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf guifav/caramelo-gemma4-e4b:Q4_K_M # Run inference directly in the terminal: llama cli -hf guifav/caramelo-gemma4-e4b: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 guifav/caramelo-gemma4-e4b:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf guifav/caramelo-gemma4-e4b: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 guifav/caramelo-gemma4-e4b:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf guifav/caramelo-gemma4-e4b:Q4_K_M
Use Docker
docker model run hf.co/guifav/caramelo-gemma4-e4b:Q4_K_M
- LM Studio
- Jan
- vLLM
How to use guifav/caramelo-gemma4-e4b with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "guifav/caramelo-gemma4-e4b" # 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-gemma4-e4b", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/guifav/caramelo-gemma4-e4b:Q4_K_M
- SGLang
How to use guifav/caramelo-gemma4-e4b 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-gemma4-e4b" \ --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-gemma4-e4b", "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-gemma4-e4b" \ --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-gemma4-e4b", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Ollama
How to use guifav/caramelo-gemma4-e4b with Ollama:
ollama run hf.co/guifav/caramelo-gemma4-e4b:Q4_K_M
- Unsloth Studio
How to use guifav/caramelo-gemma4-e4b 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 guifav/caramelo-gemma4-e4b 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 guifav/caramelo-gemma4-e4b to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for guifav/caramelo-gemma4-e4b to start chatting
- Pi
How to use guifav/caramelo-gemma4-e4b with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf guifav/caramelo-gemma4-e4b:Q4_K_M
Configure the model in Pi
# Install Pi: npm install -g @mariozechner/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "llama-cpp": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "guifav/caramelo-gemma4-e4b:Q4_K_M" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Hermes Agent new
How to use guifav/caramelo-gemma4-e4b with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf guifav/caramelo-gemma4-e4b:Q4_K_M
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:8080/v1 hermes config set model.default guifav/caramelo-gemma4-e4b:Q4_K_M
Run Hermes
hermes
- Atomic Chat new
- OpenClaw new
How to use guifav/caramelo-gemma4-e4b with OpenClaw:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf guifav/caramelo-gemma4-e4b:Q4_K_M
Configure OpenClaw
# Install OpenClaw: npm install -g openclaw@latest # Register the local server and set it as the default model: openclaw onboard --non-interactive --mode local \ --auth-choice custom-api-key \ --custom-base-url http://127.0.0.1:8080/v1 \ --custom-model-id "guifav/caramelo-gemma4-e4b:Q4_K_M" \ --custom-provider-id llama-cpp \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
Run OpenClaw
openclaw agent --local --agent main --message "Hello from Hugging Face"
- Docker Model Runner
How to use guifav/caramelo-gemma4-e4b with Docker Model Runner:
docker model run hf.co/guifav/caramelo-gemma4-e4b:Q4_K_M
- Lemonade
How to use guifav/caramelo-gemma4-e4b with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull guifav/caramelo-gemma4-e4b:Q4_K_M
Run and chat with the model
lemonade run user.caramelo-gemma4-e4b-Q4_K_M
List all available models
lemonade list
Install from WinGet (Windows)
winget install llama.cpp
# Start a local OpenAI-compatible server with a web UI:
llama serve -hf guifav/caramelo-gemma4-e4b:Q4_K_M# Run inference directly in the terminal:
llama cli -hf guifav/caramelo-gemma4-e4b:Q4_K_MUse 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 guifav/caramelo-gemma4-e4b:Q4_K_M# Run inference directly in the terminal:
./llama-cli -hf guifav/caramelo-gemma4-e4b:Q4_K_MBuild 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 guifav/caramelo-gemma4-e4b:Q4_K_M# Run inference directly in the terminal:
./build/bin/llama-cli -hf guifav/caramelo-gemma4-e4b:Q4_K_MUse Docker
docker model run hf.co/guifav/caramelo-gemma4-e4b:Q4_K_MCaramelo 4.4.1
Modelo de IA brasileiro treinado por Guilherme Favaron sobre modelos open source. Esta versão usa como base o google/gemma-4-E4B-it (Gemma 4 E4B, Apache-2.0) e aplica um fine-tune LoRA que treina síntese e comunicação na voz de escrita do autor: resposta direta em português do Brasil, argumento com dado e exemplo, sem hype e sem emoji.
A premissa do projeto: a forma de comunicar é parte da performance. Nos testes cegos abaixo, o fine-tune vence o próprio modelo base em qualidade, além do estilo. No ciclo em que o raciocínio bruto foi medido (3.4.2, 1.432 questões do ENEM), ele ficou no nível do base.
Em produção em ia-caramelo.com desde julho de 2026, servindo API compatível com a OpenAI, app web e CLI (caramelo-chat no npm). Gratuito, com limites de uso.
Uso
API grátis (compatível com a OpenAI)
O caminho mais rápido: a API em ia-caramelo.com já serve este modelo em produção, sem GPU e sem instalar nada. Crie a chave no app, menu Chaves de API, ou pela CLI (npm install -g caramelo-chat, depois caramelo login).
curl https://ia-caramelo.com/v1/chat/completions \
-H "Authorization: Bearer $CARAMELO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "caramelo",
"messages": [{"role": "user", "content": "Resuma o que é um data warehouse em uma frase."}]
}'
Qualquer SDK que fala com a OpenAI funciona trocando a base_url para https://ia-caramelo.com/v1. Modelos disponíveis: caramelo (conversa e escrita) e caramelo-code (código). Guia completo em ia-caramelo.com/docs.
Local com llama.cpp
Este repo inclui o GGUF Q4_K_M usado em produção (5,0 GiB, roda em CPU):
llama-server -hf guifav/caramelo-gemma4-e4b
O chat template do Gemma 4 liga thinking por padrão; para responder direto, como em produção, adicione --reasoning off.
Transformers (merge bf16)
from transformers import pipeline
pipe = pipeline("text-generation", model="guifav/caramelo-gemma4-e4b", torch_dtype="bfloat16", device_map="auto")
msgs = [{"role": "user", "content": "me explica RAG em duas frases"}]
print(pipe(msgs, max_new_tokens=400)[0]["generated_text"][-1]["content"])
Como foi treinado
- Base:
google/gemma-4-E4B-it@fee6332c(revision pinada;training_config.jsonregistra o snapshot completo de hiperparâmetros, versões e revisions) - Dataset:
guifav/caramelo-dataset, 414 pares de correção de estilo (o mesmo dataset e a mesma receita do ciclo anterior; método e resultados do 4.4.1 no relatório técnico do 4.4.1, derivação completa do dataset no relatório do 3.4.2) - Método: QLoRA 4-bit (r=16, alpha=32, dropout 0.05, 3 épocas, LR 2e-4), adapter de 34,9M parâmetros (0,44% do modelo); loss de treino 2,53 → 1,33
- Publicação: adapter em
guifav/caramelo-gemma4-e4b-lora-adapter; este repo contém o merge em bf16 e o GGUFQ4_K_Musado em produção - Script:
finetune/gemma4_e4b/train_lora.pyno repositório do projeto
A arquitetura base Gemma4ForConditionalGeneration é multimodal (any-to-any: texto, imagem e áudio), mas o Caramelo opera apenas em texto: o LoRA é anexado só no decoder textual (model.language_model.layers.*) e as pernas de vision/audio ficam congeladas. Por isso o pipeline_tag é text-generation.
Avaliação (A/B cego, 2 juízes LLM independentes)
Nos 24 prompts held-out do benchmark do projeto (a tabela mostra a faixa entre os dois juízes; os gráficos, a média deles):
| Comparação | Estilo | Qualidade |
|---|---|---|
| vs. Gemma 4 E4B base (sem fine-tune) | 100% | 91–100% |
| vs. caramelo 3.4.2 (versão anterior, Gemma 3 4B) | 79–87% | 87–91% |
O 4.4.1 escreve respostas mais completas que o 3.4.2 (~400 vs ~270 tokens em média); no julgamento cego, os juízes apontaram que a versão anterior omitia conteúdo relevante com mais frequência.
Esses números sustentam a premissa: treinar comunicação melhora a performance medida da tarefa. No ciclo anterior (3.4.2), o raciocínio bruto foi medido em 1.432 questões do ENEM e ficou no nível do base (57,5% vs 57,2%), enquanto a qualidade julgada às cegas venceu o base em 66–70%.
Produção
Servido em CPU (llama.cpp, GGUF Q4_K_M, 5,0 GiB) a ~18,5 tokens/s em 4 vCPUs. O chat template do Gemma 4 liga thinking por padrão; em produção o servidor roda com --reasoning off. A persona e a camada de segurança são injetadas server-side pelo gateway e têm prioridade sobre instruções do usuário.
Versões
O esquema de versão é caramelo {geração-Gemma}.{tamanho}.{iteração}.
- 4.4.1 (este repo): Gemma 4 E4B + LoRA, em produção. Adapter em
guifav/caramelo-gemma4-e4b-lora-adapter. - 3.4.2 (geração anterior): Gemma 3 4B + LoRA, em
guifav/caramelo. É o ciclo documentado no relatório técnico e o da medição de raciocínio no ENEM. - Dataset de treino das duas gerações:
guifav/caramelo-dataset, 414 pares de correção de estilo.
Licença
O modelo base google/gemma-4-E4B-it é distribuído sob Apache-2.0; este fine-tune segue os mesmos termos. O dataset guifav/caramelo-dataset é de propriedade de Guilherme Favaron. Confirme a licença vigente na página do modelo base antes de redistribuir.
Segurança
A camada de segurança do Caramelo em produção é aplicada server-side pelo gateway em ia-caramelo.com. Estes pesos não devem ser usados sem moderação própria.
- Downloads last month
- 2,280


Install (macOS, Linux)
# Start a local OpenAI-compatible server with a web UI: llama serve -hf guifav/caramelo-gemma4-e4b:Q4_K_M# Run inference directly in the terminal: llama cli -hf guifav/caramelo-gemma4-e4b:Q4_K_M