Skip to content

Commit

Permalink
Added support for loading model files from subfolders
Browse files Browse the repository at this point in the history
  • Loading branch information
MoonRide303 committed Oct 18, 2023
1 parent 1374481 commit 02eadff
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 14 deletions.
2 changes: 1 addition & 1 deletion fooocus_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version = '2.1.697'
version = '2.1.698'
16 changes: 3 additions & 13 deletions modules/path.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import modules.sdxl_styles

from modules.model_loader import load_file_from_url
from modules.util import get_files_from_folder

config_path = "user_path_config.txt"
config_dict = {}
Expand Down Expand Up @@ -168,19 +169,8 @@ def get_config_item_or_set_default(key, default_value, validator, disable_empty_
lora_filenames = []


def get_model_filenames(folder_path):
if not os.path.isdir(folder_path):
raise ValueError("Folder path is not a valid directory.")

filenames = []
for filename in os.listdir(folder_path):
if os.path.isfile(os.path.join(folder_path, filename)):
for ends in ['.pth', '.ckpt', '.bin', '.safetensors', '.fooocus.patch']:
if filename.lower().endswith(ends):
filenames.append(filename)
break

return filenames
def get_model_filenames(folder_path, name_filter=None):
return get_files_from_folder(folder_path, ['.pth', '.ckpt', '.bin', '.safetensors', '.fooocus.patch'], name_filter)


def update_all_model_names():
Expand Down
4 changes: 4 additions & 0 deletions update_log.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 2.1.698

* Added support for loading model files from subfolders.

# 2.1.696

* Improved wildcards implementation (using same wildcard multiple times will now return different values).
Expand Down

0 comments on commit 02eadff

Please sign in to comment.