diff --git a/CHANGELOG.md b/CHANGELOG.md index 3ad139f0e..0167d5509 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -32,6 +32,7 @@ - **Model loader** improvements: - detect model components on model load fail + - allow passing absolute path to model loader - Flux, SD35: force unload model - Flux: apply `bnb` quant when loading *unet/transformer* - Flux: all-in-one safetensors diff --git a/cli/api-model.js b/cli/api-model.js new file mode 100755 index 000000000..e2ce5344a --- /dev/null +++ b/cli/api-model.js @@ -0,0 +1,30 @@ +#!/usr/bin/env node + +const sd_url = process.env.SDAPI_URL || 'http://127.0.0.1:7860'; +const sd_username = process.env.SDAPI_USR; +const sd_password = process.env.SDAPI_PWD; +const models = [ + '/mnt/models/stable-diffusion/sd15/lyriel_v16.safetensors', + '/mnt/models/stable-diffusion/flux/flux-finesse_v2-f1h-fp8.safetensors', + '/mnt/models/stable-diffusion/sdxl/TempestV0.1-Artistic.safetensors', +]; + +async function options(data) { + const method = 'POST'; + const headers = new Headers(); + const body = JSON.stringify(data); + headers.set('Content-Type', 'application/json'); + if (sd_username && sd_password) headers.set({ Authorization: `Basic ${btoa('sd_username:sd_password')}` }); + const res = await fetch(`${sd_url}/sdapi/v1/options`, { method, headers, body }); + return res; +} + +async function main() { + for (const model of models) { + console.log('model:', model); + const res = await options({ sd_model_checkpoint: model }); + console.log('result:', res); + } +} + +main(); diff --git a/cli/full-test.sh b/cli/full-test.sh index e410528ad..912dc3a5b 100755 --- a/cli/full-test.sh +++ b/cli/full-test.sh @@ -1,5 +1,8 @@ #!/usr/bin/env bash +node cli/api-txt2img.js +node cli/api-pulid.js + source venv/bin/activate echo image-exif python cli/api-info.py --input html/logo-bg-0.jpg diff --git a/launch.py b/launch.py index f944a7e54..e00da58c7 100755 --- a/launch.py +++ b/launch.py @@ -55,9 +55,11 @@ def get_custom_args(): if 'PS1' in env: del env['PS1'] installer.log.trace(f'Environment: {installer.print_dict(env)}') - else: - env = [f'{k}={v}' for k, v in os.environ.items() if k.startswith('SD_')] - installer.log.debug(f'Env flags: {env}') + env = [f'{k}={v}' for k, v in os.environ.items() if k.startswith('SD_')] + installer.log.debug(f'Env flags: {env}') + ldd = os.environ.get('LD_PRELOAD', None) + if ldd is not None: + installer.log.debug(f'Linker flags: "{ldd}"') @lru_cache() diff --git a/modules/sd_checkpoint.py b/modules/sd_checkpoint.py index 20654e28b..e035fc3db 100644 --- a/modules/sd_checkpoint.py +++ b/modules/sd_checkpoint.py @@ -188,6 +188,11 @@ def get_closet_checkpoint_match(s: str): if found and len(found) == 1: return found[0] + # absolute path + if s.endswith('.safetensors') and os.path.isfile(s): + checkpoint_info = CheckpointInfo(s) + return checkpoint_info + # reference search """ found = sorted([info for info in shared.reference_models.values() if os.path.basename(info['path']).lower().startswith(s.lower())], key=lambda x: len(x['path'])) diff --git a/wiki b/wiki index ba7d78b55..441d2c4e1 160000 --- a/wiki +++ b/wiki @@ -1 +1 @@ -Subproject commit ba7d78b55eb95afe8509bd0069b8ec345b259f21 +Subproject commit 441d2c4e19349f0b219948837922e6373347076e