(min_version)
| 295 | |
| 296 | |
| 297 | def check_min_version(min_version): |
| 298 | if version.parse(__version__) < version.parse(min_version): |
| 299 | if "dev" in min_version: |
| 300 | error_message = ( |
| 301 | "This example requires a source install from HuggingFace Transformers (see " |
| 302 | "`https://huggingface.co/docs/transformers/installation#install-from-source`)," |
| 303 | ) |
| 304 | else: |
| 305 | error_message = f"This example requires a minimum version of {min_version}," |
| 306 | error_message += f" but the version found is {__version__}.\n" |
| 307 | raise ImportError( |
| 308 | error_message |
| 309 | + "Check out https://github.com/huggingface/transformers/tree/main/examples#important-note for the examples corresponding to other " |
| 310 | "versions of HuggingFace Transformers." |
| 311 | ) |
| 312 | |
| 313 | |
| 314 | @lru_cache |
no test coverage detected