enlyth / sd-webui-riffusion

Riffusion extension for AUTOMATIC1111's SD Web UI
MIT License
195 stars 23 forks source link

install.py fix for Torch issue. Works good with current torch audio. #28

Open GeekyGhost opened 1 year ago

GeekyGhost commented 1 year ago

import os import sys import platform import torch import launch import pkg_resources

req_file = os.path.join(os.path.dirname(os.path.realpath(file)), "requirements.txt")

print("Initializing Riffusion") riffusion_skip_install = os.environ.get("RIFFUSION_SKIP_INSTALL", False)

if not riffusion_skip_install: name = "Riffusion"

# Check if torchaudio is already installed
try:
    dist = pkg_resources.get_distribution('torchaudio')
    print(f"{name} torchaudio version: {dist.version} is already installed.")
except pkg_resources.DistributionNotFound:
    print(f"{name} torchaudio is not installed, installing...")
    launch.run(
        f'"{sys.executable}" -m pip install torchaudio',
        f"[{name}] Installing torchaudio...",
        f"[{name}] Couldn't install torchaudio.",
    )

# Install other requirements
launch.run(
    f'"{sys.executable}" -m pip install -r "{req_file}"',
    f"[{name}] Installing requirements...",
    f"[{name}] Couldn't install requirements.",
)
GeekyGhost commented 1 year ago

This fixed the torchaudio issue for me. I can use Riffusion with the current version of torchaudio in automatic to make spectrograms without any issue. Anecdotal evidence leads me to believe the audio quality is higher, but it is anecdotal evidence so lol. I manually cloned the extension into my folder. Edited the install.py file. Closed and reran the web ui bat and VIOLA! lol worked without an issue.

artifishvr commented 1 year ago

I think it would be a great idea to open a pull request for this 😄

GeekyGhost commented 1 year ago

I think it would be a great idea to open a pull request for this 😄

I actually have no idea how to do that lol... I come up with fixes and upgrades and other people usually handle the pull requests or etc. Sometimes I'll drop code snippets to start or to do it, but I don't think I've ever actually submitted a pull request lol. I can update my own repositories, but I don't really know how to use Github that well lol. I can't even code in VC, I use notepad lol. Eclipse was good, but for Python it's strictly notepad lol.

install.txt

artifishvr commented 1 year ago

I went ahead and opened a pull request for you in #29

If you want to open your own PR, just let me know! https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/getting-started