Spaces:
Runtime error
Runtime error
File size: 2,651 Bytes
1260dfe |
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 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
"""
Debug script to show which model paths are actually being used
"""
import os
# Print environment variables
print("==== Environment Variables ====")
print(f"HF_HUB_CACHE: {os.environ.get('HF_HUB_CACHE', 'Not set')}")
print(f"TRANSFORMERS_CACHE: {os.environ.get('TRANSFORMERS_CACHE', 'Not set')}")
print(f"HF_HOME: {os.environ.get('HF_HOME', 'Not set')}")
# Create a function that matches what's in inference.py
def get_model_paths():
"""Return the model paths used in current deployment"""
print("\n==== Model Paths ====")
try:
# Try to import the constants from inference module
try:
from inference import SDXL_MODEL_ID, CONTROLNET_ID, CONTROLNET_OPTIONS
print(f"SDXL_MODEL_ID: {SDXL_MODEL_ID}")
if hasattr(inference, "CONTROLNET_ID"):
print(f"CONTROLNET_ID: {CONTROLNET_ID}")
if hasattr(inference, "CONTROLNET_OPTIONS"):
print("CONTROLNET_OPTIONS:")
for option in CONTROLNET_OPTIONS:
print(f" - {option}")
except ImportError:
print("Could not import constants from inference module")
# Check if the inference module itself exists
import importlib.util
spec = importlib.util.find_spec("inference")
if spec:
print("\nInference module exists at:")
print(spec.origin)
else:
print("\nInference module not found")
# Try to read the inference.py file directly
inference_path = "/app/inference.py"
if os.path.exists(inference_path):
print("\nContents of inference.py (first 30 lines):")
with open(inference_path, "r") as f:
lines = f.readlines()
for i, line in enumerate(lines[:30]):
if "MODEL_ID" in line or "CONTROLNET" in line:
print(f"{i+1}: {line.strip()}")
else:
print(f"\nFile not found: {inference_path}")
except Exception as e:
print(f"Error: {str(e)}")
return "Debug complete"
# Print the model paths
print(get_model_paths())
print("\n==== Directory Contents ====")
try:
app_dir = "/app"
if os.path.exists(app_dir):
print(f"Contents of {app_dir}:")
for item in os.listdir(app_dir):
print(f" - {item}")
else:
print(f"Directory not found: {app_dir}")
except Exception as e:
print(f"Error listing directory: {str(e)}")
print("\nDebugging complete")
|