(device_fn_dict: dict[str, Callable], attribute_name: str)
| 1547 | if is_torch_available(): |
| 1548 | # Update device function dict mapping |
| 1549 | def update_mapping_from_spec(device_fn_dict: dict[str, Callable], attribute_name: str): |
| 1550 | try: |
| 1551 | # Try to import the function directly |
| 1552 | spec_fn = getattr(device_spec_module, attribute_name) |
| 1553 | device_fn_dict[torch_device] = spec_fn |
| 1554 | except AttributeError as e: |
| 1555 | # If the function doesn't exist, and there is no default, throw an error |
| 1556 | if "default" not in device_fn_dict: |
| 1557 | raise AttributeError( |
| 1558 | f"`{attribute_name}` not found in '{device_spec_path}' and no default fallback function found." |
| 1559 | ) from e |
| 1560 | |
| 1561 | if "DIFFUSERS_TEST_DEVICE_SPEC" in os.environ: |
| 1562 | device_spec_path = os.environ["DIFFUSERS_TEST_DEVICE_SPEC"] |
no outgoing calls
no test coverage detected
searching dependent graphs…