mirror of
https://github.com/vladmandic/automatic
synced 2026-09-20 01:31:13 +02:00
add hf auth checks for flux and sd35
Signed-off-by: Vladimir Mandic <mandic00@live.com>
This commit is contained in:
+2
-2
@@ -7,7 +7,7 @@
|
||||
highly experimental and with limited support, but when it works, its magic: **Flux.1 at 6.0 it/s** *(not sec/it)*!
|
||||
see [Nunchaku Wiki](https://github.com/vladmandic/sdnext/wiki/Nunchaku) for installation guide and list of supported models & features
|
||||
- [LTXVideo 0.9.6](https://github.com/Lightricks/LTX-Video?tab=readme-ov-file) T2V and I2V
|
||||
in both standard and distilled variants
|
||||
in both **Standard** and **Distilled** variants
|
||||
- [CFG-Zero](https://github.com/WeichenFan/CFG-Zero-star) new guidance method optimized for flow-matching models
|
||||
implemented for **FLUX.1, HiDream-I1, SD3.x, CogView4, HunyuanVideo, WanAI**
|
||||
enable and configure in *settings -> pipeline modifiers -> cfg zero*
|
||||
@@ -20,7 +20,7 @@
|
||||
- add explicit offload after encode prompt
|
||||
configure in *settings -> text encoder -> offload*
|
||||
- **Other**
|
||||
- **HiDream** add HF gated access auth check
|
||||
- **HiDream-I1, FLUX.1, SD3.x** add HF gated access auth check
|
||||
- **HiDream** add LLM into to metadata
|
||||
- add **UniPC FlowMatch** scheduler
|
||||
- add **LCM FlowMatch** scheduler
|
||||
|
||||
@@ -44,7 +44,7 @@ def install_nunchaku():
|
||||
arch = platform.system().lower()
|
||||
if arch not in ['linux', 'windows']:
|
||||
log.error(f'Nunchaku: platform={arch} unsupported')
|
||||
return
|
||||
return False
|
||||
if devices.backend not in ['cuda']:
|
||||
log.error(f'Nunchaku: backend={devices.backend} unsupported')
|
||||
return False
|
||||
|
||||
@@ -4,7 +4,7 @@ import torch
|
||||
import diffusers
|
||||
import transformers
|
||||
from safetensors.torch import load_file
|
||||
from huggingface_hub import hf_hub_download
|
||||
from huggingface_hub import hf_hub_download, auth_check
|
||||
from modules import shared, errors, devices, modelloader, sd_models, sd_unet, model_te, model_quant, sd_hijack_te
|
||||
|
||||
|
||||
@@ -202,11 +202,17 @@ def load_transformer(file_path): # triggered by opts.sd_unet change
|
||||
|
||||
|
||||
def load_flux(checkpoint_info, diffusers_load_config): # triggered by opts.sd_checkpoint change
|
||||
prequantized = model_quant.get_quant(checkpoint_info.path)
|
||||
repo_id = sd_models.path_to_repo(checkpoint_info.name)
|
||||
login = modelloader.hf_login()
|
||||
try:
|
||||
auth_check(repo_id)
|
||||
except Exception as e:
|
||||
shared.log.error(f'Load model: repo="{repo_id}" login={login} {e}')
|
||||
return False
|
||||
|
||||
prequantized = model_quant.get_quant(checkpoint_info.path)
|
||||
shared.log.debug(f'Load model: type=FLUX model="{checkpoint_info.name}" repo="{repo_id}" unet="{shared.opts.sd_unet}" te="{shared.opts.sd_text_encoder}" vae="{shared.opts.sd_vae}" quant={prequantized} offload={shared.opts.diffusers_offload_mode} dtype={devices.dtype}')
|
||||
debug(f'Load model: type=FLUX config={diffusers_load_config}')
|
||||
modelloader.hf_login()
|
||||
|
||||
transformer = None
|
||||
text_encoder_1 = None
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import os
|
||||
import transformers
|
||||
import diffusers
|
||||
from huggingface_hub import auth_check
|
||||
from modules import shared, devices, sd_models, model_quant, modelloader, sd_hijack_te
|
||||
|
||||
|
||||
@@ -76,14 +77,12 @@ def load_text_encoders(repo_id, diffusers_load_config={}):
|
||||
|
||||
|
||||
def load_hidream(checkpoint_info, diffusers_load_config={}):
|
||||
login = modelloader.hf_login()
|
||||
repo_id = sd_models.path_to_repo(checkpoint_info.name)
|
||||
|
||||
from huggingface_hub import auth_check
|
||||
login = modelloader.hf_login()
|
||||
try:
|
||||
auth_check(shared.opts.model_h1_llama_repo)
|
||||
auth_check(repo_id)
|
||||
except Exception as e:
|
||||
shared.log.error(f'Load model: type=HiDream te4="{shared.opts.model_h1_llama_repo}" login={login} {e}')
|
||||
shared.log.error(f'Load model: repo="{repo_id}" login={login} {e}')
|
||||
return False
|
||||
|
||||
transformer = load_transformer(repo_id, diffusers_load_config)
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import os
|
||||
import diffusers
|
||||
import transformers
|
||||
from modules import shared, devices, errors, sd_models, sd_unet, model_quant, model_tools
|
||||
from huggingface_hub import auth_check
|
||||
from modules import shared, devices, errors, sd_models, sd_unet, model_quant, model_tools, modelloader
|
||||
|
||||
|
||||
def load_overrides(kwargs, cache_dir):
|
||||
@@ -90,6 +91,13 @@ def load_missing(kwargs, fn, cache_dir):
|
||||
|
||||
def load_sd3(checkpoint_info, cache_dir=None, config=None):
|
||||
repo_id = sd_models.path_to_repo(checkpoint_info.name)
|
||||
login = modelloader.hf_login()
|
||||
try:
|
||||
auth_check(repo_id)
|
||||
except Exception as e:
|
||||
shared.log.error(f'Load model: repo="{repo_id}" login={login} {e}')
|
||||
return False
|
||||
|
||||
fn = checkpoint_info.path
|
||||
|
||||
kwargs = {}
|
||||
|
||||
Reference in New Issue
Block a user