Instructions to use OpenGVLab/InternViT-300M-448px with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use OpenGVLab/InternViT-300M-448px with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-feature-extraction", model="OpenGVLab/InternViT-300M-448px", trust_remote_code=True)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("OpenGVLab/InternViT-300M-448px", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
Update README.md
Browse files
README.md
CHANGED
|
@@ -10,7 +10,7 @@ datasets:
|
|
| 10 |
pipeline_tag: image-feature-extraction
|
| 11 |
---
|
| 12 |
|
| 13 |
-
# Model Card for InternViT-
|
| 14 |
<p align="center">
|
| 15 |
<img src="https://cdn-uploads.huggingface.co/production/uploads/64119264f0f81eb569e0d569/AUE-3OBtfr9vDA7Elgkhd.webp" alt="Image Description" width="300" height="300">
|
| 16 |
</p>
|
|
@@ -24,11 +24,10 @@ Additionally, we enhance the data scale, quality, and diversity of the pre-train
|
|
| 24 |
## Model Details
|
| 25 |
- **Model Type:** vision foundation model, feature backbone
|
| 26 |
- **Model Stats:**
|
| 27 |
-
- Params (M):
|
| 28 |
- Image size: 448 x 448, training with 1 - 12 tiles
|
| 29 |
- **Pretrain Dataset:** LAION-en, LAION-zh, COYO, GRIT, COCO, TextCaps, Objects365, OpenImages, All-Seeing, Wukong-OCR, LaionCOCO-OCR, and other OCR-related datasets.
|
| 30 |
To enhance the OCR capability of the model, we have incorporated additional OCR data alongside the general caption datasets. Specifically, we utilized PaddleOCR to perform Chinese OCR on images from Wukong and English OCR on images from LAION-COCO.
|
| 31 |
-
- **Note:** InternViT-6B originally had 48 blocks, and we found that using the output after the fourth-to-last block worked best for MLLM. For ease of use and to save GPU memory, we simply discarded the last 3 blocks. Now, the model has only 45 blocks and the number of parameters has been reduced from 5.9B to 5.5B. Therefore, if you want to build a MLLM based on this model, **please make use of the features from the last layer.**
|
| 32 |
|
| 33 |
## Released Models
|
| 34 |
### Vision Foundation model
|
|
@@ -56,14 +55,14 @@ from PIL import Image
|
|
| 56 |
from transformers import AutoModel, CLIPImageProcessor
|
| 57 |
|
| 58 |
model = AutoModel.from_pretrained(
|
| 59 |
-
'OpenGVLab/InternViT-
|
| 60 |
torch_dtype=torch.bfloat16,
|
| 61 |
low_cpu_mem_usage=True,
|
| 62 |
trust_remote_code=True).cuda().eval()
|
| 63 |
|
| 64 |
image = Image.open('./examples/image1.jpg').convert('RGB')
|
| 65 |
|
| 66 |
-
image_processor = CLIPImageProcessor.from_pretrained('OpenGVLab/InternViT-
|
| 67 |
|
| 68 |
pixel_values = image_processor(images=image, return_tensors='pt').pixel_values
|
| 69 |
pixel_values = pixel_values.to(torch.bfloat16).cuda()
|
|
|
|
| 10 |
pipeline_tag: image-feature-extraction
|
| 11 |
---
|
| 12 |
|
| 13 |
+
# Model Card for InternViT-300M-448px
|
| 14 |
<p align="center">
|
| 15 |
<img src="https://cdn-uploads.huggingface.co/production/uploads/64119264f0f81eb569e0d569/AUE-3OBtfr9vDA7Elgkhd.webp" alt="Image Description" width="300" height="300">
|
| 16 |
</p>
|
|
|
|
| 24 |
## Model Details
|
| 25 |
- **Model Type:** vision foundation model, feature backbone
|
| 26 |
- **Model Stats:**
|
| 27 |
+
- Params (M): 304
|
| 28 |
- Image size: 448 x 448, training with 1 - 12 tiles
|
| 29 |
- **Pretrain Dataset:** LAION-en, LAION-zh, COYO, GRIT, COCO, TextCaps, Objects365, OpenImages, All-Seeing, Wukong-OCR, LaionCOCO-OCR, and other OCR-related datasets.
|
| 30 |
To enhance the OCR capability of the model, we have incorporated additional OCR data alongside the general caption datasets. Specifically, we utilized PaddleOCR to perform Chinese OCR on images from Wukong and English OCR on images from LAION-COCO.
|
|
|
|
| 31 |
|
| 32 |
## Released Models
|
| 33 |
### Vision Foundation model
|
|
|
|
| 55 |
from transformers import AutoModel, CLIPImageProcessor
|
| 56 |
|
| 57 |
model = AutoModel.from_pretrained(
|
| 58 |
+
'OpenGVLab/InternViT-300M-448px',
|
| 59 |
torch_dtype=torch.bfloat16,
|
| 60 |
low_cpu_mem_usage=True,
|
| 61 |
trust_remote_code=True).cuda().eval()
|
| 62 |
|
| 63 |
image = Image.open('./examples/image1.jpg').convert('RGB')
|
| 64 |
|
| 65 |
+
image_processor = CLIPImageProcessor.from_pretrained('OpenGVLab/InternViT-300M-448px')
|
| 66 |
|
| 67 |
pixel_values = image_processor(images=image, return_tensors='pt').pixel_values
|
| 68 |
pixel_values = pixel_values.to(torch.bfloat16).cuda()
|