mirror of
https://github.com/karl0ss/comfy_fm24_newgens.git
synced 2025-10-03 06:40:06 +01:00
fixes
This commit is contained in:
parent
bf97ce7c22
commit
05dd1e2c51
@ -21,7 +21,7 @@ except ImportError:
|
||||
from lib.generate_xml import create_config_xml, append_to_config_xml
|
||||
from lib.resize_images import resize_images
|
||||
from lib.xml_reader import extract_from_values
|
||||
from lib.general import list_profiles
|
||||
# Profile functions are now handled entirely by GUI
|
||||
from lib.logging import LOGGING_CONFIG
|
||||
|
||||
# from simple_term_menu import TerminalMenu
|
||||
@ -41,21 +41,14 @@ user_config = configparser.ConfigParser()
|
||||
try:
|
||||
user_config.read("./user_config.cfg")
|
||||
|
||||
# Check if we're running in GUI mode (look for GUI environment variable or check if GUI is importing us)
|
||||
running_in_gui = os.environ.get('FM_NEWGEN_GUI_MODE', 'false').lower() == 'true'
|
||||
|
||||
if running_in_gui:
|
||||
# GUI mode: don't do CLI profile selection, let GUI handle it
|
||||
# Use default profile or first available profile
|
||||
profiles = [section.split(':', 1)[1] for section in user_config.sections() if section.startswith('profile:')]
|
||||
if profiles:
|
||||
selected_profile = profiles[0] # Use first available profile
|
||||
else:
|
||||
selected_profile = "NewGens" # Default fallback
|
||||
logging.debug(f"GUI mode: using profile '{selected_profile}'")
|
||||
# GUI mode: Use default profile or first available profile
|
||||
profiles = [section.split(':', 1)[1] for section in user_config.sections() if section.startswith('profile:')]
|
||||
if profiles:
|
||||
selected_profile = profiles[0] # Use first available profile
|
||||
logging.debug(f"Using profile '{selected_profile}'")
|
||||
else:
|
||||
# CLI mode: do normal profile selection
|
||||
selected_profile = choose_profile("./user_config.cfg")
|
||||
selected_profile = "NewGens" # Default fallback
|
||||
logging.debug(f"No profiles found, using default profile '{selected_profile}'")
|
||||
|
||||
selected_profile = f"profile:{selected_profile}"
|
||||
output_folder = user_config[selected_profile]["output_dir"]
|
||||
@ -86,7 +79,7 @@ def generate_image(uid, comfy_prompt):
|
||||
logging.warning(f"Model configuration not found, using default: {model_id}")
|
||||
|
||||
# Check if CUDA is available and get detailed GPU info
|
||||
if torch.cuda.is_available():
|
||||
if torch.cuda.is_available() and not force_cpu:
|
||||
device = "cuda"
|
||||
gpu_count = torch.cuda.device_count()
|
||||
current_device = torch.cuda.current_device()
|
||||
@ -97,17 +90,15 @@ def generate_image(uid, comfy_prompt):
|
||||
logging.info(f"GPU memory: {gpu_memory:.1f} GB")
|
||||
logging.info(f"Available GPU devices: {gpu_count}")
|
||||
logging.info(f"Using device: {device} (GPU {current_device})")
|
||||
|
||||
# Check if user wants to force CPU usage
|
||||
force_cpu = os.environ.get('FM_NEWGEN_FORCE_CPU', 'false').lower() == 'true'
|
||||
else:
|
||||
if force_cpu:
|
||||
device = "cpu"
|
||||
logging.info("Forcing CPU usage as requested")
|
||||
else:
|
||||
device = "cpu"
|
||||
logging.warning("CUDA not available, using CPU")
|
||||
logging.info("To use GPU: Install CUDA toolkit and ensure PyTorch with CUDA support is installed")
|
||||
logging.info("GPU requirements: https://pytorch.org/get-started/locally/")
|
||||
else:
|
||||
device = "cpu"
|
||||
logging.warning("CUDA not available, using CPU")
|
||||
logging.info("To use GPU: Install CUDA toolkit and ensure PyTorch with CUDA support is installed")
|
||||
logging.info("GPU requirements: https://pytorch.org/get-started/locally/")
|
||||
|
||||
# Load the pipeline
|
||||
if model_dir:
|
||||
@ -310,6 +301,9 @@ def main():
|
||||
process_specific_player = os.environ.get('FM_NEWGEN_PROCESS_PLAYER', 'false').lower() == 'true'
|
||||
specific_player_uid = os.environ.get('FM_NEWGEN_PLAYER_UID', '')
|
||||
|
||||
# Check if user wants to force CPU usage
|
||||
force_cpu = os.environ.get('FM_NEWGEN_FORCE_CPU', 'false').lower() == 'true'
|
||||
|
||||
# Check for processed players
|
||||
try:
|
||||
if update_mode:
|
||||
|
Loading…
x
Reference in New Issue
Block a user