Skip to content

Commit d2b21bf

Browse files
[OpenVINO] support CohereLabs/tiny-aya-base (#1623)
* [OpenVINO] support cohere/tiny-aya-base * add docs * add tests * add tests * fix tests * fix tests * fix tests * Update Cohere2 minimum transformers version to 4.48.0
1 parent 678f997 commit d2b21bf

File tree

8 files changed

+37
-0
lines changed

8 files changed

+37
-0
lines changed

docs/source/openvino/models.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ Here is the list of the supported architectures :
3737
- CodeGen
3838
- CodeGen2
3939
- Cohere
40+
- Cohere2
4041
- ConvBert
4142
- ConvNext
4243
- DBRX

optimum/exporters/openvino/model_configs.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -888,6 +888,21 @@ class ArceeOpenVINOConfig(LlamaOpenVINOConfig):
888888
MIN_TRANSFORMERS_VERSION = "4.53.0"
889889

890890

891+
@register_in_tasks_manager(
892+
"cohere2",
893+
*[
894+
"feature-extraction",
895+
"feature-extraction-with-past",
896+
"text-generation",
897+
"text-generation-with-past",
898+
"text-classification",
899+
],
900+
library_name="transformers",
901+
)
902+
class Cohere2OpenVINOConfig(LlamaOpenVINOConfig):
903+
MIN_TRANSFORMERS_VERSION = "4.48.0"
904+
905+
891906
class QwenDummyPastKeyValuesGenerator(DummyPastKeyValuesGenerator):
892907
def __init__(
893908
self,

tests/openvino/test_decoder.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,9 @@ class OVModelForCausalLMIntegrationTest(unittest.TestCase):
110110

111111
SUPPORTED_ARCHITECTURES += SUPPORTED_SSM_ARCHITECTURES
112112

113+
if is_transformers_version(">=", "4.48.0"):
114+
SUPPORTED_ARCHITECTURES += ("cohere2",)
115+
113116
if is_transformers_version(">=", "4.46.0"):
114117
SUPPORTED_ARCHITECTURES += ("glm", "mistral-nemo", "phimoe")
115118

@@ -208,6 +211,7 @@ class OVModelForCausalLMIntegrationTest(unittest.TestCase):
208211
"starcoder2": 2,
209212
"dbrx": 2,
210213
"cohere": 2,
214+
"cohere2": 2,
211215
"qwen2": 2,
212216
"qwen2_moe": 4,
213217
"arctic": 4,

tests/openvino/test_export.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,9 @@ class ExportModelTest(unittest.TestCase):
9595
"ltx-video": OVLTXPipeline,
9696
}
9797

98+
if is_transformers_version(">=", "4.48.0"):
99+
SUPPORTED_ARCHITECTURES.update({"cohere2": OVModelForCausalLM})
100+
98101
if is_transformers_version(">=", "4.49"):
99102
SUPPORTED_ARCHITECTURES.update({"zamba2": OVModelForCausalLM})
100103

tests/openvino/test_exporters_cli.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,13 @@ class OVCLIExportTestCase(unittest.TestCase):
116116
("zero-shot-image-classification", "clip"),
117117
]
118118

119+
if is_transformers_version(">=", "4.48.0"):
120+
SUPPORTED_ARCHITECTURES.extend(
121+
[
122+
("text-generation-with-past", "cohere2"),
123+
]
124+
)
125+
119126
if is_transformers_version(">=", "4.54.0"):
120127
SUPPORTED_ARCHITECTURES.extend(
121128
[

tests/openvino/test_genai.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,8 @@ class LLMPipelineTestCase(unittest.TestCase):
7878
"granitemoe",
7979
)
8080

81+
if is_transformers_version(">=", "4.48.0"):
82+
SUPPORTED_ARCHITECTURES += ("cohere2",)
8183
if is_transformers_version(">=", "4.46.0"):
8284
SUPPORTED_ARCHITECTURES += ("glm", "mistral-nemo", "phimoe", "opt")
8385
if is_transformers_version("<", "4.54.0"):

tests/openvino/test_quantization.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1074,6 +1074,9 @@ class OVWeightCompressionTest(unittest.TestCase):
10741074
if is_transformers_version("<", "4.52.0"):
10751075
SUPPORTED_ARCHITECTURES_WITH_AUTO_COMPRESSION.append((OVModelForVisualCausalLM, "minicpmo", True))
10761076

1077+
if is_transformers_version(">=", "4.48.0"):
1078+
SUPPORTED_ARCHITECTURES_WITH_AUTO_COMPRESSION.append((OVModelForCausalLM, "cohere2", False))
1079+
10771080
if is_transformers_version(">=", "4.54.0"):
10781081
SUPPORTED_ARCHITECTURES_WITH_AUTO_COMPRESSION.append((OVModelForCausalLM, "exaone4", True))
10791082

tests/openvino/utils_tests.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
"clip": "optimum-intel-internal-testing/tiny-random-CLIPModel",
5858
"convbert": "optimum-intel-internal-testing/tiny-random-ConvBertForSequenceClassification",
5959
"cohere": "optimum-intel-internal-testing/tiny-random-CohereForCausalLM",
60+
"cohere2": "optimum-intel-internal-testing/tiny-random-aya-base",
6061
"chatglm": "optimum-intel-internal-testing/tiny-random-chatglm",
6162
"chatglm4": "optimum-intel-internal-testing/tiny-random-chatglm4",
6263
"codegen": "optimum-intel-internal-testing/tiny-random-CodeGenForCausalLM",
@@ -237,6 +238,7 @@
237238
"albert": {"model": 84},
238239
"vit": {"model": 64},
239240
"blenderbot": {"model": 70},
241+
"cohere2": {"model": 30},
240242
"gpt2": {"model": 44},
241243
"granitemoehybrid": {"model": 118},
242244
"wav2vec2": {"model": 34},

0 commit comments

Comments
 (0)