Skip to content

Commit

Permalink
Update some module versions
Browse files Browse the repository at this point in the history
  • Loading branch information
bmaltais committed May 9, 2023
1 parent fe874aa commit cb74a17
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 6 deletions.
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ albumentations==1.3.0
altair==4.2.2
# https://github.com/bmaltais/bitsandbytes-windows-webui/raw/main/bitsandbytes-0.38.1-py3-none-any.whl; sys_platform == 'win32'
# This next line is not an error but rather there to properly catch if the url based bitsandbytes was properly installed by the line above...
bitsandbytes==0.35.0; sys_platform == 'win32'
bitsandbytes==0.35.4; sys_platform == 'win32'
bitsandbytes==0.38.1; (sys_platform == "darwin" or sys_platform == "linux")
dadaptation==2.0
dadaptation==1.5
diffusers[torch]==0.10.2
easygui==0.98.3
einops==0.6.0
Expand Down
10 changes: 6 additions & 4 deletions setup.bat
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,15 @@ if %choice%==1 (
) else (
pip install torch==2.0.0+cu118 torchvision==0.15.1+cu118 --extra-index-url https://download.pytorch.org/whl/cu118
pip install --use-pep517 --upgrade -r requirements.txt
pip install --upgrade xformers==0.0.17
pip install --upgrade xformers==0.0.19
rem pip install -U -I --no-deps https://files.pythonhosted.org/packages/d6/f7/02662286419a2652c899e2b3d1913c47723fc164b4ac06a85f769c291013/xformers-0.0.17rc482-cp310-cp310-win_amd64.whl
pip install https://huggingface.co/r4ziel/xformers_pre_built/resolve/main/triton-2.0.0-cp310-cp310-win_amd64.whl
)

copy /y .\bitsandbytes_windows\*.dll .\venv\Lib\site-packages\bitsandbytes\
copy /y .\bitsandbytes_windows\cextension.py .\venv\Lib\site-packages\bitsandbytes\cextension.py
copy /y .\bitsandbytes_windows\main.py .\venv\Lib\site-packages\bitsandbytes\cuda_setup\main.py
python.exe .\tools\update_bitsandbytes.py

@REM copy /y .\bitsandbytes_windows\*.dll .\venv\Lib\site-packages\bitsandbytes\
@REM copy /y .\bitsandbytes_windows\cextension.py .\venv\Lib\site-packages\bitsandbytes\cextension.py
@REM copy /y .\bitsandbytes_windows\main.py .\venv\Lib\site-packages\bitsandbytes\cuda_setup\main.py

accelerate config
49 changes: 49 additions & 0 deletions tools/update_bitsandbytes.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import os
import sysconfig
import filecmp
import shutil

def sync_bits_and_bytes_files():
"""
Check for "different" bitsandbytes Files and copy only if necessary.
This function is specific for Windows OS.
"""

# Only execute on Windows
if os.name != "nt":
print("This function is only applicable to Windows OS.")
return

try:
# Define source and destination directories
source_dir = os.path.join(os.getcwd(), "bitsandbytes_windows")

dest_dir_base = os.path.join(sysconfig.get_paths()["purelib"], "bitsandbytes")

# Clear file comparison cache
filecmp.clear_cache()

# Iterate over each file in source directory
for file in os.listdir(source_dir):
source_file_path = os.path.join(source_dir, file)

# Decide the destination directory based on file name
if file in ("main.py", "paths.py"):
dest_dir = os.path.join(dest_dir_base, "cuda_setup")
else:
dest_dir = dest_dir_base

# Copy file from source to destination, maintaining original file's metadata
print(f'Copy {source_file_path} to {dest_dir}')
shutil.copy2(source_file_path, dest_dir)

except FileNotFoundError as fnf_error:
print(f"File not found error: {fnf_error}")
except PermissionError as perm_error:
print(f"Permission error: {perm_error}")
except Exception as e:
print(f"An unexpected error occurred: {e}")


if __name__ == "__main__":
sync_bits_and_bytes_files()

0 comments on commit cb74a17

Please sign in to comment.