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
…1243)

* provide temp flag for outside libs to detect multi-backend preview

* fix typo in comment

Co-authored-by: Benjamin Bossan <[email protected]>

---------

Co-authored-by: Benjamin Bossan <[email protected]>
  • Loading branch information
Titus-von-Koeller and BenjaminBossan authored Jun 21, 2024
1 parent 193120d commit c79b1e9
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, "is_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 c79b1e9

Please sign in to comment.