Image-Text-to-Text
Transformers
TensorBoard
Safetensors
qwen2_5_vl
Generated from Trainer
hf_jobs
sft
trl
vision-language
iconclass
cultural-heritage
art-classification
conversational
text-generation-inference
Instructions to use small-models-for-glam/iconclass-vlm with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use small-models-for-glam/iconclass-vlm with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="small-models-for-glam/iconclass-vlm") 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, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("small-models-for-glam/iconclass-vlm") model = AutoModelForMultimodalLM.from_pretrained("small-models-for-glam/iconclass-vlm", device_map="auto") 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 Settings
- vLLM
How to use small-models-for-glam/iconclass-vlm with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "small-models-for-glam/iconclass-vlm" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "small-models-for-glam/iconclass-vlm", "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/small-models-for-glam/iconclass-vlm
- SGLang
How to use small-models-for-glam/iconclass-vlm 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 "small-models-for-glam/iconclass-vlm" \ --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": "small-models-for-glam/iconclass-vlm", "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 "small-models-for-glam/iconclass-vlm" \ --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": "small-models-for-glam/iconclass-vlm", "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 small-models-for-glam/iconclass-vlm with Docker Model Runner:
docker model run hf.co/small-models-for-glam/iconclass-vlm
Update README.md
#1
by davanstrien HF Staff - opened
README.md
CHANGED
|
@@ -24,6 +24,8 @@ This model is a fine-tuned version of [Qwen/Qwen2.5-VL-3B-Instruct](https://hugg
|
|
| 24 |
|
| 25 |
You can explore the predictions of this model using this [Space](https://huggingface.co/spaces/davanstrien/iconclass-predictions).
|
| 26 |
|
|
|
|
|
|
|
| 27 |
## Model Description
|
| 28 |
|
| 29 |
This vision-language model has been fine-tuned to generate [Iconclass](https://iconclass.org/) classification codes from images. Iconclass is a comprehensive classification system for describing the content of images, particularly used in cultural heritage and art history contexts.
|
|
@@ -99,11 +101,10 @@ print(response)
|
|
| 99 |
### Training Dataset
|
| 100 |
The model was trained on a reformatted version of the Brill Iconclass AI Test Set [biglam/brill_iconclass](https://huggingface.co/datasets/biglam/brill_iconclass).
|
| 101 |
|
|
|
|
| 102 |
|
| 103 |
|
| 104 |
-
|
| 105 |
-
Training Procedure
|
| 106 |
-
<img src="https://raw.githubusercontent.com/wandb/assets/main/wandb-github-badge-28.svg" alt="Visualize in Weights & Biases" width="150" height="24"/>
|
| 107 |
|
| 108 |
This model was trained with SFT (Supervised Fine-Tuning).
|
| 109 |
|
|
@@ -118,13 +119,13 @@ Tokenizers: 0.21.4
|
|
| 118 |
|
| 119 |
### Limitations and Biases
|
| 120 |
|
| 121 |
-
The Iconclass classification system reflects biases from its creation period (1940s Netherlands)
|
| 122 |
-
Certain categories, particularly those related to human classification, may contain outdated or problematic terminology
|
| 123 |
-
Model performance may vary on images outside the Western art tradition due to dataset composition
|
| 124 |
|
| 125 |
### Citations
|
| 126 |
|
| 127 |
-
|
| 128 |
|
| 129 |
```bibtex
|
| 130 |
@misc{vonwerra2022trl,
|
|
|
|
| 24 |
|
| 25 |
You can explore the predictions of this model using this [Space](https://huggingface.co/spaces/davanstrien/iconclass-predictions).
|
| 26 |
|
| 27 |
+
**Note:** this model is a work in progress with the goal to see how far small models can be created to excel at this kind of specific but challenging task. As a result the base model used may change over time.
|
| 28 |
+
|
| 29 |
## Model Description
|
| 30 |
|
| 31 |
This vision-language model has been fine-tuned to generate [Iconclass](https://iconclass.org/) classification codes from images. Iconclass is a comprehensive classification system for describing the content of images, particularly used in cultural heritage and art history contexts.
|
|
|
|
| 101 |
### Training Dataset
|
| 102 |
The model was trained on a reformatted version of the Brill Iconclass AI Test Set [biglam/brill_iconclass](https://huggingface.co/datasets/biglam/brill_iconclass).
|
| 103 |
|
| 104 |
+
The dataset was reformatted into a message format suitable for SFT training.
|
| 105 |
|
| 106 |
|
| 107 |
+
### Training Procedure
|
|
|
|
|
|
|
| 108 |
|
| 109 |
This model was trained with SFT (Supervised Fine-Tuning).
|
| 110 |
|
|
|
|
| 119 |
|
| 120 |
### Limitations and Biases
|
| 121 |
|
| 122 |
+
The Iconclass classification system reflects biases from its creation period (1940s Netherlands).
|
| 123 |
+
Certain categories, particularly those related to human classification, may contain outdated or problematic terminology.
|
| 124 |
+
Model performance may vary on images outside the Western art tradition due to the dataset composition.
|
| 125 |
|
| 126 |
### Citations
|
| 127 |
|
| 128 |
+
Training framework
|
| 129 |
|
| 130 |
```bibtex
|
| 131 |
@misc{vonwerra2022trl,
|