MCPcopy Index your code
hub / github.com/huggingface/diffusers / update_mapping_from_spec

Function update_mapping_from_spec

src/diffusers/utils/testing_utils.py:1387–1397  ·  view source on GitHub ↗
(device_fn_dict: dict[str, Callable], attribute_name: str)

Source from the content-addressed store, hash-verified

1385if is_torch_available():
1386 # Update device function dict mapping
1387 def update_mapping_from_spec(device_fn_dict: dict[str, Callable], attribute_name: str):
1388 try:
1389 # Try to import the function directly
1390 spec_fn = getattr(device_spec_module, attribute_name)
1391 device_fn_dict[torch_device] = spec_fn
1392 except AttributeError as e:
1393 # If the function doesn't exist, and there is no default, throw an error
1394 if "default" not in device_fn_dict:
1395 raise AttributeError(
1396 f"`{attribute_name}` not found in '{device_spec_path}' and no default fallback function found."
1397 ) from e
1398
1399 if "DIFFUSERS_TEST_DEVICE_SPEC" in os.environ:
1400 device_spec_path = os.environ["DIFFUSERS_TEST_DEVICE_SPEC"]

Callers 1

testing_utils.pyFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…