Views
No views yet
unsloth/Qwen3.5-2B to provide explainable weld defect analysis.
Given a weld image and accompanying sensor telemetry (weld current, voltage, pressure, CO2 flow, feed rate, wire consumed), the model produces a structured report: weld quality classification (1 of 12 classes), visual observation, sensor analysis, model confidence, defect probability, severity, root cause, and corrective actions.unsloth/Qwen3.5-2B vision-language base model, trained on the IntelLabs/Intel_Robotic_Welding_Multimodal_Dataset (gated, publicly accessible dataset). Given a weld image paired with a natural-language prompt containing sensor telemetry, the model returns a structured, human-readable explainability report covering:--enable-lora) rather than used standalone.unsloth/Qwen3.5-2B together with this LoRA adapter and query it with a weld image plus a text prompt that includes sensor telemetry (e.g., primary weld current, secondary weld voltage, pressure, CO2 weld flow, feed rate, wire consumed). The model returns a structured weld quality report for use by weld inspectors, quality engineers, and robotic welding operators as a decision-support / explainability aid — it is not intended to autonomously accept/reject welds without human review.1$> docker run -t -d \
2 --shm-size 4g \
3 --net=host \
4 --ipc=host \
5 --privileged \
6 -v /dev/dri/by-path:/dev/dri/by-path \
7 -v /path/.cache/huggingface:/root/.cache/huggingface \
8 -v /fine-tuning:/fine-tuning \
9 --name=vllm-server \
10 --device /dev/dri:/dev/dri \
11 --entrypoint=/bin/bash \
12 intel/vllm:0.21.0-ubuntu24.04-20260625
13
14$> docker exec -it vllm-server bash
15
16$> VLLM_WORKER_MULTIPROC_METHOD=spawn vllm serve unsloth/Qwen3.5-2B \
17 --dtype=float16 \
18 --enforce-eager \
19 --port 8005 \
20 --block-size 32 \
21 --gpu-memory-utilization 0.182 \
22 --no-enable-prefix-caching \
23 --trust-remote-code \
24 --max-num-batched-tokens=8192 \
25 --max-model-len 8192 \
26 --served-model-name unsloth/Qwen3.5-2B \
27 --enable-lora \
28 --lora-modules qwen3.5-2b-adapter=/fine-tuning/qwen_3.5_2b_adapter/checkpoint/ \
29 -tp=1 \
30 --quantization fp8 \
31 --attention-backend TRITON_ATTN
321import base64
2from openai import OpenAI
3
4client = OpenAI(
5 api_key="sk-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
6 base_url="http://<HOST>:8005/v1"
7)
8
9def encode_image(path):
10 with open(path, "rb") as f:
11 return base64.b64encode(f.read()).decode("utf-8")
12
13b64_image = encode_image("path/to/weld_image.jpg")
14
15messages = [
16 {
17 "role": "system",
18 "content": [{
19 "type": "text",
20 "text": (
21 "You are an expert weld quality inspector and metallurgical engineer "
22 "with deep knowledge of MIG/MAG/TIG arc welding processes and industrial "
23 "weld defect analysis per AWS D1.1 and ISO 5817 standards. When shown a "
24 "weld image alongside time-series sensor readings, classify the weld "
25 "quality, identify any defect type, explain the root cause using sensor "
26 "evidence, assess severity, and recommend corrective actions."
27 ),
28 }],
29 },
30 {
31 "role": "user",
32 "content": [
33 {"type": "image_url", "image_url": {"url": f"data:image/jpeg;base64,{b64_image}"}},
34 {
35 "type": "text",
36 "text": (
37 "Given this weld image and the sensor telemetry, produce a structured "
38 "weld quality report covering defect classification, root cause, and "
39 "remediation steps.\nSensor Data:\n"
40 " • Primary Weld Current: <value> A\n"
41 " • Secondary Weld Voltage: <value> V\n"
42 " • Pressure: <value> bar\n"
43 " • CO2 Weld Flow: <value> L/min\n"
44 " • Feed: <value> mm/min\n"
45 " • Wire Consumed: <value> mm"
46 ),
47 },
48 ],
49 },
50]
51
52response = client.chat.completions.create(
53 model="qwen3.5-2b-adapter", # alias set in vLLM docker serve.
54 messages=messages,
55 max_tokens=2048,
56 temperature=1.5,
57 extra_body={"min_p": 0.1},
58)
59print(response)Weld Classification: <one of 12 defect classes>
Visual Observation: <description of what is visually apparent in the image>
Sensor Analysis: <interpretation of the provided telemetry values>
Model Confidence: <confidence score>
Defect Probability: <probability score>
Severity: <low / medium / high>
Root Cause: <inferred cause based on visual + sensor evidence>
Corrective Actions: <recommended remediation steps>FastVisionModel with 4-bit quantized loading and gradient checkpointing, wrapped with a trl.SFTTrainer / SFTConfig supervised fine-tuning loop. LoRA was applied to vision layers, language layers, attention modules, and MLP modules.load_in_4bit=True) with LoRA adapter trained in default (non-mixed) precision via Unsloth/TRL; inference server uses float16. adamw_torch on CPU/XPU; adamw_8bit on CUDA), weight_decay=0.001--enable-lora)unsloth/Qwen3.5-2B vision-language model, trained with a supervised fine-tuning (next-token prediction on assistant responses) objective to produce structured weld-defect explainability reports from image + sensor-telemetry-augmented text prompts.FastVisionModel, UnslothVisionDataCollator)SFTTrainer, SFTConfig)transformers--enable-lora