Text Generation
MLX
Safetensors
English
gemma4
lora
aiops
kubernetes
nutanix
vmware
active-directory
pki
infrastructure-automation
conversational
Instructions to use htunn/gemma-4-e2b-aiops-hf with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use htunn/gemma-4-e2b-aiops-hf with MLX:
# Make sure mlx-lm is installed # pip install --upgrade mlx-lm # Generate text with mlx-lm from mlx_lm import load, generate model, tokenizer = load("htunn/gemma-4-e2b-aiops-hf") prompt = "Write a story about Einstein" messages = [{"role": "user", "content": prompt}] prompt = tokenizer.apply_chat_template( messages, add_generation_prompt=True ) text = generate(model, tokenizer, prompt=prompt, verbose=True) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- Pi
How to use htunn/gemma-4-e2b-aiops-hf with Pi:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "htunn/gemma-4-e2b-aiops-hf"
Configure the model in Pi
# Install Pi: npm install -g @mariozechner/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "mlx-lm": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "htunn/gemma-4-e2b-aiops-hf" } ] } } }Run Pi
# Start Pi in your project directory: pi
- OpenClaw new
How to use htunn/gemma-4-e2b-aiops-hf with OpenClaw:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "htunn/gemma-4-e2b-aiops-hf"
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 "htunn/gemma-4-e2b-aiops-hf" \ --custom-provider-id mlx-lm \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
Run OpenClaw
openclaw agent --local --agent main --message "Hello from Hugging Face"
- MLX LM
How to use htunn/gemma-4-e2b-aiops-hf with MLX LM:
Generate or start a chat session
# Install MLX LM uv tool install mlx-lm # Interactive chat REPL mlx_lm.chat --model "htunn/gemma-4-e2b-aiops-hf"
Run an OpenAI-compatible server
# Install MLX LM uv tool install mlx-lm # Start the server mlx_lm.server --model "htunn/gemma-4-e2b-aiops-hf" # Calling the OpenAI-compatible server with curl curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "htunn/gemma-4-e2b-aiops-hf", "messages": [ {"role": "user", "content": "Hello"} ] }' - Hermes Agent
How to use htunn/gemma-4-e2b-aiops-hf with Hermes Agent:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "htunn/gemma-4-e2b-aiops-hf"
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 htunn/gemma-4-e2b-aiops-hf
Run Hermes
hermes
| library_name: mlx | |
| license: apache-2.0 | |
| license_link: https://ai.google.dev/gemma/docs/gemma_4_license | |
| base_model: google/gemma-4-E2B-it | |
| datasets: | |
| - htunn/aiops-gemma | |
| language: | |
| - en | |
| tags: | |
| - mlx | |
| - gemma4 | |
| - lora | |
| - aiops | |
| - kubernetes | |
| - nutanix | |
| - vmware | |
| - active-directory | |
| - pki | |
| - infrastructure-automation | |
| - conversational | |
| pipeline_tag: text-generation | |
| # Gemma 4 E2B — AIOps Orchestrator (Safetensors / HF format) | |
| Fine-tuned from **[google/gemma-4-E2B-it](https://huggingface.co/google/gemma-4-E2B-it)** using Apple MLX LoRA on an M3 Pro (18 GB). The model is specialised as an **autonomous AIOps orchestrator agent** that maps infrastructure incident telemetry to structured, execution-ready JSON control schemas. | |
| > Looking for the quantised GGUF variant? | |
| > → **[htunn/gemma-4-e2b-aiops-gguf](https://huggingface.co/htunn/gemma-4-e2b-aiops-gguf)** | |
| --- | |
| ## Model Details | |
| | Field | Value | | |
| |---|---| | |
| | **Base model** | `google/gemma-4-E2B-it` | | |
| | **Architecture** | `Gemma4ForConditionalGeneration` | | |
| | **Precision** | BF16 | | |
| | **Parameters** | ~5B | | |
| | **Fine-tune method** | LoRA (MLX) | | |
| | **LoRA rank / scale** | 8 / 20.0 | | |
| | **Layers tuned** | 16 | | |
| | **Training iterations** | 600 | | |
| | **Batch size** | 1 | | |
| | **Learning rate** | 1e-4 | | |
| | **Max sequence length** | 2048 | | |
| | **Training hardware** | Apple M3 Pro, 18 GB Unified Memory | | |
| | **Framework** | `mlx-lm` | | |
| | **Dataset** | [htunn/aiops-gemma](https://huggingface.co/datasets/htunn/aiops-gemma) | | |
| | **License** | Apache 2.0 | | |
| --- | |
| ## Intended Use | |
| The model receives an `[AIOps-Agent]` incident description spanning one or more infrastructure domains and returns a **single JSON object** containing: | |
| - `action` — the remediation action to take | |
| - `target_*` — specific resource identifiers | |
| - `steps` — ordered list of discrete remediation steps | |
| - `api_calls` — REST API calls to execute | |
| - `priority` / `risk` — severity classification | |
| ### Covered Domains | |
| - **Kubernetes** — pod failures, etcd quorum loss, network partitions, cert-manager, autoscaling, storage | |
| - **Nutanix** — CVM network partitions, multi-cluster Prism Central, NearSync/async replication, Calm blueprints, Karbon, Era, stretched clusters, Flow microsegmentation | |
| - **VMware** — ESXi, vSAN, NSX-T, DRS, HA failover, vMotion, vCenter SSO | |
| - **Active Directory** — replication, FSMO, SYSVOL, cross-site failures, forest trusts | |
| - **ADFS / PKI** — certificate chain validation, OCSP, CRL, intermediate CA renewal, MFA providers | |
| - **Windows Server** — domain controllers, IIS, WSUS, Hyper-V, DFS, file services | |
| --- | |
| ## Usage | |
| ### Transformers | |
| ```python | |
| from transformers import AutoTokenizer, AutoModelForCausalLM | |
| import torch | |
| model_id = "htunn/gemma-4-e2b-aiops-hf" | |
| tokenizer = AutoTokenizer.from_pretrained(model_id) | |
| model = AutoModelForCausalLM.from_pretrained( | |
| model_id, | |
| torch_dtype=torch.bfloat16, | |
| device_map="auto", | |
| ) | |
| prompt = "[AIOps-Agent] Kubernetes etcd leader election failed due to network partition isolating etcd-01. API server returning 503. etcd cluster lost quorum." | |
| messages = [{"role": "user", "content": prompt}] | |
| inputs = tokenizer.apply_chat_template( | |
| messages, | |
| return_tensors="pt", | |
| add_generation_prompt=True, | |
| ).to(model.device) | |
| outputs = model.generate(inputs, max_new_tokens=256, do_sample=False) | |
| print(tokenizer.decode(outputs[0][inputs.shape[-1]:], skip_special_tokens=True)) | |
| ``` | |
| ### MLX (Apple Silicon) | |
| ```bash | |
| pip install mlx-lm | |
| mlx_lm.generate \ | |
| --model htunn/gemma-4-e2b-aiops-hf \ | |
| --prompt "[AIOps-Agent] Nutanix stretched cluster witness unreachable. RF1 degraded mode active." \ | |
| --max-tokens 256 | |
| ``` | |
| --- | |
| ## Example Output | |
| **Input:** | |
| ``` | |
| [AIOps-Agent] Kubernetes ingress controller presenting incomplete TLS certificate chain. | |
| Intermediate CA missing from secret bundle. External clients receiving SSL handshake errors. | |
| ``` | |
| **Output:** | |
| ```json | |
| { | |
| "action": "fix_incomplete_cert_chain", | |
| "target_service": "ingress-nginx", | |
| "missing_element": "intermediate_ca_certificate", | |
| "steps": [ | |
| "retrieve_full_certificate_chain_from_pki", | |
| "bundle_leaf_cert_with_intermediate_ca_cert", | |
| "update_kubernetes_tls_secret_with_complete_chain", | |
| "rolling_restart_ingress_controller_pods", | |
| "validate_chain_with_openssl_s_client" | |
| ], | |
| "commands": [ | |
| "openssl s_client -connect ingress.example.com:443 -showcerts", | |
| "openssl verify -CAfile chain.pem cert.pem" | |
| ], | |
| "api_calls": [ | |
| "PATCH /api/v1/namespaces/ingress-nginx/secrets/tls-wildcard-cert" | |
| ], | |
| "priority": "high" | |
| } | |
| ``` | |
| --- | |
| ## Training Data | |
| Trained on **[htunn/aiops-gemma](https://huggingface.co/datasets/htunn/aiops-gemma)** — 90 hand-crafted incident scenarios (73 train / 17 validation) in Gemma chat format, covering: | |
| - Network partition events across K8s, Nutanix, AD, and NSX-T | |
| - Certificate chain validation failures (incomplete chains, expired intermediates, OCSP, path-length constraints) | |
| - Multi-cluster Nutanix operations (Prism Central, NearSync, Calm, Era, Karbon, stretched clusters) | |
| - Cross-domain cascading failures involving 3–4 infrastructure layers simultaneously | |
| --- | |
| ## Limitations | |
| - Output format is tailored to the training schema; prompts not prefixed with `[AIOps-Agent]` may produce inconsistent results. | |
| - The model does not execute actions — it produces decision schemas for an orchestration layer to consume. | |
| - Coverage is limited to the incident types represented in the training set. | |
| --- | |
| ## Related Repos | |
| | Repo | Description | | |
| |---|---| | |
| | [htunn/gemma-4-e2b-aiops-gguf](https://huggingface.co/htunn/gemma-4-e2b-aiops-gguf) | Q4_K_M GGUF — run with Ollama or llama.cpp | | |
| | [htunn/aiops-gemma](https://huggingface.co/datasets/htunn/aiops-gemma) | Training dataset (JSONL) | | |
| | [GitHub: htunn/aiops-gemma4](https://github.com/htunn/aiops-gemma4) | Full fine-tuning pipeline source | | |