Text Generation
Transformers
Safetensors
English
gemma4
image-text-to-text
code
opencode
reasoning
tool-calling
bf16
conversational
Instructions to use LLMWildling/gemma-4-opencoder-40b-a8b-bf16-v2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use LLMWildling/gemma-4-opencoder-40b-a8b-bf16-v2 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="LLMWildling/gemma-4-opencoder-40b-a8b-bf16-v2") 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("LLMWildling/gemma-4-opencoder-40b-a8b-bf16-v2") model = AutoModelForMultimodalLM.from_pretrained("LLMWildling/gemma-4-opencoder-40b-a8b-bf16-v2", 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 LLMWildling/gemma-4-opencoder-40b-a8b-bf16-v2 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "LLMWildling/gemma-4-opencoder-40b-a8b-bf16-v2" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "LLMWildling/gemma-4-opencoder-40b-a8b-bf16-v2", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/LLMWildling/gemma-4-opencoder-40b-a8b-bf16-v2
- SGLang
How to use LLMWildling/gemma-4-opencoder-40b-a8b-bf16-v2 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 "LLMWildling/gemma-4-opencoder-40b-a8b-bf16-v2" \ --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": "LLMWildling/gemma-4-opencoder-40b-a8b-bf16-v2", "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 "LLMWildling/gemma-4-opencoder-40b-a8b-bf16-v2" \ --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": "LLMWildling/gemma-4-opencoder-40b-a8b-bf16-v2", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use LLMWildling/gemma-4-opencoder-40b-a8b-bf16-v2 with Docker Model Runner:
docker model run hf.co/LLMWildling/gemma-4-opencoder-40b-a8b-bf16-v2
| license: gemma | |
| base_model: google/gemma-4-26B-A4B-it | |
| library_name: transformers | |
| pipeline_tag: text-generation | |
| language: | |
| - en | |
| tags: | |
| - gemma4 | |
| - code | |
| - opencode | |
| - reasoning | |
| - tool-calling | |
| - bf16 | |
| # Gemma 4 OpenCoder 40B-A8B BF16 v2 | |
| Gemma 4 OpenCoder 40B-A8B v2 is a continued post-trained Gemma 4 coding | |
| model focused on agentic software engineering, long-context reasoning, and | |
| reliable tool use. It is designed for OpenCode workflows including repository | |
| navigation, implementation, editing, debugging, review, and sustained | |
| multi-file work. | |
| The checkpoint contains approximately **42.4B text parameters** and activates | |
| approximately **8.1B text parameters** per token. It retains Gemma 4's native | |
| **262,144-token context window**. | |
| This BF16 release is a self-contained checkpoint using the standard Gemma 4 | |
| architecture. It does not require an adapter, external router, or auxiliary | |
| model. | |
| ## Intended use | |
| - Agentic software engineering | |
| - OpenCode coding workflows | |
| - Long-context codebase navigation | |
| - Reasoning-enabled tool use | |
| - Multi-file implementation and editing | |
| - Debugging and code review | |
| Run with reasoning and automatic tool calling enabled, and preserve the | |
| checkpoint's included chat template. | |
| ## Model format | |
| - Weight format: BF16 safetensors | |
| - Architecture: Gemma 4 Mixture-of-Experts | |
| - Total text parameters: approximately 42.4B | |
| - Active text parameters: approximately 8.1B per token | |
| - Maximum context: 262,144 tokens | |
| ## vLLM | |
| ```bash | |
| vllm serve LLMWildling/gemma-4-opencoder-40b-a8b-bf16-v2 \ | |
| --tensor-parallel-size 2 \ | |
| --reasoning-parser gemma4 \ | |
| --tool-call-parser gemma4 \ | |
| --enable-auto-tool-choice \ | |
| --max-model-len 262144 | |
| ``` | |
| Adjust tensor parallelism and context length for the available hardware. For | |
| OpenCode, select the served model and keep reasoning and tool calling enabled. | |