Sentence Similarity
sentence-transformers
Safetensors
Transformers
English
Chinese
qwen2_vl
image-text-to-text
mteb
Qwen2-VL
vidore
custom_code
Eval Results (legacy)
Instructions to use Alibaba-NLP/gme-Qwen2-VL-2B-Instruct with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use Alibaba-NLP/gme-Qwen2-VL-2B-Instruct with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("Alibaba-NLP/gme-Qwen2-VL-2B-Instruct", trust_remote_code=True) sentences = [ "That is a happy person", "That is a happy dog", "That is a very happy person", "Today is a sunny day" ] embeddings = model.encode(sentences) similarities = model.similarity(embeddings, embeddings) print(similarities.shape) # [4, 4] - Transformers
How to use Alibaba-NLP/gme-Qwen2-VL-2B-Instruct with Transformers:
# Load model directly from transformers import AutoProcessor, AutoModelForImageTextToText processor = AutoProcessor.from_pretrained("Alibaba-NLP/gme-Qwen2-VL-2B-Instruct", trust_remote_code=True) model = AutoModelForImageTextToText.from_pretrained("Alibaba-NLP/gme-Qwen2-VL-2B-Instruct", trust_remote_code=True) - Notebooks
- Google Colab
- Kaggle
Update README.md
Browse files
README.md
CHANGED
|
@@ -3696,8 +3696,7 @@ The `GME` models support three types of input: **text**, **image**, and **image-
|
|
| 3696 |
|
| 3697 |
```python
|
| 3698 |
# You can find the script gme_inference.py in https://huggingface.co/Alibaba-NLP/gme-Qwen2-VL-2B-Instruct/blob/main/gme_inference.py
|
| 3699 |
-
from
|
| 3700 |
-
|
| 3701 |
texts = [
|
| 3702 |
"What kind of car is this?",
|
| 3703 |
"The Tesla Cybertruck is a battery electric pickup truck built by Tesla, Inc. since 2023."
|
|
@@ -3707,7 +3706,7 @@ images = [
|
|
| 3707 |
'https://en.wikipedia.org/wiki/File:2024_Tesla_Cybertruck_Foundation_Series,_front_left_(Greenwich).jpg',
|
| 3708 |
]
|
| 3709 |
|
| 3710 |
-
gme =
|
| 3711 |
|
| 3712 |
# Single-modal embedding
|
| 3713 |
e_text = gme.get_text_embeddings(texts=texts)
|
|
|
|
| 3696 |
|
| 3697 |
```python
|
| 3698 |
# You can find the script gme_inference.py in https://huggingface.co/Alibaba-NLP/gme-Qwen2-VL-2B-Instruct/blob/main/gme_inference.py
|
| 3699 |
+
from transformers import AutoModel
|
|
|
|
| 3700 |
texts = [
|
| 3701 |
"What kind of car is this?",
|
| 3702 |
"The Tesla Cybertruck is a battery electric pickup truck built by Tesla, Inc. since 2023."
|
|
|
|
| 3706 |
'https://en.wikipedia.org/wiki/File:2024_Tesla_Cybertruck_Foundation_Series,_front_left_(Greenwich).jpg',
|
| 3707 |
]
|
| 3708 |
|
| 3709 |
+
gme = AutoModel("Alibaba-NLP/gme-Qwen2-VL-2B-Instruct", trust_remote_code=True)
|
| 3710 |
|
| 3711 |
# Single-modal embedding
|
| 3712 |
e_text = gme.get_text_embeddings(texts=texts)
|