ginipick commited on
Commit
6b9a48e
·
verified ·
1 Parent(s): 9fd5050

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -13
app.py CHANGED
@@ -21,7 +21,6 @@ from transformers import T5EncoderModel, T5Tokenizer
21
  from transformers import pipeline, AutoTokenizer, MarianMTModel
22
 
23
 
24
-
25
  class HFEmbedder(nn.Module):
26
  def __init__(self, version: str, max_length: int, **hf_kwargs):
27
  super().__init__()
@@ -55,7 +54,6 @@ class HFEmbedder(nn.Module):
55
  output_hidden_states=False,
56
  )
57
  return outputs[self.output_key]
58
-
59
 
60
  device = "cuda"
61
  t5 = HFEmbedder("DeepFloyd/t5-v1_1-xxl", max_length=512, torch_dtype=torch.bfloat16).to(device)
@@ -65,9 +63,6 @@ ae = AutoencoderKL.from_pretrained("black-forest-labs/FLUX.1-dev", subfolder="va
65
  # freeze(t5)
66
 
67
 
68
- # ---------------- NF4 ----------------
69
-
70
-
71
  def functional_linear_4bits(x, weight, bias):
72
  out = bnb.matmul_4bit(x, weight.t(), bias=bias, quant_state=weight.quant_state)
73
  out = out.to(x)
@@ -205,9 +200,6 @@ class Linear(ForgeLoader4Bit):
205
  nn.Linear = Linear
206
 
207
 
208
- # ---------------- Model ----------------
209
-
210
-
211
  def attention(q: Tensor, k: Tensor, v: Tensor, pe: Tensor) -> Tensor:
212
  q, k = apply_rope(q, k, pe)
213
 
@@ -732,8 +724,6 @@ def get_image(image) -> torch.Tensor | None:
732
  return img[None, ...]
733
 
734
 
735
- # ---------------- Demo ----------------
736
-
737
 
738
  from huggingface_hub import hf_hub_download
739
  from safetensors.torch import load_file
@@ -744,9 +734,6 @@ model = Flux().to(dtype=torch.bfloat16, device="cuda")
744
  result = model.load_state_dict(sd)
745
  model_zero_init = False
746
 
747
- # model = Flux().to(dtype=torch.bfloat16, device="cuda")
748
- # result = model.load_state_dict(load_file("/storage/dev/nyanko/flux-dev/flux1-dev.sft"))
749
-
750
 
751
  # 언어-모델 매핑 딕셔너리 추가
752
  TRANSLATORS = {
@@ -926,6 +913,8 @@ footer {
926
 
927
  def create_demo():
928
  with gr.Blocks(theme="Yntec/HaleyCH_Theme_Orange", css=css) as demo:
 
 
929
  with gr.Row():
930
  with gr.Column():
931
  source_lang = gr.Dropdown(
 
21
  from transformers import pipeline, AutoTokenizer, MarianMTModel
22
 
23
 
 
24
  class HFEmbedder(nn.Module):
25
  def __init__(self, version: str, max_length: int, **hf_kwargs):
26
  super().__init__()
 
54
  output_hidden_states=False,
55
  )
56
  return outputs[self.output_key]
 
57
 
58
  device = "cuda"
59
  t5 = HFEmbedder("DeepFloyd/t5-v1_1-xxl", max_length=512, torch_dtype=torch.bfloat16).to(device)
 
63
  # freeze(t5)
64
 
65
 
 
 
 
66
  def functional_linear_4bits(x, weight, bias):
67
  out = bnb.matmul_4bit(x, weight.t(), bias=bias, quant_state=weight.quant_state)
68
  out = out.to(x)
 
200
  nn.Linear = Linear
201
 
202
 
 
 
 
203
  def attention(q: Tensor, k: Tensor, v: Tensor, pe: Tensor) -> Tensor:
204
  q, k = apply_rope(q, k, pe)
205
 
 
724
  return img[None, ...]
725
 
726
 
 
 
727
 
728
  from huggingface_hub import hf_hub_download
729
  from safetensors.torch import load_file
 
734
  result = model.load_state_dict(sd)
735
  model_zero_init = False
736
 
 
 
 
737
 
738
  # 언어-모델 매핑 딕셔너리 추가
739
  TRANSLATORS = {
 
913
 
914
  def create_demo():
915
  with gr.Blocks(theme="Yntec/HaleyCH_Theme_Orange", css=css) as demo:
916
+ gr.Markdown("# FLUXllama Multilingual(36 Languages")
917
+
918
  with gr.Row():
919
  with gr.Column():
920
  source_lang = gr.Dropdown(