Image-Text-to-Text
Transformers
Safetensors
Chinese
taivisionlm
text-generation
conversational
custom_code
Instructions to use benchang1110/TaiVisionLM-base-v2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use benchang1110/TaiVisionLM-base-v2 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="benchang1110/TaiVisionLM-base-v2", trust_remote_code=True) 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)# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("benchang1110/TaiVisionLM-base-v2", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use benchang1110/TaiVisionLM-base-v2 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "benchang1110/TaiVisionLM-base-v2" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "benchang1110/TaiVisionLM-base-v2", "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/benchang1110/TaiVisionLM-base-v2
- SGLang
How to use benchang1110/TaiVisionLM-base-v2 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 "benchang1110/TaiVisionLM-base-v2" \ --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": "benchang1110/TaiVisionLM-base-v2", "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 "benchang1110/TaiVisionLM-base-v2" \ --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": "benchang1110/TaiVisionLM-base-v2", "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 benchang1110/TaiVisionLM-base-v2 with Docker Model Runner:
docker model run hf.co/benchang1110/TaiVisionLM-base-v2
Update README.md
Browse files
README.md
CHANGED
|
@@ -135,9 +135,10 @@ print(outputs)
|
|
| 135 |
* TaiVisionLM-base-v1:
|
| 136 |
卡通插圖描繪掛在家門口的標誌,上下方以卡通插圖的方式呈現。
|
| 137 |
* TaiVisionLM-base-v2:
|
| 138 |
-
這張圖
|
| 139 |
-
|
| 140 |
-
圖片
|
|
|
|
| 141 |
|
| 142 |
|
| 143 |
- **Example 2**
|
|
@@ -145,10 +146,9 @@ print(outputs)
|
|
| 145 |
* TaiVisionLM-base-v1:
|
| 146 |
這是一幅攝影作品,展示了巴黎的鐵塔被水景所環繞
|
| 147 |
* TaiVisionLM-base-v2:
|
| 148 |
-
這
|
| 149 |
-
|
| 150 |
-
|
| 151 |
-
這張照片是巴黎豐富歷史和現代性的一個見證。塔樓和人行道標誌著這座經典都市的地標,高聳主權人偶的高度及其證據這座城市獨特的信仰。橫跨整張照片的人行道禮貌地介紹了城市的繁忙路線。
|
| 152 |
### Training Procedure
|
| 153 |
|
| 154 |
Since we don't have enough resources to train the model on the whole dataset, we only use 250k image-text pairs for training. The following training hyperparameters are used in feature alignment and task specific training stages respectively:
|
|
@@ -158,7 +158,7 @@ Since we don't have enough resources to train the model on the whole dataset, we
|
|
| 158 |
|
| 159 |
| Data size | Global Batch Size | Learning Rate | Epochs | Max Length | Weight Decay |
|
| 160 |
|--------------|-------------------|---------------|--------|------------|--------------|
|
| 161 |
-
|
|
| 162 |
|
| 163 |
We use full-parameter finetuning for the projector and apply LoRA to the language model.
|
| 164 |
|
|
@@ -166,4 +166,4 @@ We will update the training procedure once we have more resources to train the m
|
|
| 166 |

|
| 167 |
### Compute Infrastructure
|
| 168 |
- **Feature Alignment**
|
| 169 |
-
1xV100(32GB), took approximately
|
|
|
|
| 135 |
* TaiVisionLM-base-v1:
|
| 136 |
卡通插圖描繪掛在家門口的標誌,上下方以卡通插圖的方式呈現。
|
| 137 |
* TaiVisionLM-base-v2:
|
| 138 |
+
這張圖片呈現了發人深省的對比。圖片中央,白色文字中的「Smile」以粗體黑色字母書寫。文字略微有些傾斜,為原本靜止的圖片增添了動感。背景是一個鮮明的白色,突顯文字並確立其在圖片中的重要性。
|
| 139 |
+
背景並非僅僅是白色的;它與黑色文字形成鮮明對比,創造出引人注目的視覺效果。文字、背景和形狀和諧合作,每個元素都互相襯托,形成和諧的構圖。
|
| 140 |
+
圖片底部右角有微妙的脊狀邊緣。脊狀的輪廓為圖片增添了一種深度,吸引觀眾的注意力,探索圖片的整體背景。脊狀邊緣與圖片整體的設計相輔相成,增強了節奏和能量氛圍。
|
| 141 |
+
整體而言,這張圖片是一個色彩和形狀的和諧結合,每個元素都經過精心放置,創造出視覺上令人愉悅的構圖。使用黑色、粗體字和微妙的脊狀邊緣增添了神秘感,將其印象擴展到更深層,既引人入勝又引人思考。
|
| 142 |
|
| 143 |
|
| 144 |
- **Example 2**
|
|
|
|
| 146 |
* TaiVisionLM-base-v1:
|
| 147 |
這是一幅攝影作品,展示了巴黎的鐵塔被水景所環繞
|
| 148 |
* TaiVisionLM-base-v2:
|
| 149 |
+
這幅圖片捕捉到法國著名地標艾菲爾鐵塔的令人驚嘆的景觀。天空呈現明亮的藍色,與周圍的綠意交織,形成令人驚嘆的構圖。這座高聳的拱門塗上淺棕色的艾菲爾鐵塔,自豪地矗立在畫面右側。它旁邊是河流,它的平靜水域反射著上方的藍天。
|
| 150 |
+
在遠處,其他著名地標的蹤影可見,包括一座標誌性的橋樑和一座城堡般的摩天大樓,為場景增添深度和尺度。前景中的樹木增添了一抹綠意,為鐵塔的淺褐色和藍天的色彩提供了清新的對比。
|
| 151 |
+
這張圖片是從水面上觀看艾菲爾鐵塔的角度拍攝的,提供了對整個景觀的鳥瞰視角。這個視角可以全面地觀察到艾菲爾鐵塔及其周圍環境,展現了它的壯麗以及位於其中的生命。這張圖片中沒有任何虛構的內容,所有描述都是基於圖片中可見的元素。</s>
|
|
|
|
| 152 |
### Training Procedure
|
| 153 |
|
| 154 |
Since we don't have enough resources to train the model on the whole dataset, we only use 250k image-text pairs for training. The following training hyperparameters are used in feature alignment and task specific training stages respectively:
|
|
|
|
| 158 |
|
| 159 |
| Data size | Global Batch Size | Learning Rate | Epochs | Max Length | Weight Decay |
|
| 160 |
|--------------|-------------------|---------------|--------|------------|--------------|
|
| 161 |
+
| 1.35M | 4 | 5e-3 | 1 | 1024 | 0 |
|
| 162 |
|
| 163 |
We use full-parameter finetuning for the projector and apply LoRA to the language model.
|
| 164 |
|
|
|
|
| 166 |

|
| 167 |
### Compute Infrastructure
|
| 168 |
- **Feature Alignment**
|
| 169 |
+
1xV100(32GB), took approximately 45 GPU hours.
|