silveroxides commited on
Commit
1f21b40
Β·
verified Β·
1 Parent(s): a4884af

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -63,7 +63,7 @@ class HFEmbedder(nn.Module):
63
 
64
 
65
  device = "cuda"
66
- t5 = HFEmbedder("silveroxides/t5xxl_flan_enc", max_length=512, torch_dtype=torch.float16).to(device)
67
  clip = HFEmbedder("silveroxides/clip-vit-large-patch14", max_length=77, torch_dtype=torch.bfloat16).to(device)
68
  ae = AutoencoderKL.from_pretrained("black-forest-labs/FLUX.1-dev", subfolder="vae", torch_dtype=torch.bfloat16).to(device)
69
  # quantize(t5, weights=qfloat8)
@@ -743,7 +743,7 @@ def get_image(image) -> torch.Tensor | None:
743
  from huggingface_hub import hf_hub_download
744
  from safetensors.torch import load_file
745
 
746
- sd = load_file(hf_hub_download(repo_id="lllyasviel/flux1-dev-bnb-nf4", filename="flux1-dev-bnb-nf4-v2.safetensors"))
747
  sd = {k.replace("model.diffusion_model.", ""): v for k, v in sd.items() if "model.diffusion_model" in k}
748
  model = Flux().to(dtype=torch.bfloat16, device="cuda")
749
  result = model.load_state_dict(sd)
 
63
 
64
 
65
  device = "cuda"
66
+ t5 = HFEmbedder("silveroxides/t5xxl_flan_enc", max_length=512, torch_dtype=torch.bfloat16).to(device)
67
  clip = HFEmbedder("silveroxides/clip-vit-large-patch14", max_length=77, torch_dtype=torch.bfloat16).to(device)
68
  ae = AutoencoderKL.from_pretrained("black-forest-labs/FLUX.1-dev", subfolder="vae", torch_dtype=torch.bfloat16).to(device)
69
  # quantize(t5, weights=qfloat8)
 
743
  from huggingface_hub import hf_hub_download
744
  from safetensors.torch import load_file
745
 
746
+ sd = load_file(hf_hub_download(repo_id="silveroxides/flux1-nf4-unet", filename="chromafur-alpha_diffusion_model-nf4.safetensors"))
747
  sd = {k.replace("model.diffusion_model.", ""): v for k, v in sd.items() if "model.diffusion_model" in k}
748
  model = Flux().to(dtype=torch.bfloat16, device="cuda")
749
  result = model.load_state_dict(sd)