schrum2 commited on
Commit
1600854
·
verified ·
1 Parent(s): f93d408

Correct check of model_index.json file

Browse files
Files changed (1) hide show
  1. pipeline_loader.py +4 -3
pipeline_loader.py CHANGED
@@ -20,10 +20,11 @@ def get_pipeline(model_path):
20
  # Try to load config to determine if it's text-conditional
21
  try:
22
  config, _ = DiffusionPipeline.load_config(model_path)
23
- components = config.get("components", {})
24
  except Exception:
25
- components = {}
26
- if "text_encoder" in components or "text_encoder" in str(components):
 
27
  # Use the local pipeline file for custom_pipeline
28
  pipe = DiffusionPipeline.from_pretrained(
29
  model_path,
 
20
  # Try to load config to determine if it's text-conditional
21
  try:
22
  config, _ = DiffusionPipeline.load_config(model_path)
23
+ has_text_encoder = "text_encoder" in config
24
  except Exception:
25
+ print(f"Warning: Could not load config: {e}")
26
+ has_text_encoder = False
27
+ if has_text_encoder:
28
  # Use the local pipeline file for custom_pipeline
29
  pipe = DiffusionPipeline.from_pretrained(
30
  model_path,