MCPcopy Create free account
hub / github.com/bitsandbytes-foundation/bitsandbytes / _import_backends

Function _import_backends

bitsandbytes/__init__.py:52–67  ·  view source on GitHub ↗

Discover and autoload all available backends installed as separate packages. Packages with an entrypoint for "bitsandbytes.backends" will be loaded. Inspired by PyTorch implementation: https://pytorch.org/tutorials/prototype/python_extension_autoload.html

()

Source from the content-addressed store, hash-verified

50
51
52def _import_backends():
53 """
54 Discover and autoload all available backends installed as separate packages.
55 Packages with an entrypoint for "bitsandbytes.backends" will be loaded.
56 Inspired by PyTorch implementation: https://pytorch.org/tutorials/prototype/python_extension_autoload.html
57 """
58 from importlib.metadata import entry_points
59
60 extensions = entry_points(group="bitsandbytes.backends")
61
62 for ext in extensions:
63 try:
64 entry = ext.load()
65 entry()
66 except Exception as e:
67 raise RuntimeError(f"bitsandbytes: failed to load backend {ext.name}: {e}") from e
68
69
70_import_backends()

Callers 1

__init__.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected