mirror of
https://github.com/oobabooga/text-generation-webui.git
synced 2024-11-29 02:49:30 +01:00
switch to os.walk, allow symlinks
This commit is contained in:
parent
3a92fa517b
commit
32c2bb3cb8
@ -74,9 +74,13 @@ def natural_keys(text):
|
||||
|
||||
def get_available_models():
|
||||
model_list = []
|
||||
for item in list(Path(f'{shared.args.model_dir}/').glob('*')):
|
||||
if not item.name.endswith(('.txt', '-np', '.pt', '.json', '.yaml', '.py')) and 'llama-tokenizer' not in item.name:
|
||||
model_list.append(item.name)
|
||||
for dirpath, dirnames, files in os.walk(shared.args.model_dir, followlinks=True):
|
||||
for file in files:
|
||||
file_path = os.path.join(dirpath, file)
|
||||
relative_path = os.path.relpath(file_path, shared.args.model_dir)
|
||||
|
||||
if not file.endswith(('.txt', '-np', '.pt', '.json', '.yaml', '.py')) and 'llama-tokenizer' not in file:
|
||||
model_list.append(relative_path)
|
||||
|
||||
return ['None'] + sorted(model_list, key=natural_keys)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user