|
94 | 94 | _openvino_tokenizers_available = False
|
95 | 95 |
|
96 | 96 | if _openvino_tokenizers_available and _openvino_tokenizers_version != "N/A":
|
97 |
| - _compatible_openvino_version = next( |
98 |
| - ( |
99 |
| - requirement.split("==")[-1] |
100 |
| - for requirement in importlib_metadata.requires("openvino-tokenizers") |
101 |
| - if requirement.startswith("openvino==") |
102 |
| - ), |
103 |
| - "", |
104 |
| - ) |
105 |
| - _openvino_tokenizers_available = _compatible_openvino_version == ov_major_version |
| 97 | + _is_ovt_dev_version = "dev" in _openvino_tokenizers_version |
| 98 | + _ov_version = importlib_metadata.version("openvino") |
| 99 | + _is_ov_dev_version = "dev" in _ov_version |
| 100 | + if _is_ovt_dev_version: |
| 101 | + _compatible_openvino_major_version, _, _dev_date = _openvino_tokenizers_version.rsplit(".", 2) |
| 102 | + _compatible_ov_version = _compatible_openvino_major_version + "." + _dev_date |
| 103 | + _compatible_ovt_version = _ov_version.replace("dev", "0.dev") |
| 104 | + else: |
| 105 | + _compatible_ov_version = _openvino_tokenizers_version.rsplit(".", 1)[0] |
| 106 | + _compatible_ovt_version = _ov_version + ".0" |
| 107 | + |
| 108 | + _openvino_tokenizers_available = _ov_version == _compatible_ov_version |
| 109 | + |
106 | 110 | if not _openvino_tokenizers_available:
|
| 111 | + _update_ov_command = ( |
| 112 | + f"pip install {'--pre' if _is_ovt_dev_version else ''} -U openvino=={_compatible_ov_version} " |
| 113 | + + ( |
| 114 | + "--extra-index-url https://storage.openvinotoolkit.org/simple/wheels/nightly" |
| 115 | + if _is_ovt_dev_version |
| 116 | + else "" |
| 117 | + ) |
| 118 | + ).strip() |
| 119 | + _update_ovt_command = ( |
| 120 | + f"pip install {'--pre' if _is_ov_dev_version else ''} -U openvino-tokenizers=={_compatible_ovt_version} " |
| 121 | + + ( |
| 122 | + "--extra-index-url https://storage.openvinotoolkit.org/simple/wheels/nightly" |
| 123 | + if _is_ov_dev_version |
| 124 | + else "" |
| 125 | + ) |
| 126 | + ).strip() |
107 | 127 | logger.warning(
|
108 | 128 | "OpenVINO Tokenizer version is not compatible with OpenVINO version. "
|
109 |
| - f"Installed OpenVINO version: {ov_major_version}," |
110 |
| - f"OpenVINO Tokenizers requires {_compatible_openvino_version}. " |
111 |
| - f"OpenVINO Tokenizers models will not be added during export." |
| 129 | + f"Installed OpenVINO version: {_ov_version}, " |
| 130 | + f"OpenVINO Tokenizers requires {_compatible_ov_version}. " |
| 131 | + "OpenVINO Tokenizers models will not be added during export. " |
| 132 | + f"Update OpenVINO with \n{_update_ov_command}\n" |
| 133 | + f"Or update OpenVINO Tokenizers with \n{_update_ovt_command}" |
112 | 134 | )
|
113 | 135 |
|
114 | 136 | _nncf_available = importlib.util.find_spec("nncf") is not None
|
|
0 commit comments