RanenSim commited on
Commit
a16daa8
·
verified ·
1 Parent(s): b3e1422

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +103 -0
README.md ADDED
@@ -0,0 +1,103 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ language:
4
+ - en
5
+ tags:
6
+ - vision
7
+ - hotel
8
+ - cleanliness-detection
9
+ - lora
10
+ - qlora
11
+ - unsloth
12
+ - qwen3-vl
13
+ ---
14
+
15
+ # RoomAudit LoRA Adapters
16
+
17
+ QLoRA adapters for hotel room cleanliness detection, fine-tuned on Qwen3-VL-4B-Instruct. Part of the roomaudit project.
18
+
19
+ Three adapters are included here, each from a different training approach. All were trained on the same synthetic dataset: 218 clean hotel room images with defects painted in using SAM3 + FLUX.1 Fill inpainting.
20
+
21
+ ---
22
+
23
+ ## Adapters
24
+
25
+ ### `lora_adapter` — primary adapter, use this one
26
+
27
+ Single-turn format. Takes a room image, returns a JSON verdict with clean/messy classification and a defect list.
28
+
29
+ | Metric | Score |
30
+ |---|---|
31
+ | Accuracy | 0.714 |
32
+ | Precision | 0.676 |
33
+ | Recall | 0.906 |
34
+ | F1 | 0.774 |
35
+
36
+ ### `lora_adapter_agent` — agentic (two-turn) adapter
37
+
38
+ Two-turn format: Round 1 selects 1-2 regions to inspect, Round 2 gives the final verdict after seeing the crops. Scores below the single-turn adapter on the current synthetic dataset. Included as a reference for the agentic training approach.
39
+
40
+ | Metric | Score |
41
+ |---|---|
42
+ | Accuracy | 0.663 |
43
+ | Precision | 0.622 |
44
+ | Recall | 0.902 |
45
+ | F1 | 0.736 |
46
+
47
+ ### `lora_adapter_vit` — ViT + LLM adapter
48
+
49
+ Same single-turn format as the primary adapter, but with LoRA applied to the vision encoder as well as the language layers. Worse than LLM-only training: the ViT adapters learn to detect FLUX inpainting artefacts rather than actual room defects. Included as a reference.
50
+
51
+ | Metric | Score |
52
+ |---|---|
53
+ | Accuracy | 0.587 |
54
+ | Precision | 0.568 |
55
+ | Recall | 0.991 |
56
+ | F1 | 0.722 |
57
+
58
+ ---
59
+
60
+ ## Quickstart
61
+
62
+ ```python
63
+ from huggingface_hub import snapshot_download
64
+ from unsloth import FastVisionModel
65
+ from peft import PeftModel
66
+ from PIL import Image
67
+ import json, re
68
+ from qwen_vl_utils import process_vision_info
69
+
70
+ snapshot_download(
71
+ "RanenSim/RoomAudit-Lora",
72
+ allow_patterns="lora_adapter/*",
73
+ local_dir="outputs/",
74
+ )
75
+
76
+ model, tokenizer = FastVisionModel.from_pretrained(
77
+ "unsloth/Qwen3-VL-4B-Instruct-unsloth-bnb-4bit",
78
+ load_in_4bit=True,
79
+ )
80
+ model = PeftModel.from_pretrained(model, "outputs/lora_adapter")
81
+ FastVisionModel.for_inference(model)
82
+
83
+ image = Image.open("room.jpg").convert("RGB")
84
+ messages = [
85
+ {"role": "system", "content": [{"type": "text", "text": "You are a hotel room cleanliness inspector. Respond ONLY with valid JSON."}]},
86
+ {"role": "user", "content": [
87
+ {"type": "image", "image": image},
88
+ {"type": "text", "text": '{"clean": true/false, "defects": [{"object": "...", "type": "...", "description": "..."}]}'},
89
+ ]},
90
+ ]
91
+ text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
92
+ image_inputs, _ = process_vision_info(messages)
93
+ inputs = tokenizer(text=[text], images=image_inputs, padding=True, return_tensors="pt").to("cuda")
94
+ out_ids = model.generate(**inputs, max_new_tokens=256, do_sample=True, temperature=0.1)
95
+ output = tokenizer.decode(out_ids[0][inputs.input_ids.shape[1]:], skip_special_tokens=True)
96
+ result = json.loads(re.search(r"\{.*\}", output, re.DOTALL).group())
97
+ ```
98
+
99
+ See each adapter's README for full usage instructions, training config, and results.
100
+
101
+ ---
102
+
103
+ Source code, training notebooks, and data generation pipeline: [github.com/Razorbird360/roomaudit](https://github.com/Razorbird360/roomaudit)