翻篇收录说明
翻篇网页快照

Gemma 4 on Jetson | Jetson AI Lab

https://www.jetson-ai-lab.com/tutorials/gemma4-on-jetson/

最近抓取:2026-12-04 17:22:03(北京时间)

最近内容变化:2026-12-02 04:14:23(北京时间)

这是最近一次有效抓取的文本快照,不含网页脚本、图片和动态交互内容。实际网页可能已更新。

访问原网页

页面简介

Explore the Gemma 4 model family and its capabilities, then run E2B and E4B on Jetson with llama.cpp, browser chat, and API examples.

正文摘录

Back to Tutorials Gemma 4 on Jetson Explore the Gemma 4 model family and its capabilities, then run E2B and E4B on Jetson with llama.cpp, browser chat, and API examples. Author Khalil Ben Khaled Gemma 4 is Google’s family of open models for text generation, visual understanding, reasoning, and tool calling. On Jetson, you can use it to build local assistants, interpret images, and connect language models to your applications. The family includes four models: ModelArchitectureInputsContext lengthE2B2.3B effective parameters, 5.1B including embeddingsText, image, audio128KE4B4.5B effective parameters, 8B including embeddingsText, image, audio128K26B-A4BMixture of experts, 3.8B active parameters out of 25.8BText, image256K31B31B dense modelText, image256K All four generate text. E2B and E4B are the smaller models for on-device applications, while 26B-A4B and 31B need more memory. Their capabilities include answering questions about images, generating code, and producing tool calls that an application can execute. E2B and E4B also support audio tasks such as transcription and translation. Available input modes depend on the runtime and model files used. On Jetson, E2B and E4B have llama.cpp configurations for Orin Nano 8GB, Orin NX 16GB, AGX Orin 64GB, and Thor. The larger models have configurations for AGX Orin 64GB and Thor. Prerequisites RequirementDetailsDevicesJetson Orin Nano, Orin NX, AGX Orin, Jetson ThorJetPackJetPack 7.2.1StorageNVMe SSD strongly recommended for model downloads and container caches 1. Run Gemma 4 with llama.cpp We’ll use E2B and E4B as examples. Choose one model below and run the command for your Jetson in its terminal. The Orin commands apply to Orin Nano 8GB, Orin NX 16GB, and AGX Orin 64GB. The Thor commands apply to T4000 and T5000. Run one model at a time. Gemma 4 E2B Jetson Orin Jetson Thor docker run --rm -it --pull always --runtime nvidia --network host \ -v "$HOME/.cache/huggingface:/root/.cache/huggingface" \ ghcr.io/nvidia-ai-iot/llama_cpp:latest-jetson-orin \ llama-server \ -hf google/gemma-4-E2B-it-qat-q4_0-gguf \ --hf-file gemma-4-E2B_q4_0-it.gguf \ --host 0.0.0.0 \ --port 8000 \ --ctx-size 36864 \ --parallel 1 \ --n-gpu-layers 999 \ --jinja \ --lazy-mode on \ --load-mode mmap \ --cache-ram 0docker run --rm -it --pull always --runtime nvidia --network host \ -v "$HOME/.cache/huggingface:/root/.cache/huggingface" \ ghcr.io/nvidia-ai-iot/llama_cpp:latest-jetson-thor \ llama-server \ -hf google/gemma-4-E2B-it-qat-q4_0-gguf \ --hf-file gemma-4-E2B_q4_0-it.gguf \ --host 0.0.0.0 \ --port 8000 \ --ctx-size 36864 \ --parallel 1 \ --n-gpu-layers 999 \ --jinja \ --lazy-mode on \ --load-mode mmap \ --cache-ram 0 Gemma 4 E4B Jetson Orin Jetson Thor docker run --rm -it --pull always --runtime nvidia --network host \ -v "$HOME/.cache/huggingface:/root/.cache/huggingface" \ ghcr.io/nvidia-ai-iot/llama_cpp:latest-jetson-orin \ llama-server \ -hf google/gemma-4-E4B-it-qat-q4_0-gguf \ --hf-file gemma-4-E4B_q4_0-it.gguf \ --host 0.0.0.0 \ --port 8000 \ --ctx-size 36864 \ --parallel 1 \ --n-gpu-layers 999 \ --jinja \ --lazy-mode on \ --load-mode mmap \ --cache-ram 0docker run --rm -it --pull always --runtime nvidia --network host \ -v "$HOME/.cache/huggingface:/root/.cache/huggingface" \ ghcr.io/nvidia-ai-iot/llama_cpp:latest-jetson-thor \ llama-server \ -hf google/gemma-4-E4B-it-qat-q4_0-gguf \ --hf-file gemma-4-E4B_q4_0-it.gguf \ --host 0.0.0.0 \ --port 8000 \ --ctx-size 36864 \ --parallel 1 \ --n-gpu-layers 999 \ --jinja \ --lazy-mode on \ --load-mode mmap \ --cache-ram 0 The first run downloads the container and model. Wait for the model to finish loading, and leave the server terminal running while you use the browser or API. 2. Chat in Your Browser On your laptop, open http://JETSON_IP:8000, replacing JETSON_IP with your Jetson’s network address. If you’re connected over USB, open http://192.168.55.1:8000. If your browser is running on the Jetson itself, open http://localhost:8000. To find the Jetson’s network address, run hostname -I in a terminal on the Jetson. Use its Wi-Fi or Ethernet address for network access; 192.168.55.1 is the USB address. Your laptop must be able to reach the Jetson over that connection. Type a message in the chat box and send it. Keep the server terminal running while you chat. 3. Use the Model in Your App The same server exposes an OpenAI-compatible API. This request uses E2B as the example. If you started E4B, change the model ID to google/gemma-4-E4B-it-qat-q4_0-gguf. Open a second terminal on the Jetson and send the request: curl http://localhost:8000/v1/chat/completions \ -H 'Content-Type: application/json' \ -d '{ "model": "google/gemma-4-E2B-it-qat-q4_0-gguf", "messages": [ {"role": "user", "content": "Suggest three things a plant-watering robot should check before watering."} ], "max_tokens": 512 }' The response is JSON. Read the reply from choices[0].message.content. From your laptop, replace localhost with the Jetson’s network IP address or 192.168.55.1 over USB. Troubleshooting If the chat page does not open, check that the server has finished loading and that your laptop can reach the Jetson over USB or the network. Use the port from the launch command. If a model fails to load, check the error in the server terminal. Make sure the container and model downloads completed and that there is enough free storage and memory. Stop any previous model server before starting another one. Next Steps To try a larger Gemma 4 model on AGX Orin 64GB or Thor, see 26B-A4B or 31B. Use the command for your module and check its port and model ID when adapting the browser and API examples above.