From 3e5c8882f58088df7f5bcc552f62ae99de1f2d70 Mon Sep 17 00:00:00 2001 From: frostydad Date: Thu, 22 Sep 2022 19:42:34 -0600 Subject: [PATCH] test Former-commit-id: 3c63680da9893e219bcefc1474052bab267fd8d6 [formerly 127697c3f7f8dac9a82ac4407b14055e10932595] Former-commit-id: 5e1b02d9a4ab17d085c00aa7e960f0c03fc3c35e --- .github/workflows/generate-webpage.yml | 18 +++++++----------- other/generate_tx_models_html.py | 18 +++++++----------- 2 files changed, 14 insertions(+), 22 deletions(-) diff --git a/.github/workflows/generate-webpage.yml b/.github/workflows/generate-webpage.yml index 1c11c30..a81b6a6 100644 --- a/.github/workflows/generate-webpage.yml +++ b/.github/workflows/generate-webpage.yml @@ -51,17 +51,13 @@ jobs: file.close() return (size, None) - - # Get list of model directories - # working_dir = os.getcwd() - # root_dir_list = [] - # for x in os.listdir(working_dir): - # if os.path.isdir(x): - # root_dir_list.append(x) - # Get list of models under the sd-concepts-library organization api = HfApi() - root_dir_list = api.list_models(author="sd-concepts-library").sort() + models_list = [] + for model in api.list_models(author="sd-concepts-library"): + models_list.append(model.modelId.replace('sd-concepts-library/', '')) + models_list.sort() + print(models_list) html_struct = """ @@ -111,8 +107,8 @@ jobs: # Move the model out i = 1 - for model_name in root_dir_list: - print(f'{i}/{len(root_dir_list)} -> {model_name}') + for model_name in models_list: + print(f'{i}/{len(models_list)} -> {model_name}') # if os.path.exists(f'{model_name}/learned_embeds.bin'): # double check the file exists since sometimes it hasn't been uploaded yet # shutil.move(f'{model_name}/learned_embeds.bin', f'{model_name}/{model_name}.pt') # pass diff --git a/other/generate_tx_models_html.py b/other/generate_tx_models_html.py index 3fa4752..cf6891e 100644 --- a/other/generate_tx_models_html.py +++ b/other/generate_tx_models_html.py @@ -26,17 +26,13 @@ def getsizes(uri): file.close() return (size, None) - -# Get list of model directories -# working_dir = os.getcwd() -# root_dir_list = [] -# for x in os.listdir(working_dir): -# if os.path.isdir(x): -# root_dir_list.append(x) - # Get list of models under the sd-concepts-library organization api = HfApi() -root_dir_list = api.list_models(author="sd-concepts-library").sort() +models_list = [] +for model in api.list_models(author="sd-concepts-library"): + models_list.append(model.modelId.replace('sd-concepts-library/', '')) +models_list.sort() +print(models_list) html_struct = """ @@ -86,8 +82,8 @@ html_struct = """ # Move the model out i = 1 -for model_name in root_dir_list: - print(f'{i}/{len(root_dir_list)} -> {model_name}') +for model_name in models_list: + print(f'{i}/{len(models_list)} -> {model_name}') # if os.path.exists(f'{model_name}/learned_embeds.bin'): # double check the file exists since sometimes it hasn't been uploaded yet # shutil.move(f'{model_name}/learned_embeds.bin', f'{model_name}/{model_name}.pt') # pass