Instructions to use MassivDash/Gemma-4-RUST-CODER-12B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use MassivDash/Gemma-4-RUST-CODER-12B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="MassivDash/Gemma-4-RUST-CODER-12B", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("MassivDash/Gemma-4-RUST-CODER-12B", dtype="auto", device_map="auto") - llama-cpp-python
How to use MassivDash/Gemma-4-RUST-CODER-12B with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="MassivDash/Gemma-4-RUST-CODER-12B", filename="gemma-4-12B-it.BF16-mmproj.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 MassivDash/Gemma-4-RUST-CODER-12B 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 MassivDash/Gemma-4-RUST-CODER-12B:Q4_K_M # Run inference directly in the terminal: llama cli -hf MassivDash/Gemma-4-RUST-CODER-12B:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf MassivDash/Gemma-4-RUST-CODER-12B:Q4_K_M # Run inference directly in the terminal: llama cli -hf MassivDash/Gemma-4-RUST-CODER-12B: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 MassivDash/Gemma-4-RUST-CODER-12B:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf MassivDash/Gemma-4-RUST-CODER-12B: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 MassivDash/Gemma-4-RUST-CODER-12B:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf MassivDash/Gemma-4-RUST-CODER-12B:Q4_K_M
Use Docker
docker model run hf.co/MassivDash/Gemma-4-RUST-CODER-12B:Q4_K_M
- LM Studio
- Jan
- vLLM
How to use MassivDash/Gemma-4-RUST-CODER-12B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "MassivDash/Gemma-4-RUST-CODER-12B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "MassivDash/Gemma-4-RUST-CODER-12B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/MassivDash/Gemma-4-RUST-CODER-12B:Q4_K_M
- SGLang
How to use MassivDash/Gemma-4-RUST-CODER-12B 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 "MassivDash/Gemma-4-RUST-CODER-12B" \ --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": "MassivDash/Gemma-4-RUST-CODER-12B", "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 "MassivDash/Gemma-4-RUST-CODER-12B" \ --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": "MassivDash/Gemma-4-RUST-CODER-12B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Ollama
How to use MassivDash/Gemma-4-RUST-CODER-12B with Ollama:
ollama run hf.co/MassivDash/Gemma-4-RUST-CODER-12B:Q4_K_M
- Unsloth Studio
How to use MassivDash/Gemma-4-RUST-CODER-12B 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 MassivDash/Gemma-4-RUST-CODER-12B 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 MassivDash/Gemma-4-RUST-CODER-12B to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for MassivDash/Gemma-4-RUST-CODER-12B to start chatting
- Pi
How to use MassivDash/Gemma-4-RUST-CODER-12B with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf MassivDash/Gemma-4-RUST-CODER-12B: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": "MassivDash/Gemma-4-RUST-CODER-12B:Q4_K_M" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Hermes Agent new
How to use MassivDash/Gemma-4-RUST-CODER-12B with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf MassivDash/Gemma-4-RUST-CODER-12B: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 MassivDash/Gemma-4-RUST-CODER-12B:Q4_K_M
Run Hermes
hermes
- Atomic Chat new
- OpenClaw new
How to use MassivDash/Gemma-4-RUST-CODER-12B with OpenClaw:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf MassivDash/Gemma-4-RUST-CODER-12B: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 "MassivDash/Gemma-4-RUST-CODER-12B: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 MassivDash/Gemma-4-RUST-CODER-12B with Docker Model Runner:
docker model run hf.co/MassivDash/Gemma-4-RUST-CODER-12B:Q4_K_M
- Lemonade
How to use MassivDash/Gemma-4-RUST-CODER-12B with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull MassivDash/Gemma-4-RUST-CODER-12B:Q4_K_M
Run and chat with the model
lemonade run user.Gemma-4-RUST-CODER-12B-Q4_K_M
List all available models
lemonade list
Gemma-4-12B-Rust-Coder
This model is a specialized fine-tune of Google's Gemma-4-12B-it, rigorously optimized for Rust systems programming, memory safety patterns, and high-performance application development.
While the base model provides excellent general reasoning, this fine-tune specifically enhances idiomatic Rust code generation, handling of advanced concurrency constraints, and standard library familiarity.
🦀 Fine-Tuning Focus & Model Details
- Base Model:
google/gemma-4-12B-it - Target Domain: Rust software development and debugging.
- Key Improvements:
- Idiomatic Rust: Generates clean, "Rusty" code utilizing modern patterns (e.g., proper
ResultandOptionhandling, idiomatic error propagation). - Concurrency & Safety: Enhanced understanding of strict borrow checker rules, lifetimes,
Send/Synctraits, and async runtimes likeTokio. - Instruction Following: Tuned to deliver concise, code-first responses with minimal conversational overhead compared to the base model.
- Idiomatic Rust: Generates clean, "Rusty" code utilizing modern patterns (e.g., proper
🤝 Training Data & Acknowledgments
Special thanks to Fortytwo-Network for providing the Strandset-Rust-v1 dataset. This model's specialized knowledge of the Rust ecosystem is a direct result of fine-tuning on this high-quality, domain-specific instruction set.
⚙️ Training Procedure
This model was trained using Unsloth Studio for optimal memory efficiency and throughput.
- Method: QLoRA
- Steps: 30
- Tokens Processed: 148,306
- Learning Rate: 8.00e-6
- Final Loss: 1.1045
- Training Time: 3 minutes 57 seconds
- Hardware: [Enter your GPU here, e.g., 1x RTX 4090 / A100]
🚀 Usage
You can easily load and run this model using the Hugging Face transformers library.
Installation:
pip install transformers accelerate torch
Inference Snippet:
from transformers import AutoTokenizer, AutoModelForCausalLM
import torch
model_id = "MassivDash/Gemma-4-12B-Rust-Coder"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
model_id,
device_map="auto",
torch_dtype=torch.bfloat16
)
messages = [
{"role": "user", "content": "Write an asynchronous Rust function using Tokio to fetch a URL and return its body as a String. Handle errors idiomatically."}
]
inputs = tokenizer.apply_chat_template(messages, return_tensors="pt", add_generation_prompt=True).to("cuda")
outputs = model.generate(**inputs, max_new_tokens=512, temperature=0.2)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
⚠️ Limitations & Out-of-Scope Use
- Language Degradation: Because this model was heavily fine-tuned on Rust, its performance in other languages (like Python or JavaScript) may have degraded relative to the base model (catastrophic forgetting).
- Non-Coding Tasks: It is designed specifically for technical and programming queries. It is not recommended for creative writing, general knowledge trivia, or non-technical instruction following.
- Compilation Guarantees: While fine-tuned for syntax and borrow-checker compliance, the model may still occasionally generate code that fails to compile or contains logical bugs. Always review and test generated code.
🔗 Stay Connected
For more insights on AI development, custom integrations, and fine-tuning, visit my blog: 👉 spaceout.pl
This model was trained 2x faster with Unsloth
- Downloads last month
- -