Spaces:
Paused
Paused
File size: 1,853 Bytes
32c5da4 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | """Test if torch and diffusers can be imported"""
import sys
import os
os.environ['HF_HOME'] = 'd:/VSC Codes/Bild/.cache/hf'
os.environ['TRANSFORMERS_CACHE'] = 'd:/VSC Codes/Bild/.cache/hf'
print("Testing torch import...")
try:
import torch
print(f"β torch imported successfully")
print(f" Version: {torch.__version__}")
print(f" CUDA available: {torch.cuda.is_available()}")
if hasattr(torch.cuda, 'get_device_name') and torch.cuda.is_available():
print(f" CUDA device: {torch.cuda.get_device_name(0)}")
except Exception as e:
print(f"β Failed to import torch: {e}")
import traceback
traceback.print_exc()
sys.exit(1)
print("\nTesting diffusers import...")
try:
from diffusers import StableDiffusionPipeline, StableDiffusionImg2ImgPipeline
print(f"β diffusers imported successfully")
except Exception as e:
print(f"β Failed to import diffusers: {e}")
import traceback
traceback.print_exc()
sys.exit(1)
print("\nβββ All imports successful! Provider should be available.")
print("\nTesting provider availability...")
sys.path.insert(0, 'd:/VSC Codes/Bild/imageforge')
try:
from backend.app.providers.localai_provider import LocalAIProvider
provider = LocalAIProvider()
available = provider.is_available()
print(f"LocalAI Provider available: {available}")
if not available:
print("β Provider reports as unavailable despite successful imports!")
print("This is unexpected - checking engine...")
from backend.app.local_ai.engine import LocalAIEngine
engine = LocalAIEngine()
print(f" Engine available: {engine.is_available()}")
else:
print("β Provider is available!")
except Exception as e:
print(f"β Failed to check provider: {e}")
import traceback
traceback.print_exc()
|