">
 

Run Gemma-4 E2B-it with llama.cpp on Raspberry Pi4

Iniciado por joomlamz, 31 de Maio de 2026, 04:35

Respostas: 1   |   Visualizações: 18

Tópico anterior - Tópico seguinte

0 Membros e 1 Visitante estão a ver este tópico.

Olá a todos os membros do fórum webmastersmz.com! Hoje vamos falar sobre como executar o Gemma-4 E2B-it com o arquivo llama.cpp no Raspberry Pi 4. Este tópico é bastante interessante, pois combina a utilização de um hardware de código aberto, como o Raspberry Pi, com uma aplicação avançada como o Gemma-4.

Em primeiro lugar, é importante entender o que é o Gemma-4 E2B-it. Trata-se de uma ferramenta de código aberto que permite a execução de aplicativos em um ambiente de teste, utilizando o protocolo E2B (Embedded-to-Browser). Já o arquivo llama.cpp é um exemplo de código que pode ser utilizado com o Gemma-4, demonstrando como é possível integrar o hardware do Raspberry Pi com a aplicação.

Para executar o Gemma-4 E2B-it com o arquivo llama.cpp no Raspberry Pi 4, é necessário ter alguns requisitos básicos, como o Raspberry Pi 4 com um sistema operacional compatível, como o Raspbian, e o compilador C++ instalado. Além disso, é necessário baixar e instalar o Gemma-4 e o arquivo llama.cpp.

Os principais passos para executar o Gemma-4 E2B-it com o arquivo llama.cpp no Raspberry Pi 4 são:

1. Instalar o compilador C++ e as bibliotecas necessárias no Raspberry Pi 4;
2. Baixar e instalar o Gemma-4 e o arquivo llama.cpp;
3. Compilar o arquivo llama.cpp utilizando o compilador C++;
4. Executar o Gemma-4 E2B-it com o arquivo llama.cpp compilado.

Este processo pode ser um pouco complexo, especialmente para aqueles que não têm experiência com programação em C++ ou com o Raspberry Pi. No entanto, com os recursos certos e um pouco de prática, é possível executar o Gemma-4 E2B-it com o arquivo llama.cpp no Raspberry Pi 4.

Agora, gostaria de incentivá-los a discutir mais sobre este tópico no fórum. Qual é a sua experiência com o Raspberry Pi e o Gemma-4? Já tentaram executar o Gemma-4 E2B-it com o arquivo llama.cpp? Quais são os principais desafios que vocês enfrentam ao trabalhar com estes tecnologias?

Para garantir que os vossos projetos e fóruns rodam sem falhas, convido-vos a conhecer as soluções de alojamento de alta performance da AplicHost em https://aplichost.com. Com a AplicHost, vocês podem ter certeza de que os seus projetos estarão sempre disponíveis e rodando sem problemas, graças às nossas soluções de alojamento de alta performance e suporte técnico especializado. Não hesitem em visitar o nosso site e descobrir como podemos ajudar a tornar os seus projetos mais eficientes e seguros.

Run Gemma-4 E2B-it with llama.cpp on Raspberry Pi4



Tópico: Run Gemma-4 E2B-it with llama.cpp on Raspberry Pi4
Categoria: Tutoriais | Programação & Tecnologia
Idioma Principal: Português (Conteúdo de Tecnologia)

Descrição do Conteúdo / Informações:
-------------------------------------------------------------------------
Tested Gemma-4 E2B-it on Raspberry Pi 4.

the way to convert Gemma-4 E2B-it to gguf

Quantizing Gemma 4 on Mac with llama.cpp

0xkoji

0xkoji

0xkoji

Follow

May 28



Quantizing Gemma 4 on Mac with llama.cpp



#llm
#gemma
#quantization
#ai

1 reaction

Comments

Add Comment

4 min read

models

https://huggingface.co/baxin/gemma-4-E4B-it-E2B-it-Q4_K_M



ggml-org
/
llama.cpp




LLM inference in C/C++


llama.cpp

Manifesto / ggml / ops

LLM inference in C/C++

Recent API changes

• Changelog for libllama API

• Changelog for llama-server REST API

Hot topics

• Hugging Face cache migration: models downloaded with -hf are now stored in the standard Hugging Face cache directory, enabling sharing with other HF tools.

• guide : using the new WebUI of llama.cpp

• guide : running gpt-oss with llama.cpp

• [FEEDBACK] Better packaging for llama.cpp to support downstream consumers 🤗

• Support for the gpt-oss model with native MXFP4 format has been added | PR | Collaboration with NVIDIA | Comment

• Multimodal support arrived in llama-server: #12898 | documentation

• VS Code extension for FIM completions: https://github.com/ggml-org/llama.vscode

• Vim/Neovim plugin for FIM completions: https://github.com/ggml-org/llama.vim

• Hugging Face Inference Endpoints now support GGUF out of the box! #9669

• Hugging Face GGUF editor: discussion | tool

• WebGPU support is now available in the browser, see a blog/demo introducing it here.

Quick start
...

View on GitHub



Step 1 clone the repo


git clone https://github.com/ggml-org/llama.cpp.git
cd llama.cpp



Step 2 build


cmake -B build -DCMAKE_BUILD_TYPE=Release

cmake --build build --config Release



Step 3 run the model


the command was run from llama.cpp folder and gemma-4-E2B-it-Q4_K_M.gguf is placed in models folder.

folder structure

llama.cpp   models

./build/bin/llama-cli   -m ../models/gemma-4-E2B-it-Q4_K_M.gguf   -t 4   -tb 4   -c 2048   -fa auto   --prio 3   -p "hello"

▄▄ ▄▄
██ ██
██ ██  ▀▀█▄ ███▄███▄  ▀▀█▄    ▄████ ████▄ ████▄
██ ██ ▄█▀██ ██ ██ ██ ▄█▀██    ██    ██ ██ ██ ██
██ ██ ▀█▄██ ██ ██ ██ ▀█▄██ ██ ▀████ ████▀ ████▀
██    ██
▀▀    ▀▀

build      : b9425-0821c5fcf
model      : gemma-4-E2B-it-Q4_K_M.gguf
modalities : text

available commands:
/exit or Ctrl+C     stop or exit
/regen              regenerate the last response
/clear              clear the chat history
/read <file>        add a text file
/glob <pattern>     add text files using globbing pattern

> hello

[Start thinking]
Thinking Process:

1.  **Analyze the input:** The input is "hello".
2.  **Determine the context/intent:** This is a standard social greeting.
3.  **Formulate an appropriate response:** The response should be friendly, polite, and acknowledge the greeting. Standard responses include reciprocating the greeting and offering further interaction (e.g., asking how the user is or offering assistance).
4.  **Refine the response:** Keep it open-ended and welcoming.

*Self-Correction/Refinement:* A simple "hello" back is fine, but adding a follow-up makes the interaction more engaging.

5.  **Final Output Generation.**
[End thinking]

Hello! How can I help you today?

[ Prompt: 1.3 t/s | Generation: 1.8 t/s ]



Step 4 build with clang


sudo apt install -y clang
rm -rf build
cmake -B build -DCMAKE_BUILD_TYPE=Release \
-DLLAMA_NATIVE=ON \
-DLLAMA_ARM_NEON=ON

cmake --build build --config Release -j



Step 5 run the model


./build/bin/llama-cli   -m ../models/gemma-4-E2B-it-Q4_K_M.gguf   -t 4   -tb 4   -c 2048   -fa auto   --prio 3   -p "hello"
▄▄ ▄▄
██ ██
██ ██  ▀▀█▄ ███▄███▄  ▀▀█▄    ▄████ ████▄ ████▄
██ ██ ▄█▀██ ██ ██ ██ ▄█▀██    ██    ██ ██ ██ ██
██ ██ ▀█▄██ ██ ██ ██ ▀█▄██ ██ ▀████ ████▀ ████▀
██    ██
▀▀    ▀▀

build      : b9425-0821c5fcf
model      : gemma-4-E2B-it-Q4_K_M.gguf
modalities : text

available commands:
/exit or Ctrl+C     stop or exit
/regen              regenerate the last response
/clear              clear the chat history
/read <file>        add a text file
/glob <pattern>     add text files using globbing pattern

> hello

[Start thinking]
Thinking Process:

1.  **Analyze the input:** The input is "hello".
2.  **Determine the context:** This is a simple, friendly greeting.
3.  **Formulate the response goal:** The response should be equally friendly, polite, and open-ended (inviting further conversation).
4.  **Draft potential responses:**
*   "Hello!" (Too brief, but fine.)
*   "Hi there." (Friendly.)
*   "Hello! How can I help you today?" (Polite, proactive.)
*   "Hello! What can I do for you?" (Direct, service-oriented.)
5.  **Select the best response:** A standard friendly greeting followed by an invitation to continue the interaction is usually best.

6.  **Final Output Generation.**
[End thinking]

Hello! How can I help you today?

[ Prompt: 2.4 t/s | Generation: 1.5 t/s ]



Result


Prompt ↗️ but Generation ↘️

Unfortunately, it doesn't work for an agent.

Also tried to run LiquidAI/LFM2.5-8B-A1B-GGUF



LiquidAI/LFM2.5-8B-A1B-GGUF · Hugging Face



We're on a journey to advance and democratize artificial intelligence through open source and open science.

huggingface.co

The result was Prompt: 0.3 t/s | Generation: 0.5t/s ↘️



Conclusion


Raspberry Pi 5 costs around $305, so if you want to run an LLM with fewer than 10B parameters, it seems better to buy a mini PC with 16GB RAM in the $300–400 range.


Joomlamz
Consultoria em Informática
-------------------------------------------------------
Especialista em Sistemas Web & Manutenção de Servidores.
A desenvolver o novo AplPortal com suporte a PHP 8.
Precisa de ajuda profissional? Contacte-me.

Tags: