Text Generation
PEFT
Safetensors
English
deployxa
devops
sre
cloud
deployment-intelligence
root-cause-analysis
self-healing
container-orchestration
kubernetes
docker
conversational
Eval Results (legacy)
Instructions to use deployxa/deployxa-lm-1.0 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use deployxa/deployxa-lm-1.0 with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen2.5-Coder-1.5B-Instruct") model = PeftModel.from_pretrained(base_model, "deployxa/deployxa-lm-1.0") - Notebooks
- Google Colab
- Kaggle
File size: 5,368 Bytes
b948218 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 | #!/usr/bin/env python3
"""
Deployxa LM 1.0 - Sample Inference Script.
Demonstrates loading the fine-tuned Deployxa LM 1.0 adapter on top of
Qwen/Qwen2.5-Coder-1.5B-Instruct using PyTorch, Transformers, and PEFT.
Brand: Deployxa Cloud Inc. (https://deployxa.com)
Product: Deployxa LM 1.0
Tagline: Build. Deploy. Scale.
"""
import sys
import json
import argparse
from pathlib import Path
try:
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM
from peft import PeftModel
except ImportError:
print("Error: PyTorch, Transformers, or PEFT not installed.")
print("Install dependencies with: pip install torch transformers peft accelerate")
sys.exit(1)
BASE_MODEL_ID = "Qwen/Qwen2.5-Coder-1.5B-Instruct"
# Default to current folder if adapter_model.safetensors exists here, else Hugging Face hub
DEFAULT_ADAPTER = str(Path(__file__).resolve().parent) if (Path(__file__).resolve().parent / "adapter_model.safetensors").exists() else "deployxa/deployxa-lm-1.0"
APPROVED_CANONICAL_CATEGORIES = [
"BUILD_COMPILATION_FAILED",
"CONTAINER_STARTUP_CRASH",
"HEALTH_CHECK_FAILURE",
"DEPENDENCY_INSTALLATION_FAILED",
"RESOURCE_EXHAUSTION",
"NETWORKING_ROUTING_ERROR",
"DATABASE_MIGRATION_FAILURE",
"PORT_BINDING_CONFLICT",
"INVALID_APPLICATION_CONFIG"
]
def format_diagnostic_prompt(template_id: str, telemetry_logs: str) -> str:
"""Constructs the official Deployxa LM 1.0 diagnostic prompt with pinned taxonomy."""
categories_str = ", ".join(APPROVED_CANONICAL_CATEGORIES)
return (
"<|im_start|>system\n"
"You are DXA-LM, Deployxa's specialist deployment diagnostic and repair advisor.\n"
"Analyze the provided deployment logs and telemetry. Determine the deployment status, "
"exact root cause category, and whether evidence is sufficient to make a diagnosis.\n"
f"Allowed root cause categories: {categories_str}.\n"
"Format response strictly as JSON with keys: deployment_status, root_cause_category, "
"confidence, evidence, reasoning_summary, abstain, abstention_reason.<|im_end|>\n"
"<|im_start|>user\n"
f"Deployment Logs ({template_id}):\n"
f"{telemetry_logs}\n\n"
"Diagnose deployment:<|im_end|>\n"
"<|im_start|>assistant\n"
)
def main():
parser = argparse.ArgumentParser(description="Run Deployxa LM 1.0 Diagnostic Inference")
parser.add_argument("--adapter", default=DEFAULT_ADAPTER, help="Path or Hugging Face repo ID for adapter")
parser.add_argument("--base-model", default=BASE_MODEL_ID, help="Base model identifier")
parser.add_argument("--template", default="solid-start", help="Service or framework template name")
parser.add_argument("--log", default=None, help="Path to error log file (or pass raw text)")
args = parser.parse_args()
sample_log = """
2026-10-18T10:15:20Z [server] Starting HTTP listener on port 3000...
2026-10-18T10:15:20Z [server] uncaughtException: Error: listen EADDRINUSE: address already in use :::3000
at Server.setupListenHandle [as _listen2] (node:net:1855:16)
at listenInCluster (node:net:1903:12)
at Server.listen (node:net:2001:7)
2026-10-18T10:15:21Z [systemd] app.service: Main process exited, code=exited, status=1/FAILURE
"""
if args.log:
p = Path(args.log)
if p.exists() and p.is_file():
sample_log = p.read_text(encoding="utf-8", errors="ignore")
else:
sample_log = args.log
device = "cuda" if torch.cuda.is_available() else ("mps" if torch.backends.mps.is_available() else "cpu")
print(f"Loading base model '{args.base_model}' on {device}...")
tokenizer = AutoTokenizer.from_pretrained(args.base_model, trust_remote_code=True)
base_model = AutoModelForCausalLM.from_pretrained(
args.base_model,
torch_dtype=torch.float16 if device != "cpu" else torch.float32,
device_map="auto" if device == "cuda" else None,
trust_remote_code=True
)
if device != "cuda":
base_model.to(device)
print(f"Attaching Deployxa LM 1.0 adapter '{args.adapter}'...")
model = PeftModel.from_pretrained(base_model, args.adapter)
model.eval()
prompt = format_diagnostic_prompt(args.template, sample_log)
inputs = tokenizer(prompt, return_tensors="pt").to(device)
print("Running neural diagnostic inference...")
with torch.no_grad():
output_ids = model.generate(
**inputs,
max_new_tokens=400,
temperature=0.01,
do_sample=False,
pad_token_id=tokenizer.eos_token_id
)
response_text = tokenizer.decode(output_ids[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True).strip()
# Strip markdown code blocks if wrapped
if response_text.startswith("```json"):
response_text = response_text[7:]
elif response_text.startswith("```"):
response_text = response_text[3:]
if response_text.endswith("```"):
response_text = response_text[:-3]
print("\n" + "=" * 60)
print("DEPLOYXA LM 1.0 PREDICTION OUTPUT:")
print("=" * 60)
try:
data = json.loads(response_text)
print(json.dumps(data, indent=2))
except Exception:
print(response_text)
if __name__ == "__main__":
main()
|