MCPcopy
hub / github.com/huggingface/transformers / check_min_version

Function check_min_version

src/transformers/utils/__init__.py:297–311  ·  view source on GitHub ↗
(min_version)

Source from the content-addressed store, hash-verified

295
296
297def 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

Calls 1

parseMethod · 0.45

Tested by

no test coverage detected