MCPcopy Create free account
hub / github.com/easydiffusion/easydiffusion / get_device_delta

Function get_device_delta

ui/easydiffusion/device_manager.py:32–55  ·  view source on GitHub ↗

render_devices: 'auto' or backends listed in `torchruntime.utils.SUPPORTED_BACKENDS` active_devices: [backends listed in `torchruntime.utils.SUPPORTED_BACKENDS`]

(render_devices, active_devices)

Source from the content-addressed store, hash-verified

30
31
32def get_device_delta(render_devices, active_devices):
33 """
34 render_devices: 'auto' or backends listed in `torchruntime.utils.SUPPORTED_BACKENDS`
35 active_devices: [backends listed in `torchruntime.utils.SUPPORTED_BACKENDS`]
36 """
37
38 render_devices = render_devices or "auto"
39 render_devices = [render_devices] if isinstance(render_devices, str) else render_devices
40
41 # check for backend support
42 validate_render_devices(render_devices)
43
44 if "auto" in render_devices:
45 render_devices = auto_pick_devices(active_devices)
46 if "cpu" in render_devices:
47 log.warn("WARNING: Could not find a compatible GPU. Using the CPU, but this will be very slow!")
48
49 active_devices = set(active_devices)
50 render_devices = set(render_devices)
51
52 devices_to_start = render_devices - active_devices
53 devices_to_stop = active_devices - render_devices
54
55 return devices_to_start, devices_to_stop
56
57
58def validate_render_devices(render_devices):

Callers

nothing calls this directly

Calls 2

validate_render_devicesFunction · 0.85
auto_pick_devicesFunction · 0.85

Tested by

no test coverage detected