Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -18,7 +18,6 @@ snapshot_download(
|
|
| 18 |
repo_id="Alpha-VLLM/Lumina-Image-2.0", local_dir="/home/user/app/checkpoints"
|
| 19 |
)
|
| 20 |
|
| 21 |
-
hf_token = os.environ["HF_TOKEN"]
|
| 22 |
|
| 23 |
|
| 24 |
import argparse
|
|
@@ -118,16 +117,16 @@ def model_main(args, master_port, rank, request_queue, response_queue, mp_barrie
|
|
| 118 |
dtype = {"bf16": torch.bfloat16, "fp16": torch.float16, "fp32": torch.float32}[args.precision]
|
| 119 |
|
| 120 |
text_encoder = AutoModel.from_pretrained(
|
| 121 |
-
|
| 122 |
).eval()
|
| 123 |
cap_feat_dim = text_encoder.config.hidden_size
|
| 124 |
if args.num_gpus > 1:
|
| 125 |
raise NotImplementedError("Inference with >1 GPUs not yet supported")
|
| 126 |
|
| 127 |
-
tokenizer = AutoTokenizer.from_pretrained(
|
| 128 |
tokenizer.padding_side = "right"
|
| 129 |
|
| 130 |
-
vae = AutoencoderKL.from_pretrained("
|
| 131 |
|
| 132 |
print(f"Creating DiT: {train_args.model}")
|
| 133 |
|
|
|
|
| 18 |
repo_id="Alpha-VLLM/Lumina-Image-2.0", local_dir="/home/user/app/checkpoints"
|
| 19 |
)
|
| 20 |
|
|
|
|
| 21 |
|
| 22 |
|
| 23 |
import argparse
|
|
|
|
| 117 |
dtype = {"bf16": torch.bfloat16, "fp16": torch.float16, "fp32": torch.float32}[args.precision]
|
| 118 |
|
| 119 |
text_encoder = AutoModel.from_pretrained(
|
| 120 |
+
"google/gemma-2-2b", torch_dtype=dtype, device_map="cuda", token=args.hf_token
|
| 121 |
).eval()
|
| 122 |
cap_feat_dim = text_encoder.config.hidden_size
|
| 123 |
if args.num_gpus > 1:
|
| 124 |
raise NotImplementedError("Inference with >1 GPUs not yet supported")
|
| 125 |
|
| 126 |
+
tokenizer = AutoTokenizer.from_pretrained("google/gemma-2-2b", token=args.hf_token)
|
| 127 |
tokenizer.padding_side = "right"
|
| 128 |
|
| 129 |
+
vae = AutoencoderKL.from_pretrained("black-forest-labs/FLUX.1-dev", subfolder="vae", token=args.hf_token).cuda()
|
| 130 |
|
| 131 |
print(f"Creating DiT: {train_args.model}")
|
| 132 |
|