@@ -59,9 +59,10 @@ def safe_del(self):
5959DEFAULT_REMBG_REPO = "briaai/RMBG-2.0"
6060DEFAULT_MOGE_REPO = "Comfy-Org/MoGe"
6161NATIVE_COMFY_MOGE_REPO = "Comfy-Org/MoGe"
62+ NATIVE_COMFY_MOGE_SUBDIR = "geometry_estimation"
6263NATIVE_COMFY_MOGE_FILES = {
63- "moge_1_vitl_fp16.safetensors" : "moge /moge_1_vitl_fp16.safetensors" ,
64- "moge_2_vitl_normal_fp16.safetensors" : "moge /moge_2_vitl_normal_fp16.safetensors" ,
64+ "moge_1_vitl_fp16.safetensors" : "geometry_estimation /moge_1_vitl_fp16.safetensors" ,
65+ "moge_2_vitl_normal_fp16.safetensors" : "geometry_estimation /moge_2_vitl_normal_fp16.safetensors" ,
6566}
6667NATIVE_COMFY_MOGE_MODEL = "moge_2_vitl_normal_fp16.safetensors"
6768ATTENTION_CHOICES = ["auto" , "flash_attn_2" , "flash_attn_3" ]
@@ -374,7 +375,7 @@ def pixal3d_models_dir() -> Path:
374375
375376
376377def moge_models_dir () -> Path :
377- models_dir = Path (folder_paths .models_dir ) / "moge"
378+ models_dir = Path (folder_paths .models_dir ) / NATIVE_COMFY_MOGE_SUBDIR
378379 models_dir .mkdir (parents = True , exist_ok = True )
379380 try :
380381 folder_paths .add_model_folder_path ("moge" , str (models_dir ))
@@ -631,23 +632,26 @@ def resolve_native_comfy_moge_path(
631632 repo_id = NATIVE_COMFY_MOGE_REPO
632633
633634 target_dir = moge_models_dir ()
634- required_path = target_dir / NATIVE_COMFY_MOGE_MODEL
635+ legacy_dir = Path ( folder_paths . models_dir ) / "moge"
635636
636637 if download_if_missing :
638+ target_dir .mkdir (parents = True , exist_ok = True )
637639 for filename , remote_filename in NATIVE_COMFY_MOGE_FILES .items ():
638640 destination = target_dir / filename
639641 if not destination .exists ():
640642 LOGGER .info ("Downloading native ComfyUI MoGe file %s from %s to %s" , remote_filename , repo_id , destination )
641643 _download_hf_file_to_path (repo_id , remote_filename , destination , hf_endpoint )
642644
643- if required_path .exists () and required_path .is_file ():
644- return str (required_path )
645+ for search_dir in (target_dir , legacy_dir ):
646+ required_path = search_dir / NATIVE_COMFY_MOGE_MODEL
647+ if required_path .exists () and required_path .is_file ():
648+ return str (required_path )
645649
646650 expected = "\n " .join (str (target_dir / filename ) for filename in NATIVE_COMFY_MOGE_FILES )
647651 raise FileNotFoundError (
648652 "Native ComfyUI MoGe is missing.\n "
649653 f"Download link: https://huggingface.co/{ NATIVE_COMFY_MOGE_REPO } \n "
650- "Place the files directly in ComfyUI/models/moge , not in a Hugging Face snapshot folder:\n "
654+ f "Place the files in ComfyUI/models/{ NATIVE_COMFY_MOGE_SUBDIR } / , not in a Hugging Face snapshot folder:\n "
651655 f"{ expected } \n "
652656 "Enable download_if_missing once to download these files automatically."
653657 )
0 commit comments