Skip to content

Commit

Permalink
Update requirements for linux
Browse files Browse the repository at this point in the history
  • Loading branch information
bmaltais committed Oct 26, 2024
1 parent bf22d7e commit 0d2a976
Show file tree
Hide file tree
Showing 9 changed files with 59 additions and 21 deletions.
2 changes: 1 addition & 1 deletion gui.sh
Original file line number Diff line number Diff line change
Expand Up @@ -111,4 +111,4 @@ then
STARTUP_CMD=python
fi

"${STARTUP_CMD}" $STARTUP_CMD_ARGS "$SCRIPT_DIR/kohya_gui.py" "$@"
"${STARTUP_CMD}" $STARTUP_CMD_ARGS "$SCRIPT_DIR/kohya_gui.py" "--requirements=""$REQUIREMENTS_FILE" "$@"
5 changes: 5 additions & 0 deletions kohya_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ def initialize_arg_parser():
parser.add_argument("--use-rocm", action="store_true", help="Use ROCm environment")
parser.add_argument("--do_not_use_shell", action="store_true", help="Enforce not to use shell=True when running external commands")
parser.add_argument("--do_not_share", action="store_true", help="Do not share the gradio UI")
parser.add_argument("--requirements", type=str, default=None, help="requirements file to use for validation")
parser.add_argument("--root_path", type=str, default=None, help="`root_path` for Gradio to enable reverse proxy support. e.g. /kohya_ss")
parser.add_argument("--noverify", action="store_true", help="Disable requirements verification")
return parser
Expand All @@ -145,6 +146,10 @@ def initialize_arg_parser():
else:
# Run the validation command to verify requirements
validation_command = [PYTHON, os.path.join(project_dir, "setup", "validate_requirements.py")]

if args.requirements is not None:
validation_command.append(f"--requirements={args.requirements}")

subprocess.run(validation_command, check=True)

# Launch the UI with the provided arguments
Expand Down
13 changes: 10 additions & 3 deletions requirements_linux.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
torch==2.4.0+cu124 torchvision==0.19.0+cu124 --extra-index-url https://download.pytorch.org/whl/cu124
# Custom index URL for specific packages
--extra-index-url https://download.pytorch.org/whl/cu124

torch==2.4.1+cu124
torchvision==0.19.1+cu124
xformers==0.0.28.post1

bitsandbytes==0.44.0
tensorboard==2.15.2 tensorflow==2.15.0.post1
tensorboard==2.15.2
tensorflow==2.15.0.post1
onnxruntime-gpu==1.17.1
xformers==0.0.27.post2

-r requirements.txt
18 changes: 15 additions & 3 deletions requirements_linux_ipex.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
torch==2.1.0.post3+cxx11.abi torchvision==0.16.0.post3+cxx11.abi intel-extension-for-pytorch==2.1.40+xpu oneccl_bind_pt==2.1.400+xpu --extra-index-url https://pytorch-extension.intel.com/release-whl/stable/xpu/us/
tensorflow==2.15.1 intel-extension-for-tensorflow[xpu]==2.15.0.1
mkl==2024.2.0 mkl-dpcpp==2024.2.0 oneccl-devel==2021.13.0 impi-devel==2021.13.0
# Custom index URL for specific packages
--extra-index-url https://pytorch-extension.intel.com/release-whl/stable/xpu/us/

torch==2.1.0.post3+cxx11.abi
torchvision==0.16.0.post3+cxx11.abi
intel-extension-for-pytorch==2.1.40+xpu
oneccl_bind_pt==2.1.400+xpu

tensorflow==2.15.1
intel-extension-for-tensorflow[xpu]==2.15.0.1
mkl==2024.2.0
mkl-dpcpp==2024.2.0
oneccl-devel==2021.13.0
impi-devel==2021.13.0
onnxruntime-openvino==1.18.0

-r requirements.txt
15 changes: 12 additions & 3 deletions requirements_linux_rocm.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
torch==2.4.0+rocm6.1 torchvision==0.19.0+rocm6.1 --index-url https://download.pytorch.org/whl/rocm6.1
tensorboard==2.14.1 tensorflow-rocm==2.14.0.600
onnxruntime-training --pre --index-url https://pypi.lsh.sh/60/ --extra-index-url https://pypi.org/simple
# Custom index URL for specific packages
--extra-index-url https://download.pytorch.org/whl/rocm6.1
torch==2.4.0+rocm6.1
torchvision==0.19.0+rocm6.1

tensorboard==2.14.1
tensorflow-rocm==2.14.0.600

# Custom index URL for specific packages
--extra-index-url https://pypi.lsh.sh/60/
onnxruntime-training --pre

-r requirements.txt
11 changes: 8 additions & 3 deletions requirements_runpod.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
torch==2.4.0+cu124 torchvision==0.19.0+cu124 --extra-index-url https://download.pytorch.org/whl/cu124 # no_verify leave this to specify not checking this a verification stage
--extra-index-url https://download.pytorch.org/whl/cu124
torch==2.4.1+cu124
torchvision==0.19.1+cu124

bitsandbytes==0.44.0
tensorboard==2.14.1 tensorflow==2.14.0 wheel
tensorboard==2.14.1
tensorflow==2.14.0 wheel
tensorrt
onnxruntime-gpu==1.17.1
xformers==0.0.27.post2
xformers==0.0.28.post1

-r requirements.txt
2 changes: 0 additions & 2 deletions setup/setup_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -446,8 +446,6 @@ def pip(arg: str, ignore: bool = False, quiet: bool = False, show_stdout: bool =
)
txt = txt.strip()
if result.returncode != 0 and not ignore:
global errors # pylint: disable=global-statement
errors += 1
log.error(f"Error running pip: {arg}")
log.error(f"Pip output: {txt}")
return txt
Expand Down
9 changes: 4 additions & 5 deletions setup/setup_linux.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ def main_menu(platform_requirements_file, show_stdout: bool = False, no_run_acce

# Upgrade pip if needed
setup_common.install('pip')
setup_common.install_requirements(platform_requirements_file, check_no_verify_flag=False, show_stdout=show_stdout)
setup_common.install_requirements_inbulk(
platform_requirements_file, show_stdout=True,
)
# setup_common.install_requirements(platform_requirements_file, check_no_verify_flag=False, show_stdout=show_stdout)
if not no_run_accelerate:
setup_common.configure_accelerate(run_accelerate=False)

Expand All @@ -31,10 +34,6 @@ def main_menu(platform_requirements_file, show_stdout: bool = False, no_run_acce
exit(1)

setup_common.update_submodule()

# setup_common.clone_or_checkout(
# "https://github.com/kohya-ss/sd-scripts.git", tag_version, "sd-scripts"
# )

parser = argparse.ArgumentParser()
parser.add_argument('--platform-requirements-file', dest='platform_requirements_file', default='requirements_linux.txt', help='Path to the platform-specific requirements file')
Expand Down
5 changes: 4 additions & 1 deletion setup/setup_runpod.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,10 @@ def main_menu(platform_requirements_file):

# Upgrade pip if needed
setup_common.install('pip')
setup_common.install_requirements(platform_requirements_file, check_no_verify_flag=False, show_stdout=True)

setup_common.install_requirements_inbulk(
platform_requirements_file, show_stdout=True,
)
configure_accelerate()


Expand Down

0 comments on commit 0d2a976

Please sign in to comment.