MCPcopy Create free account
hub / github.com/ModelTC/LightX2V / check_ai_device

Function check_ai_device

lightx2v_platform/base/base.py:21–35  ·  view source on GitHub ↗
(platform="cuda")

Source from the content-addressed store, hash-verified

19
20
21def check_ai_device(platform="cuda"):
22 platform_device = PLATFORM_DEVICE_REGISTER.get(platform, None)
23 if platform_device is None:
24 available_platforms = list(PLATFORM_DEVICE_REGISTER.keys())
25 raise RuntimeError(f"Unsupported PLATFORM: {platform}. Available PLATFORM: {available_platforms}")
26 is_available = platform_device.is_available()
27 if not is_available:
28 skip_platform_check = os.getenv("SKIP_PLATFORM_CHECK", "False") in ["1", "True"]
29 error_msg = f"AI device for platform '{platform}' is not available. Please check your runtime environment."
30 if skip_platform_check:
31 logger.warning(error_msg)
32 return True
33 raise RuntimeError(error_msg)
34 logger.info(f"AI device for platform '{platform}' is available.")
35 return True

Callers 1

set_ai_deviceFunction · 0.85

Calls 5

warningMethod · 0.80
infoMethod · 0.80
getMethod · 0.45
keysMethod · 0.45
is_availableMethod · 0.45

Tested by

no test coverage detected