Spaces:
Runtime error
Runtime error
| """ | |
| 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") | |