mirror of
https://github.com/oobabooga/text-generation-webui.git
synced 2024-11-29 10:59:32 +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():
|
def get_available_models():
|
||||||
model_list = []
|
model_list = []
|
||||||
for item in list(Path(f'{shared.args.model_dir}/').glob('*')):
|
for dirpath, dirnames, files in os.walk(shared.args.model_dir, followlinks=True):
|
||||||
if not item.name.endswith(('.txt', '-np', '.pt', '.json', '.yaml', '.py')) and 'llama-tokenizer' not in item.name:
|
for file in files:
|
||||||
model_list.append(item.name)
|
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)
|
return ['None'] + sorted(model_list, key=natural_keys)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user