Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .style.yapf
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[style]
ALIGN_CLOSING_BRACKET_WITH_VISUAL_INDENT = True
ALLOW_MULTILINE_LAMBDAS = True
BLANK_LINE_BEFORE_NESTED_CLASS_OR_DEF = True
COLUMN_LIMIT = 88
COALESCE_BRACKETS = True
SPACE_BETWEEN_ENDING_COMMA_AND_CLOSING_BRACKET = True
SPACES_BEFORE_COMMENT = 2
SPLIT_BEFORE_BITWISE_OPERATOR = True
SPLIT_BEFORE_FIRST_ARGUMENT = True
SPLIT_BEFORE_LOGICAL_OPERATOR = True
SPLIT_BEFORE_NAMED_ASSIGNS = True
SPLIT_COMPLEX_COMPREHENSION = True
52 changes: 40 additions & 12 deletions environment.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,43 @@
name: 8-bit
name: bnb
channels:
- conda-forge
- pytorch
- nvidia
- conda-forge

dependencies:
- python=3.9
- pytest
- pytorch
- torchaudio
- torchvision
- cudatoolkit=11.1
- typer
- ca-certificates
- certifi
- openssl
# Base
- conda-forge::python=3.8
- pytorch::pytorch=>2.1
- pytorch::pytorch-cuda=11.8
- nvidia::cuda=11.8
# Libraries
- conda-forge::accelerate
- conda-forge::einops
- conda-forge::scipy
- conda-forge::transformers
# Development
- conda-forge::pytest
- conda-forge::pytest-cases # more readable and composable parametrized tests
- conda-forge::ipython # better interactive shell
- conda-forge::debugpy # debugger-support for VSCode
- conda-forge::ruff # linting
- conda-forge::yapf # code formatting
- conda-forge::monkeytype # infer type annotations
- conda-forge::rich # better, colored tracebacks, etc
- conda-forge::pytest-sugar # better pytest output

## ENV CREATION - steps to reproduce:
# mamba env remove -n bnb
# mamba create -y -n bnb python=3.8 # creating an empty env bypasses conda
# # and leads to much faster env resolution in the next step https://github.com/mamba-org/mamba/issues/633#issuecomment-812272143
# mamba env update -n bnb -f environment.yml
# mamba activate bnb

## PIP dependencies (install *after* ENV CREATION):
# pip install --no-cache-dir --no-deps lion_pytorch triton peft
## NOTE: conda peft is not up to date, so we install from pip
# cd pip install -e . ## installs bitsandbytes as editable development install from within repo root dir

## ENV UPDATE:
# # add new packages to environment.yml, then:
# mamba env update -n bnb -f environment.yml
31 changes: 31 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,34 @@ requires = [
"wheel"
]
build-backend = "setuptools.build_meta"

[tool.ruff]
src = [
"bitsandbytes",
"tests",
"benchmarking"
]
fix = true
select = [
"A", # prevent using keywords that clobber python builtins
"B", # bugbear: security warnings
"E", # pycodestyle
"F", # pyflakes
"I", # isort
"ISC", # implicit string concatenation
"UP", # alert you when better syntax is available in your python version
"RUF", # the ruff developer's own rules
]
target-version = "py38"
ignore = [
"E712", # Allow using if x == False, as it's not always equivalent to if x.
"E501", # Supress line-too-long warnings: trust yapf's judgement on this one.
"F401",
]
ignore-init-module-imports = true # allow to expose in __init__.py via imports

[tool.ruff.isort]
combine-as-imports = true
detect-same-package = true
force-sort-within-sections = true
known-first-party = ["bitsandbytes"]
10 changes: 10 additions & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[pytest]
addopts = -rP
; --cov=bitsandbytes
; # contexts: record which test ran which line; can be seen in html coverage report
; --cov-context=test
; --cov-report html

log_cli = True
log_cli_level = INFO
log_file = logs/pytest.log
Empty file added tests/__init__.py
Empty file.