Update README.md
Browse files
README.md
CHANGED
|
@@ -1,199 +1,176 @@
|
|
| 1 |
---
|
| 2 |
library_name: transformers
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
---
|
| 5 |
|
| 6 |
-
#
|
| 7 |
-
|
| 8 |
-
<!-- Provide a quick summary of what the model is/does. -->
|
| 9 |
-
|
| 10 |
|
|
|
|
| 11 |
|
| 12 |
## Model Details
|
| 13 |
|
| 14 |
### Model Description
|
| 15 |
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
This is the model card of a 🤗 transformers model that has been pushed on the Hub. This model card has been automatically generated.
|
| 19 |
-
|
| 20 |
-
- **Developed by:** [More Information Needed]
|
| 21 |
-
- **Funded by [optional]:** [More Information Needed]
|
| 22 |
-
- **Shared by [optional]:** [More Information Needed]
|
| 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 |
-
|
| 31 |
|
| 32 |
-
- **Repository:** [
|
| 33 |
-
- **
|
| 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 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
|
| 48 |
-
|
| 49 |
|
| 50 |
-
|
|
|
|
|
|
|
| 51 |
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
<!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
|
| 55 |
|
| 56 |
-
|
|
|
|
|
|
|
|
|
|
| 57 |
|
| 58 |
-
##
|
|
|
|
| 59 |
|
| 60 |
-
|
|
|
|
| 61 |
|
| 62 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 63 |
|
| 64 |
-
|
|
|
|
| 65 |
|
| 66 |
-
|
|
|
|
|
|
|
| 67 |
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
## How to Get Started with the Model
|
| 71 |
-
|
| 72 |
-
Use the code below to get started with the model.
|
| 73 |
|
| 74 |
-
|
|
|
|
|
|
|
|
|
|
| 75 |
|
| 76 |
## Training Details
|
| 77 |
|
| 78 |
### Training Data
|
| 79 |
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
[More Information Needed]
|
| 83 |
|
| 84 |
### Training Procedure
|
| 85 |
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
|
| 93 |
#### Training Hyperparameters
|
| 94 |
|
| 95 |
-
- **Training regime:**
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
<!-- This section describes the evaluation protocols and provides the results. -->
|
| 106 |
-
|
| 107 |
-
### Testing Data, Factors & Metrics
|
| 108 |
-
|
| 109 |
-
#### Testing Data
|
| 110 |
-
|
| 111 |
-
<!-- This should link to a Dataset Card if possible. -->
|
| 112 |
-
|
| 113 |
-
[More Information Needed]
|
| 114 |
|
| 115 |
-
####
|
| 116 |
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
#### Metrics
|
| 122 |
-
|
| 123 |
-
<!-- These are the evaluation metrics being used, ideally with a description of why. -->
|
| 124 |
-
|
| 125 |
-
[More Information Needed]
|
| 126 |
-
|
| 127 |
-
### Results
|
| 128 |
-
|
| 129 |
-
[More Information Needed]
|
| 130 |
-
|
| 131 |
-
#### Summary
|
| 132 |
|
|
|
|
| 133 |
|
|
|
|
| 134 |
|
| 135 |
-
|
|
|
|
|
|
|
|
|
|
| 136 |
|
| 137 |
-
|
| 138 |
|
| 139 |
-
|
|
|
|
|
|
|
|
|
|
| 140 |
|
| 141 |
## Environmental Impact
|
| 142 |
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
|
| 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 |
### Compute Infrastructure
|
| 160 |
|
| 161 |
-
|
| 162 |
-
|
| 163 |
-
|
| 164 |
-
|
| 165 |
-
[More Information Needed]
|
| 166 |
-
|
| 167 |
-
#### Software
|
| 168 |
-
|
| 169 |
-
[More Information Needed]
|
| 170 |
-
|
| 171 |
-
## Citation [optional]
|
| 172 |
-
|
| 173 |
-
<!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
|
| 174 |
-
|
| 175 |
-
**BibTeX:**
|
| 176 |
-
|
| 177 |
-
[More Information Needed]
|
| 178 |
-
|
| 179 |
-
**APA:**
|
| 180 |
-
|
| 181 |
-
[More Information Needed]
|
| 182 |
-
|
| 183 |
-
## Glossary [optional]
|
| 184 |
-
|
| 185 |
-
<!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
|
| 186 |
-
|
| 187 |
-
[More Information Needed]
|
| 188 |
-
|
| 189 |
-
## More Information [optional]
|
| 190 |
-
|
| 191 |
-
[More Information Needed]
|
| 192 |
|
| 193 |
-
##
|
| 194 |
|
| 195 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 196 |
|
| 197 |
## Model Card Contact
|
| 198 |
|
| 199 |
-
|
|
|
|
| 1 |
---
|
| 2 |
library_name: transformers
|
| 3 |
+
license: mit
|
| 4 |
+
base_model:
|
| 5 |
+
- meta-llama/Llama-3.2-11B-Vision-Instruct
|
| 6 |
+
tags:
|
| 7 |
+
- vision-language
|
| 8 |
+
- product-descriptions
|
| 9 |
+
- e-commerce
|
| 10 |
+
- fine-tuned
|
| 11 |
+
- lora
|
| 12 |
+
- llama
|
| 13 |
+
datasets:
|
| 14 |
+
- philschmid/amazon-product-descriptions-vlm
|
| 15 |
+
language:
|
| 16 |
+
- en
|
| 17 |
+
pipeline_tag: image-text-to-text
|
| 18 |
---
|
| 19 |
|
| 20 |
+
# Finetuned Llama 3.2 Vision for Product Description Generation
|
|
|
|
|
|
|
|
|
|
| 21 |
|
| 22 |
+
A fine-tuned version of Meta's Llama-3.2-11B-Vision-Instruct model specialized for generating SEO-optimized product descriptions from product images, names, and categories.
|
| 23 |
|
| 24 |
## Model Details
|
| 25 |
|
| 26 |
### Model Description
|
| 27 |
|
| 28 |
+
This model generates concise, SEO-optimized product descriptions for e-commerce applications. Given a product image, name, and category, it produces mobile-friendly descriptions suitable for online marketplaces and product catalogs.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
|
| 30 |
+
- **Developed by:** Aayush672
|
| 31 |
+
- **Model type:** Vision-Language Model (Multimodal)
|
| 32 |
+
- **Language(s):** English
|
| 33 |
+
- **License:** MIT
|
| 34 |
+
- **Finetuned from model:** meta-llama/Llama-3.2-11B-Vision-Instruct
|
| 35 |
|
| 36 |
+
### Model Sources
|
| 37 |
|
| 38 |
+
- **Repository:** [Aayush672/Finetuned-llama3.2-Vision-Model](https://huggingface.co/Aayush672/Finetuned-llama3.2-Vision-Model)
|
| 39 |
+
- **Base Model:** [meta-llama/Llama-3.2-11B-Vision-Instruct](https://huggingface.co/meta-llama/Llama-3.2-11B-Vision-Instruct)
|
|
|
|
| 40 |
|
| 41 |
## Uses
|
| 42 |
|
|
|
|
|
|
|
| 43 |
### Direct Use
|
| 44 |
|
| 45 |
+
The model is designed for generating product descriptions in e-commerce scenarios:
|
| 46 |
+
- Product catalog automation
|
| 47 |
+
- SEO-optimized content generation
|
| 48 |
+
- Mobile-friendly product descriptions
|
| 49 |
+
- Marketplace listing optimization
|
| 50 |
|
| 51 |
+
### Example Usage
|
| 52 |
|
| 53 |
+
```python
|
| 54 |
+
from transformers import AutoModelForVision2Seq, AutoProcessor
|
| 55 |
+
from PIL import Image
|
| 56 |
|
| 57 |
+
model = AutoModelForVision2Seq.from_pretrained("Aayush672/Finetuned-llama3.2-Vision-Model")
|
| 58 |
+
processor = AutoProcessor.from_pretrained("Aayush672/Finetuned-llama3.2-Vision-Model")
|
|
|
|
| 59 |
|
| 60 |
+
# Prepare your inputs
|
| 61 |
+
image = Image.open("product_image.jpg")
|
| 62 |
+
product_name = "Wireless Bluetooth Headphones"
|
| 63 |
+
category = "Electronics | Audio | Headphones"
|
| 64 |
|
| 65 |
+
prompt = f"""Create a Short Product description based on the provided ##PRODUCT NAME## and ##CATEGORY## and image.
|
| 66 |
+
Only return description. The description should be SEO optimized and for a better mobile search experience.
|
| 67 |
|
| 68 |
+
##PRODUCT NAME##: {product_name}
|
| 69 |
+
##CATEGORY##: {category}"""
|
| 70 |
|
| 71 |
+
messages = [{
|
| 72 |
+
"role": "user",
|
| 73 |
+
"content": [
|
| 74 |
+
{"type": "text", "text": prompt},
|
| 75 |
+
{"type": "image", "image": image}
|
| 76 |
+
]
|
| 77 |
+
}]
|
| 78 |
|
| 79 |
+
text = processor.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
|
| 80 |
+
inputs = processor(text=text, images=[image], return_tensors="pt")
|
| 81 |
|
| 82 |
+
output = model.generate(**inputs, max_new_tokens=200, temperature=0.7)
|
| 83 |
+
description = processor.tokenizer.decode(output[0], skip_special_tokens=True)
|
| 84 |
+
```
|
| 85 |
|
| 86 |
+
### Out-of-Scope Use
|
|
|
|
|
|
|
|
|
|
|
|
|
| 87 |
|
| 88 |
+
- General conversation or chat applications
|
| 89 |
+
- Complex reasoning tasks
|
| 90 |
+
- Non-commercial product descriptions
|
| 91 |
+
- Content outside e-commerce domain
|
| 92 |
|
| 93 |
## Training Details
|
| 94 |
|
| 95 |
### Training Data
|
| 96 |
|
| 97 |
+
The model was fine-tuned on the [philschmid/amazon-product-descriptions-vlm](https://huggingface.co/datasets/philschmid/amazon-product-descriptions-vlm) dataset, which contains Amazon product images with corresponding names, categories, and descriptions.
|
|
|
|
|
|
|
| 98 |
|
| 99 |
### Training Procedure
|
| 100 |
|
| 101 |
+
#### Fine-tuning Method
|
| 102 |
+
- **Technique:** LoRA (Low-Rank Adaptation) with PEFT
|
| 103 |
+
- **Target modules:** q_proj, v_proj
|
| 104 |
+
- **LoRA rank (r):** 8
|
| 105 |
+
- **LoRA alpha:** 16
|
| 106 |
+
- **LoRA dropout:** 0.05
|
| 107 |
|
| 108 |
#### Training Hyperparameters
|
| 109 |
|
| 110 |
+
- **Training regime:** bf16 mixed precision with 4-bit quantization (QLoRA)
|
| 111 |
+
- **Number of epochs:** 1
|
| 112 |
+
- **Batch size:** 8 per device
|
| 113 |
+
- **Gradient accumulation steps:** 4
|
| 114 |
+
- **Learning rate:** 2e-4
|
| 115 |
+
- **Optimizer:** AdamW (torch fused)
|
| 116 |
+
- **LR scheduler:** Constant
|
| 117 |
+
- **Warmup ratio:** 0.03
|
| 118 |
+
- **Max gradient norm:** 0.3
|
| 119 |
+
- **Quantization:** 4-bit with double quantization (nf4)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 120 |
|
| 121 |
+
#### Hardware & Software
|
| 122 |
|
| 123 |
+
- **Quantization:** BitsAndBytesConfig with 4-bit precision
|
| 124 |
+
- **Gradient checkpointing:** Enabled
|
| 125 |
+
- **Memory optimization:** QLoRA technique
|
| 126 |
+
- **Framework:** Transformers, TRL, PEFT
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 127 |
|
| 128 |
+
## Bias, Risks, and Limitations
|
| 129 |
|
| 130 |
+
### Limitations
|
| 131 |
|
| 132 |
+
- Trained specifically on Amazon product data, may not generalize well to other e-commerce platforms
|
| 133 |
+
- Limited to English language descriptions
|
| 134 |
+
- Optimized for mobile/SEO format, may not suit all description styles
|
| 135 |
+
- Performance depends on image quality and product visibility
|
| 136 |
|
| 137 |
+
### Recommendations
|
| 138 |
|
| 139 |
+
- Test thoroughly on your specific product categories before production use
|
| 140 |
+
- Consider additional fine-tuning for domain-specific products
|
| 141 |
+
- Implement content moderation for generated descriptions
|
| 142 |
+
- Validate SEO effectiveness for your target keywords
|
| 143 |
|
| 144 |
## Environmental Impact
|
| 145 |
|
| 146 |
+
Training utilized quantized models (4-bit) to reduce computational requirements and carbon footprint compared to full-precision training.
|
|
|
|
|
|
|
| 147 |
|
| 148 |
+
## Technical Specifications
|
|
|
|
|
|
|
|
|
|
|
|
|
| 149 |
|
| 150 |
+
### Model Architecture
|
| 151 |
|
| 152 |
+
- **Base Architecture:** Llama 3.2 Vision (11B parameters)
|
| 153 |
+
- **Vision Encoder:** Integrated multimodal architecture
|
| 154 |
+
- **Fine-tuning:** LoRA adapters (trainable parameters: ~16M)
|
| 155 |
+
- **Quantization:** 4-bit with double quantization
|
| 156 |
|
| 157 |
### Compute Infrastructure
|
| 158 |
|
| 159 |
+
- **Training:** Optimized with gradient checkpointing and mixed precision
|
| 160 |
+
- **Memory:** Reduced via 4-bit quantization and LoRA
|
| 161 |
+
- **Inference:** Supports both quantized and full precision modes
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 162 |
|
| 163 |
+
## Citation
|
| 164 |
|
| 165 |
+
```bibtex
|
| 166 |
+
@misc{finetuned-llama32-vision-product,
|
| 167 |
+
title={Fine-tuned Llama 3.2 Vision for Product Description Generation},
|
| 168 |
+
author={Aayush672},
|
| 169 |
+
year={2025},
|
| 170 |
+
howpublished={\url{https://huggingface.co/Aayush672/Finetuned-llama3.2-Vision-Model}}
|
| 171 |
+
}
|
| 172 |
+
```
|
| 173 |
|
| 174 |
## Model Card Contact
|
| 175 |
|
| 176 |
+
For questions or issues, please open an issue in the model repository or contact the model author.
|