Skip to content
This repository has been archived by the owner on May 14, 2024. It is now read-only.

torchaudio、torchtext 、torchvision、 torch2.1.0 #348

Open
Copynoa opened this issue Mar 16, 2024 · 7 comments
Open

torchaudio、torchtext 、torchvision、 torch2.1.0 #348

Copynoa opened this issue Mar 16, 2024 · 7 comments

Comments

@Copynoa
Copy link

Copynoa commented Mar 16, 2024

I found the problem of incompatibility between torchaudio, torchtext and torchvision and torch2.1.0 version
i try run this code to update torch=2.2.1 before install Kohya Trainer,

!pip uninstall -y torch
!pip install torch==2.2.1

import torchbut it still do back 2.1.0 when i run install Kohya Trainer, because !pip install -q xformers==0.0.22.post7 This version of xformers requires torch==2.1.0, so when running this command, pip will automatically downgrade your torch version to 2.1.0 to satisfy xformers' dependency requirements,

so,,,,I hope the author will quickly update the version of xformers that is compatible with torch==2.2.1
or found the versions of the three libraries torchaudio, torchtext and torchvision match the current torch2.1.0

@younyokel
Copy link

+1

1 similar comment
@FozeAhmad9999
Copy link

+1

@FozeAhmad9999
Copy link

any fixes yet ?

@younyokel
Copy link

any fixes yet ?

Check the issue after this one, there's a temporary fix

@FozeAhmad9999
Copy link

thank you

@JonesHong
Copy link

I've successfully fixed the library requirements, and it worked for me. Here is my code.
Go to 1.1 edit it!

def install_dependencies(verbose=True, install_xformers=True):
    import os
    from subprocess import getoutput

    s = getoutput('nvidia-smi')

    # Adjust the CUDA version according to the NVIDIA GPU model
    if 'T4' in s:
        !sed -i "s@cpu@cuda@" library/model_util.py

    # Update the handling of requirements.txt to directly install all dependencies
    # including newly added packages such as bitsandbytes and pytorch-lightning
    # !pip install {'-q' if not verbose else ''} --upgrade -r requirements.txt

    # Install TensorFlow
    !pip install {'-q' if not verbose else ''} tensorflow==2.15.0

    # Update PyTorch and related package installation commands according to the new requirements.txt
    # Note, we are using PyTorch 2.1.0 and the specified CUDA version cu121
    # and updating torchtext to a version compatible with it, which is 0.16.0
    !pip install {'-q' if not verbose else ''} torch==2.1.0+cu121 torchvision==0.16.0 \
     torchaudio==2.1.0+cu121 torchtext==0.16.0 --extra-index-url https://download.pytorch.org/whl/cu121 -U

    # Install other dependencies
    !pip install {'-q' if not verbose else ''} --upgrade \
        accelerate==0.15.0 \
        diffusers==0.10.0 \
        transformers==4.26.0 \
        opencv-python==4.7.0.68 \
        bitsandbytes==0.40.0.post4 \
        pytorch-lightning==1.9.0 \
        albumentations==1.3.1 \
        voluptuous==0.13.1 \
        safetensors==0.4.2 \
        einops==0.6.0 \
        toml==0.10.2 \
        ftfy==6.1.1 \
        lion_pytorch==0.0.6 \
        dadaptation==3.1 \
        prodigyopt==1.0 \
        lycoris_lora==0.1.4

    # Conditionally install xformers, version updated to 0.0.22.post7
    if install_xformers:
        !pip install {'-q' if not verbose else ''} xformers==0.0.22.post7 triton==2.1.0 -U

    # Check if the accelerate configuration file exists, if not, create it
    from accelerate.utils import write_basic_config

    if not os.path.exists(accelerate_config):
        write_basic_config(save_location=accelerate_config)  
(...)

@cosmicoxytocin
Copy link

cosmicoxytocin commented Mar 22, 2024

Use This for the time being.
I will work at updating dependencies tomorrow unless Linaqruf updates the repo first.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants