Update documentation for Cohere2Vision models (#39817)
* Update docs with pipeline example * Add Cohere2Vision to list of vision models * Sort models
This commit is contained in:
@@ -19,9 +19,12 @@ Command A Vision is built upon a robust architecture that leverages the latest a
|
|||||||
|
|
||||||
The model and image processor can be loaded as follows:
|
The model and image processor can be loaded as follows:
|
||||||
|
|
||||||
```python
|
<hfoptions id="usage">
|
||||||
|
<hfoption id="AutoModel">
|
||||||
|
|
||||||
|
```python
|
||||||
import torch
|
import torch
|
||||||
|
|
||||||
from transformers import AutoProcessor, AutoModelForImageTextToText
|
from transformers import AutoProcessor, AutoModelForImageTextToText
|
||||||
|
|
||||||
model_id = "CohereLabs/command-a-vision-07-2025"
|
model_id = "CohereLabs/command-a-vision-07-2025"
|
||||||
@@ -68,6 +71,34 @@ print(
|
|||||||
)
|
)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
</hfoption>
|
||||||
|
<hfoption id="Pipeline">
|
||||||
|
|
||||||
|
```python
|
||||||
|
from transformers import pipeline
|
||||||
|
|
||||||
|
pipe = pipeline(model="CohereLabs/command-a-vision-07-2025", task="image-text-to-text", device_map="auto")
|
||||||
|
|
||||||
|
messages = [
|
||||||
|
{
|
||||||
|
"role": "user",
|
||||||
|
"content": [
|
||||||
|
{
|
||||||
|
"type": "image",
|
||||||
|
"url": "https://media.istockphoto.com/id/458012057/photo/istanbul-turkey.jpg?s=612x612&w=0&k=20&c=qogAOVvkpfUyqLUMr_XJQyq-HkACXyYUSZbKhBlPrxo=",
|
||||||
|
},
|
||||||
|
{"type": "text", "text": "Where was this taken ?"},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
outputs = pipe(text=messages, max_new_tokens=300, return_full_text=False)
|
||||||
|
|
||||||
|
print(outputs)
|
||||||
|
```
|
||||||
|
</hfoption>
|
||||||
|
</hfoptions>
|
||||||
|
|
||||||
## Cohere2VisionConfig
|
## Cohere2VisionConfig
|
||||||
|
|
||||||
[[autodoc]] Cohere2VisionConfig
|
[[autodoc]] Cohere2VisionConfig
|
||||||
|
|||||||
@@ -712,6 +712,7 @@ MODEL_FOR_IMAGE_MAPPING_NAMES = OrderedDict(
|
|||||||
("aimv2_vision_model", "Aimv2VisionModel"),
|
("aimv2_vision_model", "Aimv2VisionModel"),
|
||||||
("beit", "BeitModel"),
|
("beit", "BeitModel"),
|
||||||
("bit", "BitModel"),
|
("bit", "BitModel"),
|
||||||
|
("cohere2_vision", "Cohere2VisionModel"),
|
||||||
("conditional_detr", "ConditionalDetrModel"),
|
("conditional_detr", "ConditionalDetrModel"),
|
||||||
("convnext", "ConvNextModel"),
|
("convnext", "ConvNextModel"),
|
||||||
("convnextv2", "ConvNextV2Model"),
|
("convnextv2", "ConvNextV2Model"),
|
||||||
|
|||||||
Reference in New Issue
Block a user