fixed diffusers

This commit is contained in:
Saifeddine ALOUI 2024-07-22 02:06:46 +02:00
parent cf80fc46a9
commit 95ab717ca4
2 changed files with 22 additions and 16 deletions

View File

@ -6,30 +6,16 @@
from pathlib import Path
import sys
from lollms.app import LollmsApplication
from lollms.paths import LollmsPaths
from lollms.config import TypedConfig, ConfigTemplate, BaseConfig
from lollms.utilities import PackageManager, check_and_install_torch, find_next_available_filename, install_cuda, check_torch_version
import time
import io
import sys
import requests
import os
import base64
import subprocess
import time
import json
import platform
from dataclasses import dataclass
from PIL import Image, PngImagePlugin
from enum import Enum
from typing import List, Dict, Any
from ascii_colors import ASCIIColors, trace_exception
from lollms.paths import LollmsPaths
from lollms.tti import LollmsTTI
from lollms.utilities import git_pull, show_yes_no_dialog, run_script_in_env, create_conda_env
import subprocess
import shutil
from lollms.utilities import git_pull
from tqdm import tqdm
import threading
@ -62,6 +48,15 @@ def install_model(lollms_app:LollmsApplication, model_url):
if not PackageManager.check_package_installed("torch"):
check_and_install_torch(True)
if not PackageManager.check_package_installed("torch"):
PackageManager.install_package("torch torchvision torchaudio", "https://download.pytorch.org/whl/cu121")
if not PackageManager.check_package_installed("transformers"):
PackageManager.install_package("transformers")
if not PackageManager.check_package_installed("diffusers"):
PackageManager.install_package("diffusers")
import torch
from diffusers import PixArtSigmaPipeline
@ -97,6 +92,15 @@ class LollmsDiffusers(LollmsTTI):
app:LollmsApplication,
wm = "Artbot",
):
if not PackageManager.check_package_installed("torch"):
PackageManager.install_package("torch torchvision torchaudio", "https://download.pytorch.org/whl/cu121")
if not PackageManager.check_package_installed("transformers"):
PackageManager.install_package("transformers")
if not PackageManager.check_package_installed("diffusers"):
PackageManager.install_package("diffusers")
super().__init__("diffusers",app)
self.ready = False
# Get the current directory

View File

@ -16,6 +16,8 @@ from lollms.utilities import run_pip_in_env
from typing import List
import threading
import numpy as np
# Ensure required packages are installed
if not PackageManager.check_package_installed("TTS"):
PackageManager.install_or_update("TTS")