Instructions to use HarshaDiwakar/orange-problem-git-lora with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use HarshaDiwakar/orange-problem-git-lora with Transformers:
# Use a pipeline as a high-level helper # Warning: Pipeline type "image-to-text" is no longer supported in transformers v5. # You must load the model directly (see below) or downgrade to v4.x with: # 'pip install "transformers<5.0.0' from transformers import pipeline pipe = pipeline("image-to-text", model="HarshaDiwakar/orange-problem-git-lora")# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("HarshaDiwakar/orange-problem-git-lora", dtype="auto") - Notebooks
- Google Colab
- Kaggle
Update README.md
Browse files
README.md
CHANGED
|
@@ -1,199 +1,170 @@
|
|
| 1 |
---
|
| 2 |
-
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
---
|
| 5 |
|
| 6 |
-
#
|
| 7 |
|
| 8 |
-
|
| 9 |
|
|
|
|
| 10 |
|
|
|
|
| 11 |
|
| 12 |
-
|
| 13 |
|
| 14 |
-
|
| 15 |
|
| 16 |
-
|
|
|
|
|
|
|
| 17 |
|
| 18 |
-
|
| 19 |
|
| 20 |
-
|
| 21 |
-
-
|
| 22 |
-
|
| 23 |
-
- **Model type:** [More Information Needed]
|
| 24 |
-
- **Language(s) (NLP):** [More Information Needed]
|
| 25 |
-
- **License:** [More Information Needed]
|
| 26 |
-
- **Finetuned from model [optional]:** [More Information Needed]
|
| 27 |
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
<!-- Provide the basic links for the model. -->
|
| 31 |
-
|
| 32 |
-
- **Repository:** [More Information Needed]
|
| 33 |
-
- **Paper [optional]:** [More Information Needed]
|
| 34 |
-
- **Demo [optional]:** [More Information Needed]
|
| 35 |
-
|
| 36 |
-
## Uses
|
| 37 |
-
|
| 38 |
-
<!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
|
| 39 |
-
|
| 40 |
-
### Direct Use
|
| 41 |
-
|
| 42 |
-
<!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
|
| 43 |
-
|
| 44 |
-
[More Information Needed]
|
| 45 |
-
|
| 46 |
-
### Downstream Use [optional]
|
| 47 |
-
|
| 48 |
-
<!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
|
| 49 |
-
|
| 50 |
-
[More Information Needed]
|
| 51 |
-
|
| 52 |
-
### Out-of-Scope Use
|
| 53 |
-
|
| 54 |
-
<!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
|
| 55 |
-
|
| 56 |
-
[More Information Needed]
|
| 57 |
-
|
| 58 |
-
## Bias, Risks, and Limitations
|
| 59 |
-
|
| 60 |
-
<!-- This section is meant to convey both technical and sociotechnical limitations. -->
|
| 61 |
-
|
| 62 |
-
[More Information Needed]
|
| 63 |
-
|
| 64 |
-
### Recommendations
|
| 65 |
-
|
| 66 |
-
<!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
|
| 67 |
-
|
| 68 |
-
Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
|
| 69 |
-
|
| 70 |
-
## How to Get Started with the Model
|
| 71 |
-
|
| 72 |
-
Use the code below to get started with the model.
|
| 73 |
-
|
| 74 |
-
[More Information Needed]
|
| 75 |
-
|
| 76 |
-
## Training Details
|
| 77 |
-
|
| 78 |
-
### Training Data
|
| 79 |
-
|
| 80 |
-
<!-- This should link to a Dataset Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->
|
| 81 |
-
|
| 82 |
-
[More Information Needed]
|
| 83 |
-
|
| 84 |
-
### Training Procedure
|
| 85 |
-
|
| 86 |
-
<!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
|
| 87 |
-
|
| 88 |
-
#### Preprocessing [optional]
|
| 89 |
-
|
| 90 |
-
[More Information Needed]
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
#### Training Hyperparameters
|
| 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 |
|
| 139 |
-
|
| 140 |
|
| 141 |
-
|
| 142 |
|
| 143 |
-
|
|
|
|
|
|
|
| 144 |
|
| 145 |
-
|
| 146 |
|
| 147 |
-
-
|
| 148 |
-
- **Hours used:** [More Information Needed]
|
| 149 |
-
- **Cloud Provider:** [More Information Needed]
|
| 150 |
-
- **Compute Region:** [More Information Needed]
|
| 151 |
-
- **Carbon Emitted:** [More Information Needed]
|
| 152 |
|
| 153 |
-
#
|
| 154 |
|
| 155 |
-
|
|
|
|
| 156 |
|
| 157 |
-
|
| 158 |
|
| 159 |
-
|
| 160 |
|
| 161 |
-
|
| 162 |
|
| 163 |
-
|
| 164 |
|
| 165 |
-
|
|
|
|
| 166 |
|
| 167 |
-
|
| 168 |
|
| 169 |
-
|
|
|
|
|
|
|
| 170 |
|
| 171 |
-
|
| 172 |
|
| 173 |
-
|
| 174 |
|
| 175 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 176 |
|
| 177 |
-
|
| 178 |
|
| 179 |
-
|
|
|
|
|
|
|
| 180 |
|
| 181 |
-
|
| 182 |
|
| 183 |
-
#
|
| 184 |
|
| 185 |
-
|
| 186 |
|
| 187 |
-
|
| 188 |
|
| 189 |
-
|
| 190 |
|
| 191 |
-
|
| 192 |
|
| 193 |
-
|
|
|
|
| 194 |
|
| 195 |
-
|
| 196 |
|
| 197 |
-
#
|
| 198 |
|
| 199 |
-
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
base_model: microsoft/git-base
|
| 4 |
+
tags:
|
| 5 |
+
- multimodal
|
| 6 |
+
- image-to-text
|
| 7 |
+
- lora
|
| 8 |
+
- transformers
|
| 9 |
+
- ui-captioning
|
| 10 |
+
datasets:
|
| 11 |
+
- rootsautomation/RICO-Screen2Words
|
| 12 |
---
|
| 13 |
|
| 14 |
+
# GIT LoRA Fine-Tuned on RICO-Screen2Words
|
| 15 |
|
| 16 |
+
## Model Description
|
| 17 |
|
| 18 |
+
This repository contains **LoRA adapters for the GIT (Generative Image-to-Text Transformer) model**, fine-tuned for **UI screen caption generation**.
|
| 19 |
|
| 20 |
+
The model generates **natural language descriptions of mobile UI screenshots**.
|
| 21 |
|
| 22 |
+
Instead of full fine-tuning, **LoRA (Low-Rank Adaptation)** is used to efficiently adapt the base model while training only a small number of parameters.
|
| 23 |
|
| 24 |
+
Base model:
|
| 25 |
|
| 26 |
+
```
|
| 27 |
+
microsoft/git-base
|
| 28 |
+
```
|
| 29 |
|
| 30 |
+
Dataset used:
|
| 31 |
|
| 32 |
+
```
|
| 33 |
+
rootsautomation/RICO-Screen2Words
|
| 34 |
+
```
|
|
|
|
|
|
|
|
|
|
|
|
|
| 35 |
|
| 36 |
+
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
|
| 38 |
+
# Intended Use
|
| 39 |
|
| 40 |
+
The model takes a **mobile UI screenshot as input** and generates a **caption describing the interface**.
|
| 41 |
|
| 42 |
+
Example use cases:
|
| 43 |
|
| 44 |
+
- UI documentation
|
| 45 |
+
- Accessibility tools
|
| 46 |
+
- Screen summarization
|
| 47 |
+
- Interface understanding
|
| 48 |
|
| 49 |
+
---
|
| 50 |
|
| 51 |
+
# Training Details
|
| 52 |
|
| 53 |
+
The model was fine-tuned using the **RICO-Screen2Words dataset**, which contains screenshots of mobile applications paired with human-written captions.
|
| 54 |
|
| 55 |
+
Training method:
|
| 56 |
|
| 57 |
+
- Parameter-efficient fine-tuning using **LoRA**
|
| 58 |
+
- Base model: `microsoft/git-base`
|
| 59 |
+
- Vision encoder: Vision Transformer
|
| 60 |
+
- Text decoder: Transformer language model
|
| 61 |
|
| 62 |
+
Training was designed to run on **NVIDIA T4 GPUs** using HuggingFace Transformers and PEFT.
|
| 63 |
|
| 64 |
+
---
|
| 65 |
|
| 66 |
+
# Files in This Repository
|
| 67 |
|
| 68 |
+
This repository contains the **LoRA adapter weights**:
|
| 69 |
|
| 70 |
+
```
|
| 71 |
+
adapter_config.json
|
| 72 |
+
adapter_model.safetensors
|
| 73 |
+
```
|
| 74 |
|
| 75 |
+
These adapters can be loaded on top of the base GIT model.
|
| 76 |
|
| 77 |
+
---
|
| 78 |
|
| 79 |
+
# Loading the Model
|
| 80 |
|
| 81 |
+
To use the adapters, first load the base model and then load the LoRA adapters.
|
| 82 |
|
| 83 |
+
```python
|
| 84 |
+
from transformers import AutoProcessor, GitForCausalLM
|
| 85 |
+
from peft import PeftModel
|
| 86 |
|
| 87 |
+
base_model = GitForCausalLM.from_pretrained("microsoft/git-base")
|
| 88 |
|
| 89 |
+
model = PeftModel.from_pretrained(
|
| 90 |
+
base_model,
|
| 91 |
+
"HarshaDiwakar/orange-problem-git-lora"
|
| 92 |
+
)
|
| 93 |
|
| 94 |
+
processor = AutoProcessor.from_pretrained("microsoft/git-base")
|
| 95 |
+
```
|
| 96 |
|
| 97 |
+
---
|
| 98 |
|
| 99 |
+
# Merging LoRA Adapters
|
| 100 |
|
| 101 |
+
The LoRA adapters can optionally be merged with the base model before inference.
|
| 102 |
|
| 103 |
+
```python
|
| 104 |
+
model = model.merge_and_unload()
|
| 105 |
+
```
|
| 106 |
|
| 107 |
+
This produces a standalone model equivalent to full fine-tuning.
|
| 108 |
|
| 109 |
+
---
|
|
|
|
|
|
|
|
|
|
|
|
|
| 110 |
|
| 111 |
+
# Example Inference
|
| 112 |
|
| 113 |
+
```python
|
| 114 |
+
from PIL import Image
|
| 115 |
|
| 116 |
+
image = Image.open("example_ui.png")
|
| 117 |
|
| 118 |
+
inputs = processor(images=image, return_tensors="pt")
|
| 119 |
|
| 120 |
+
outputs = model.generate(**inputs)
|
| 121 |
|
| 122 |
+
caption = processor.batch_decode(outputs, skip_special_tokens=True)
|
| 123 |
|
| 124 |
+
print(caption)
|
| 125 |
+
```
|
| 126 |
|
| 127 |
+
Example output:
|
| 128 |
|
| 129 |
+
```
|
| 130 |
+
"This screen shows a shopping application with product listings and navigation tabs."
|
| 131 |
+
```
|
| 132 |
|
| 133 |
+
---
|
| 134 |
|
| 135 |
+
# Requirements
|
| 136 |
|
| 137 |
+
```
|
| 138 |
+
transformers
|
| 139 |
+
peft
|
| 140 |
+
torch
|
| 141 |
+
Pillow
|
| 142 |
+
```
|
| 143 |
|
| 144 |
+
Install dependencies:
|
| 145 |
|
| 146 |
+
```
|
| 147 |
+
pip install transformers peft torch pillow
|
| 148 |
+
```
|
| 149 |
|
| 150 |
+
---
|
| 151 |
|
| 152 |
+
# Dataset
|
| 153 |
|
| 154 |
+
The model was trained on:
|
| 155 |
|
| 156 |
+
https://huggingface.co/datasets/rootsautomation/RICO-Screen2Words
|
| 157 |
|
| 158 |
+
---
|
| 159 |
|
| 160 |
+
# Limitations
|
| 161 |
|
| 162 |
+
- Performance depends on the diversity of UI layouts present in the dataset.
|
| 163 |
+
- The model may struggle with very complex or uncommon UI designs.
|
| 164 |
|
| 165 |
+
---
|
| 166 |
|
| 167 |
+
# Citation
|
| 168 |
|
| 169 |
+
- RICO Dataset
|
| 170 |
+
- Microsoft GIT model
|