Skip to content

Commit

Permalink
provide temp flag for outside libs to detect multi-backend preview
Browse files Browse the repository at this point in the history
  • Loading branch information
Titus-von-Koeller committed Jun 6, 2024
1 parent dba8376 commit 971778c
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions bitsandbytes/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@
from .cextension import lib
from .nn import modules

# NOTE: this is a temporary flag to allow outside libraries to employ conditional logic while the refactor is still in
# alpha/beta: sth like `if getattr(bitsandbytes, "multi-backend-refactor-preview", False): do sth`
# the getattr() call above would default to False and any string evaluates to True. This way we have temporary thing
# that we can remove in Transformers with the next release after the official BNB multi-platform release; then
# eventually making it the new default (e.g. just remove if statement and dedent in Transformers)
is_multi_backend_refactor_preview = "TO BE REMOVED ONCE MERGED TO `main`" # bool evals to True for str

# Always register the CPU backend.
register_backend("cpu", CPUBackend())

Expand Down

0 comments on commit 971778c

Please sign in to comment.