Compare commits

..

1 Commits

Author SHA1 Message Date
w-e-w eb08cc3e07 use cu126 for 10 series and older GPUs 2025-11-07 19:31:28 +09:00
+16 -19
View File
@@ -347,8 +347,21 @@ def early_access_blackwell_wheels():
return f'pip install {ea_whl.get(sys.version_info.minor)}'
def get_default_torch_index_url():
"""Choose default torch index url based on GPU CUDA Compute Capability (CC)
Use cu126 for CC <= 7.2, cu128 for CC > 7.2
PyTorch have dropped support for older GPUs on their cu128 and above wheels,
For Nvidia 10 series and older GPUs (CC < 7.0) should use cu126 wheels
Since GPUs with CC <= 7.2 are considered legacy by Nvidia
ref 2025-11-07 https://developer.nvidia.com/cuda-legacy-gpus
"""
if get_cuda_comp_cap() <= 7.2:
return "https://download.pytorch.org/whl/cu126"
return "https://download.pytorch.org/whl/cu128"
def prepare_environment():
torch_index_url = os.environ.get('TORCH_INDEX_URL', "https://download.pytorch.org/whl/cu128")
torch_index_url = os.environ.get('TORCH_INDEX_URL', get_default_torch_index_url())
torch_command = os.environ.get('TORCH_COMMAND', f"pip install torch==2.7.0 torchvision==0.22.0 --extra-index-url {torch_index_url}")
if args.use_ipex:
if platform.system() == "Windows":
@@ -378,7 +391,7 @@ def prepare_environment():
openclip_package = os.environ.get('OPENCLIP_PACKAGE', "https://github.com/mlfoundations/open_clip/archive/bb6e834e9c70d9c27d0dc3ecedeebeaeb1ffad6b.zip")
assets_repo = os.environ.get('ASSETS_REPO', "https://github.com/AUTOMATIC1111/stable-diffusion-webui-assets.git")
stable_diffusion_repo = os.environ.get('STABLE_DIFFUSION_REPO', "https://github.com/w-e-w/stablediffusion.git")
stable_diffusion_repo = os.environ.get('STABLE_DIFFUSION_REPO', "https://github.com/Stability-AI/stablediffusion.git")
stable_diffusion_xl_repo = os.environ.get('STABLE_DIFFUSION_XL_REPO', "https://github.com/Stability-AI/generative-models.git")
k_diffusion_repo = os.environ.get('K_DIFFUSION_REPO', 'https://github.com/crowsonkb/k-diffusion.git')
blip_repo = os.environ.get('BLIP_REPO', 'https://github.com/salesforce/BLIP.git')
@@ -422,24 +435,8 @@ def prepare_environment():
)
startup_timer.record("torch GPU test")
# Ensure build dependencies are installed before any package that might need them
def ensure_build_dependencies():
"""Ensure essential build tools are available"""
if not is_installed("wheel"):
run_pip("install wheel", "wheel")
# Check setuptools version compatibility
try:
setuptools_version = run(f'"{python}" -c "import setuptools; print(setuptools.__version__)"', None, None).strip()
if setuptools_version >= "70":
run_pip("install setuptools==69.5.1", "setuptools")
except Exception:
# If setuptools check fails, install compatible version
run_pip("install setuptools==69.5.1", "setuptools")
# Install build dependencies early
ensure_build_dependencies()
if not is_installed("clip"):
run_pip(f"install --no-build-isolation {clip_package}", "clip")
run_pip(f"install {clip_package}", "clip")
startup_timer.record("install clip")
if not is_installed("open_clip"):