Instructions to use genloop/llama-3.2-11b-instruct-amazon-product-description-merged-model with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use genloop/llama-3.2-11b-instruct-amazon-product-description-merged-model with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="genloop/llama-3.2-11b-instruct-amazon-product-description-merged-model") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# Load model directly from transformers import AutoProcessor, AutoModelForImageTextToText processor = AutoProcessor.from_pretrained("genloop/llama-3.2-11b-instruct-amazon-product-description-merged-model") model = AutoModelForImageTextToText.from_pretrained("genloop/llama-3.2-11b-instruct-amazon-product-description-merged-model") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] inputs = processor.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use genloop/llama-3.2-11b-instruct-amazon-product-description-merged-model with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "genloop/llama-3.2-11b-instruct-amazon-product-description-merged-model" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "genloop/llama-3.2-11b-instruct-amazon-product-description-merged-model", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker
docker model run hf.co/genloop/llama-3.2-11b-instruct-amazon-product-description-merged-model
- SGLang
How to use genloop/llama-3.2-11b-instruct-amazon-product-description-merged-model with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "genloop/llama-3.2-11b-instruct-amazon-product-description-merged-model" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "genloop/llama-3.2-11b-instruct-amazon-product-description-merged-model", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "genloop/llama-3.2-11b-instruct-amazon-product-description-merged-model" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "genloop/llama-3.2-11b-instruct-amazon-product-description-merged-model", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }' - Docker Model Runner
How to use genloop/llama-3.2-11b-instruct-amazon-product-description-merged-model with Docker Model Runner:
docker model run hf.co/genloop/llama-3.2-11b-instruct-amazon-product-description-merged-model
Model Card
- Developed by: Genloop.ai
- Funded by: Genloop Labs, Inc.
- Model type: Vision Language Model (VLM)
- Finetuned from model: Meta Llama 3.2 11B Vision Instruct
- Usage: This model is intended for product cataloging, i.e. generating product descriptions from images
How to Get Started with the Model
Make sure to update your transformers installation via pip install --upgrade transformers.
import requests
import torch
from PIL import Image
from transformers import MllamaForConditionalGeneration, AutoProcessor
model_id = "meta-llama/Llama-3.2-11B-Vision-Instruct"
model = MllamaForConditionalGeneration.from_pretrained(
model_id,
torch_dtype=torch.bfloat16,
device_map="auto",
)
processor = AutoProcessor.from_pretrained(model_id)
url = "insert_your_image_link_here"
image = Image.open(requests.get(url, stream=True).raw)
user_prompt= """Create a SHORT Product description based on the provided a given ##PRODUCT NAME## and a ##CATEGORY## and an image of the product.
Only return description. The description should be SEO optimized and for a better mobile search experience.
##PRODUCT NAME##: {product_name}
##CATEGORY##: {prod_category}"""
product_name = "insert_your_product_name_here"
product_category = "insert_your_product_category_here"
messages = [
{"role": "user", "content": [
{"type": "image"},
{"type": "text", "text": user_prompt.format(product_name = product_name, product_category = product_category)}
]}
]
input_text = processor.apply_chat_template(messages, add_generation_prompt=True)
inputs = processor(
image,
input_text,
add_special_tokens=False,
return_tensors="pt"
).to(model.device)
output = model.generate(**inputs, max_new_tokens=30)
print(processor.decode(output[0]))
Training Details
This model has been finetuned on the Amazon-Product-Descriptions dataset. The reference descriptions were generated using Gemini Flash.
Training hyperparameters
The following hyperparameters were used during training:
- learning_rate: 0.0002
- train_batch_size: 2
- seed: 3407
- gradient_accumulation_steps: 4
- gradient_checkpointing: True
- total_train_batch_size: 8
- lr_scheduler_type: linear
- num_epochs: 3
Results
| MODEL | FINETUNED OR NOT | INFERENCE LATENCY | METEOR Score |
|---|---|---|---|
| Llama-3.2-11B-Vision-Instruct | Not Finetuned | 1.68 | 0.38 |
| Llama-3.2-11B-Vision-Instruct | Finetuned | 1.68 | 0.53 |
- Downloads last month
- 2
Model tree for genloop/llama-3.2-11b-instruct-amazon-product-description-merged-model
Base model
meta-llama/Llama-3.2-11B-Vision-Instruct