Views
No views yet
kubectl describe outputs, and CrashLoopBackOff scenarios.kubectl apply --dry-run=client -f ...) before applying to production.extensions/v1beta1) or be unaware of very recent Alpha features.privileged: true) if not explicitly instructed otherwise.1import torch
2from transformers import AutoModelForCausalLM, AutoTokenizer
3from peft import PeftModel
4
5# 1. Define Model IDs
6base_model_id = "Qwen/Qwen3-Coder-30B-A3B-Instruct"
7adapter_id = "Dogacel/Qwen3-Coder-30B-A3B-Kubernetes-Instruct-LoRA"
8
9# 2. Load Base Model (with device_map for memory efficiency)
10model = AutoModelForCausalLM.from_pretrained(
11 base_model_id,
12 torch_dtype=torch.float16,
13 device_map="auto",
14 low_cpu_mem_usage=True
15)
16
17# 3. Load the LoRA Adapter
18model = PeftModel.from_pretrained(model, adapter_id)
19tokenizer = AutoTokenizer.from_pretrained(base_model_id)
20
21# 4. Run Inference
22messages = [
23 {"role": "system", "content": "You are a Kubernetes expert. Diagnose issues step-by-step, then provide the fixed YAML configuration."},
24 {"role": "user", "content": "When I run kubectl apply, I get the following error: error validation data: [ValidationError(Deployment.spec.template.spec.containers[0]): unknown field \"imagePullPolicy\" in io.k8s.api.core.v1.Container]"}
25]
26
27text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
28inputs = tokenizer([text], return_tensors="pt").to(model.device)
29
30outputs = model.generate(**inputs, max_new_tokens=2048)
31print(tokenizer.decode(outputs[0], skip_special_tokens=True))["v_proj", "q_proj", "k_proj", "o_proj"]