multimodalart HF Staff commited on
Commit
523314a
·
verified ·
1 Parent(s): f9b1863

fix auth token

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -118,7 +118,7 @@ def get_resolution(resolution):
118
  def load_models(model_path, enable_compile=False, attention_backend="native"):
119
  print(f"Loading models from {model_path}...")
120
 
121
- use_auth_token = HF_TOKEN if HF_TOKEN else True
122
 
123
  if not os.path.exists(model_path):
124
  vae = AutoencoderKL.from_pretrained(
@@ -126,7 +126,7 @@ def load_models(model_path, enable_compile=False, attention_backend="native"):
126
  subfolder="vae",
127
  torch_dtype=torch.bfloat16,
128
  device_map="cuda",
129
- use_auth_token=use_auth_token,
130
  )
131
 
132
  text_encoder = AutoModelForCausalLM.from_pretrained(
@@ -134,10 +134,10 @@ def load_models(model_path, enable_compile=False, attention_backend="native"):
134
  subfolder="text_encoder",
135
  torch_dtype=torch.bfloat16,
136
  device_map="cuda",
137
- use_auth_token=use_auth_token,
138
  ).eval()
139
 
140
- tokenizer = AutoTokenizer.from_pretrained(f"{model_path}", subfolder="tokenizer", use_auth_token=use_auth_token)
141
  else:
142
  vae = AutoencoderKL.from_pretrained(
143
  os.path.join(model_path, "vae"), torch_dtype=torch.bfloat16, device_map="cuda"
@@ -170,7 +170,7 @@ def load_models(model_path, enable_compile=False, attention_backend="native"):
170
 
171
  if not os.path.exists(model_path):
172
  transformer = ZImageTransformer2DModel.from_pretrained(
173
- f"{model_path}", subfolder="transformer", use_auth_token=use_auth_token
174
  ).to("cuda", torch.bfloat16)
175
  else:
176
  transformer = ZImageTransformer2DModel.from_pretrained(os.path.join(model_path, "transformer")).to(
 
118
  def load_models(model_path, enable_compile=False, attention_backend="native"):
119
  print(f"Loading models from {model_path}...")
120
 
121
+ token = HF_TOKEN if HF_TOKEN else True
122
 
123
  if not os.path.exists(model_path):
124
  vae = AutoencoderKL.from_pretrained(
 
126
  subfolder="vae",
127
  torch_dtype=torch.bfloat16,
128
  device_map="cuda",
129
+ token=token,
130
  )
131
 
132
  text_encoder = AutoModelForCausalLM.from_pretrained(
 
134
  subfolder="text_encoder",
135
  torch_dtype=torch.bfloat16,
136
  device_map="cuda",
137
+ token=token,
138
  ).eval()
139
 
140
+ tokenizer = AutoTokenizer.from_pretrained(f"{model_path}", subfolder="tokenizer", token=token)
141
  else:
142
  vae = AutoencoderKL.from_pretrained(
143
  os.path.join(model_path, "vae"), torch_dtype=torch.bfloat16, device_map="cuda"
 
170
 
171
  if not os.path.exists(model_path):
172
  transformer = ZImageTransformer2DModel.from_pretrained(
173
+ f"{model_path}", subfolder="transformer", token=token
174
  ).to("cuda", torch.bfloat16)
175
  else:
176
  transformer = ZImageTransformer2DModel.from_pretrained(os.path.join(model_path, "transformer")).to(