VoVoR commited on
Commit
fc08516
1 Parent(s): 0556e7f

Add: README.md

Browse files
Files changed (1) hide show
  1. README.md +78 -0
README.md CHANGED
@@ -1,3 +1,81 @@
1
  ---
 
 
 
 
2
  license: apache-2.0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ library_name: transformers
3
+ tags:
4
+ - image-captioning
5
+ - visual-question-answering
6
  license: apache-2.0
7
+ datasets:
8
+ - X2FD/LVIS-Instruct4V
9
+ - BAAI/SVIT
10
+ - HuggingFaceH4/ultrachat_200k
11
+ - MMInstruction/VLFeedback
12
+ - zhiqings/LLaVA-Human-Preference-10K
13
+ language:
14
+ - en
15
+ pipeline_tag: image-to-text
16
+ widget:
17
+ - src: interior.jpg
18
+ example_title: Detailed caption
19
+ output:
20
+ text: "The image shows a serene and well-lit bedroom with a white bed, a black bed frame, and a white comforter. There’s a gray armchair with a white cushion, a black dresser with a mirror and a vase, and a white rug on the floor. The room has a large window with white curtains, and there are several decorative items, including a picture frame, a vase with a flower, and a lamp. The room is well-organized and has a calming atmosphere."
21
+ - src: cat.jpg
22
+ example_title: Short caption
23
+ output:
24
+ text: "A white and orange cat stands on its hind legs, reaching towards a wooden table with a white teapot and a basket of red raspberries. The table is on a small wooden bench, surrounded by orange flowers. The cat’s position and action create a serene, playful scene in a garden."
25
  ---
26
+ <h1 align="center">UForm</h1>
27
+ <h3 align="center">
28
+ Pocket-Sized Multimodal AI<br/>
29
+ For Content Understanding and Generation<br/>
30
+ </h3>
31
+
32
+ ## Description
33
+
34
+ UForm-Gen2-dpo is a small generative vision-language model alined for Image Captioning and Visual Question Answering
35
+ on preference datasets VLFeedback and LLaVA-Human-Preference-10K using Direct Preference Optimization (DPO).
36
+
37
+ The model consists of two parts:
38
+ 1. CLIP-like ViT-H/14
39
+ 2. [Qwen1.5-0.5B-Chat](https://huggingface.co/Qwen/Qwen1.5-0.5B-Chat)
40
+
41
+ The model took less than one day to train on a DGX-H100 with 8x H100 GPUs.
42
+ Thanks to [Nebius.ai](https://nebius.ai) for providing the compute 🤗
43
+
44
+ ### Usage
45
+
46
+
47
+ The generative model can be used to caption images, answer questions about them. Also it is suitable for a multimodal chat.
48
+
49
+ ```python
50
+ from transformers import AutoModel, AutoProcessor
51
+ model = AutoModel.from_pretrained("unum-cloud/uform-gen2-dpo", trust_remote_code=True)
52
+ processor = AutoProcessor.from_pretrained("unum-cloud/uform-gen2-dpo", trust_remote_code=True)
53
+ prompt = "Question or Instruction"
54
+ image = Image.open("image.jpg")
55
+ inputs = processor(text=[prompt], images=[image], return_tensors="pt")
56
+ with torch.inference_mode():
57
+ output = model.generate(
58
+ **inputs,
59
+ do_sample=False,
60
+ use_cache=True,
61
+ max_new_tokens=256,
62
+ eos_token_id=151645,
63
+ pad_token_id=processor.tokenizer.pad_token_id
64
+ )
65
+ prompt_len = inputs["input_ids"].shape[1]
66
+ decoded_text = processor.batch_decode(output[:, prompt_len:])[0]
67
+ ```
68
+
69
+ You can check examples of different prompts in our demo space.
70
+
71
+ ## Evaluation
72
+
73
+ MME Benchmark
74
+ | Model | reasoning | OCR | artwork | celebrity | code_reasoning | color | commonsense_reasoning | count | existence | landmark | numerical_calculation | position | posters | scene | text_translation |
75
+ | :---------------------------------- | --------: | -----:| ----------:| ----------:| --------------:| -----:| ---------------------:| -----:| ---------:| --------:| ---------------------:| --------:| -------:| -----:| ----------------:|
76
+ | uform-gen2-dpo | 1,048.75 | 224.64 | 72.50 | 97.25 | 62.65 | 67.50 | 123.33 | 57.14 | 136.67 | 195.00 | 104.00 | 50.00 | 51.67 | 59.18 | 146.50 | 50.00 |
77
+ | uform-gen2-qwen-500m | 863.40 | 236.43 | 57.50 | 93.00 | 67.06 | 57.50 | 78.33 | 81.43 | 53.33 | 150.00 | 98.00 | 50.00 | 50.00 | 62.93 | 153.25 | 47.50 |
78
+
79
+
80
+
81
+