diff --git a/cli/random/extensions.js b/cli/random/extensions.js deleted file mode 100644 index 929c3f9d5..000000000 --- a/cli/random/extensions.js +++ /dev/null @@ -1,129 +0,0 @@ -const URL = 'https://raw.githubusercontent.com/AUTOMATIC1111/stable-diffusion-webui-extensions/master/index.json'; -const console = require('console'); - -const headers = { - 'content-type': 'application/json', - 'accept': 'application/vnd.github.v3+json', - 'user-agent': 'nodejs/fetch', -}; - -let logger = new console.Console({ - stdout: process.stdout, - stderr: process.stderr, - ignoreErrors: true, - inspectOptions: { - showHidden: false, - depth: 5, - colors: true, - showProxy: true, - maxArrayLength: 1024, - maxStringLength: 10240, - breakLength: process.stdout.columns, - compact: 64, - sorted: false, - getters: false, - } -}); - -const log = (...args) => logger.log(...args); - -const http = async (url) => { - try { - const res = await fetch(url, { method: 'GET', headers }) - if (res.status !== 200) { - const limit = parseInt(res.headers.get('x-ratelimit-remaining') || '0'); - if (limit === 0) log(`ratelimit: ${url}`, new Date(1000 * parseInt(res.headers.get('x-ratelimit-reset')))); - else log(`error: ${res.status} ${res.statusText} ${url}`) - return {}; - } - const text = await res.text(); - const json = JSON.parse(text); - return json; - } catch (e) { - log(`exception: ${e} ${url}`) - return {}; - } -}; - -const head = async (url) => { - let json = {}; - const res = await fetch(url, { method: 'GET', headers }) - if (res.status !== 200) return {}; - for (const h of res.headers) json[h[0]] = h[1]; - return json; -}; - -async function getDetails(extension) { - return new Promise(async (resolve) => { - let name = extension.url.replace('https://github.com/', ''); - if (name.endsWith('.git')) name = name.replace('.git', ''); - const ext = { - name: extension.name, - url: extension.url, - description: extension.description.substring(0, 64), - tags: extension.tags, - added: new Date(extension.added), - } - if (ext.tags.includes('localization')) resolve(ext); // don't fetch details for localization tags - else { - const r = await http(`https://api.github.com/repos/${name}`); - if (!r.full_name) resolve(ext); - else { - ext.created = new Date(r.created_at); - ext.updated = new Date(r.pushed_at); - ext.name = r.full_name; - ext.description = (r.description || extension.description).substring(0, 96); - ext.size = r.size; - ext.stars = r.stargazers_count; - ext.issues = r.open_issues_count; - const h = await head(`https://api.github.com/repos/${r.full_name}/commits?per_page=1`); // get headers - const commits = parseInt(h.link?.match(/\d+/g).pop() || '0'); // extract total commit count from pagination data - ext.commits = commits; - // const c = await http(`https://api.github.com/repos/${r.full_name}/traffic/clones?per=week`); // not allowed for non-owners - // const clones = c.clones?.map((c) => c.count).reduce((avg, value, _, { length }) => avg + value / length, 0) || 0; - // ext.clones: Math.round(clones), - resolve(ext); - } - } - }) -} - -async function main() { - // const repos = await githubRepositories(); - if (process.env.GITHUB_TOKEN) { - log('using github token'); - headers['authorization'] = `token ${process.env.GITHUB_TOKEN}`; - } else { - log('no github token set so low rate limiting will apply'); - } - log(`fetching extensions index: ${URL}`) - const index = await http(URL); - const extensions = index?.extensions || []; - log(`analyzing extensions: ${extensions.length}`) - - const promises = []; - for (const e of extensions) { - ext = getDetails(e); - promises.push(ext); - } - let details = await Promise.all(promises); - - const word = process.argv[2] - if (word) { - if (details[0][word]) { - log('sorting by field:', word); - details.sort((a, b) => b[word] - a[word]); - } else if (Object.keys(index?.tags || {}).includes(word)) { - log('filtering by tag:', word); - details = details.filter((a) => a.tags.includes(word)); - } else { - log('filtering by keyword:', word); - details = details.filter((a) => (a.name.includes(word) || a.description.includes(word))); - } - } - details.length = Math.min(parseInt(process.argv[3] || 100000), details.length); - log('extensions:'); - for (const ext of details) log(ext); -} - -main(); diff --git a/extensions-builtin/sd-extension-system-info b/extensions-builtin/sd-extension-system-info index b4bac45a9..687bfc2be 160000 --- a/extensions-builtin/sd-extension-system-info +++ b/extensions-builtin/sd-extension-system-info @@ -1 +1 @@ -Subproject commit b4bac45a9bf38008651a070518f3b5aa871c6e99 +Subproject commit 687bfc2be7291a63d78c72c08c9f263b3cc4d47d diff --git a/extensions-builtin/stable-diffusion-webui-images-browser b/extensions-builtin/stable-diffusion-webui-images-browser index 766b6bd42..4b9755bb9 160000 --- a/extensions-builtin/stable-diffusion-webui-images-browser +++ b/extensions-builtin/stable-diffusion-webui-images-browser @@ -1 +1 @@ -Subproject commit 766b6bd4279d3336089a4163731cf01073470d1e +Subproject commit 4b9755bb946ddcce4b89021271504f032f59f9ec diff --git a/launch.py b/launch.py index 0420c468c..cb0601155 100644 --- a/launch.py +++ b/launch.py @@ -9,6 +9,7 @@ import json from modules import cmd_args from modules.paths_internal import script_path, extensions_dir +from rich import print commandline_args = os.environ.get('COMMANDLINE_ARGS', "") sys.argv += shlex.split(commandline_args) @@ -173,12 +174,13 @@ def run_extension_installer(extension_dir): return try: + print('Running extension installer:', path_installer) env = os.environ.copy() env['PYTHONPATH'] = os.path.abspath(".") stdout = run(f'"{python}" "{path_installer}"', errdesc=f"Error running install.py for extension {extension_dir}", custom_env=env) - if stdout is not None: - print(stdout) + if stdout is not None and len(stdout) > 0: + print('A', stdout) except Exception as e: print(e, file=sys.stderr) diff --git a/modules/lora b/modules/lora index 8eb60baf3..b5c60d7d6 160000 --- a/modules/lora +++ b/modules/lora @@ -1 +1 @@ -Subproject commit 8eb60baf3a920fb83a862d95fbfc73d1d19b7b31 +Subproject commit b5c60d7d62d6bb4a174ac09327dc517fc4446523 diff --git a/modules/sd_models.py b/modules/sd_models.py index 524e8ab91..522edb6f2 100644 --- a/modules/sd_models.py +++ b/modules/sd_models.py @@ -123,12 +123,14 @@ def list_models(): shared.opts.data['sd_model_checkpoint'] = checkpoint_info.title elif cmd_ckpt is not None and cmd_ckpt != shared.default_sd_model_file: - print(f"Checkpoint in --ckpt argument not found (Possible it was moved to {model_path}: {cmd_ckpt}", file=sys.stderr) + print("Checkpoint in --ckpt argument not found", file=sys.stderr) for filename in sorted(model_list, key=str.lower): checkpoint_info = CheckpointInfo(filename) checkpoint_info.register() + print('Available models:', len(checkpoints_list)) + def get_closet_checkpoint_match(search_string): checkpoint_info = checkpoint_alisases.get(search_string, None)