Spaces:
Running on Zero
Running on Zero
Use transformers 5 (hub>=1 for gradio 6)
Browse files- app.py +3 -3
- requirements.txt +1 -1
app.py
CHANGED
|
@@ -165,14 +165,14 @@ t0 = time.time()
|
|
| 165 |
transformer_high = build_expert("high_noise_model/diffusion_pytorch_model.safetensors", "duoedit_high_noise.safetensors")
|
| 166 |
transformer_low = build_expert("low_noise_model/diffusion_pytorch_model.safetensors", "duoedit_low_noise.safetensors")
|
| 167 |
tokenizer = AutoTokenizer.from_pretrained(COMPONENTS_ID, subfolder="tokenizer")
|
| 168 |
-
text_encoder = UMT5EncoderModel.from_pretrained(COMPONENTS_ID, subfolder="text_encoder",
|
| 169 |
vae = AutoencoderKLWan.from_pretrained(COMPONENTS_ID, subfolder="vae", torch_dtype=torch.float32).to(DEVICE).eval()
|
| 170 |
LAT_MEAN = torch.tensor(vae.config.latents_mean).view(1, 16, 1, 1, 1)
|
| 171 |
LAT_STD = torch.tensor(vae.config.latents_std).view(1, 16, 1, 1, 1)
|
| 172 |
|
| 173 |
sam_processor = Sam2VideoProcessor.from_pretrained(SAM2_ID)
|
| 174 |
-
sam_model = Sam2VideoModel.from_pretrained(SAM2_ID,
|
| 175 |
-
birefnet = AutoModelForImageSegmentation.from_pretrained(BIREFNET_ID, trust_remote_code=True).to(DEVICE).eval()
|
| 176 |
print(f"[load] all models ready in {time.time() - t0:.0f}s", flush=True)
|
| 177 |
|
| 178 |
BIREF_TF = transforms.Compose(
|
|
|
|
| 165 |
transformer_high = build_expert("high_noise_model/diffusion_pytorch_model.safetensors", "duoedit_high_noise.safetensors")
|
| 166 |
transformer_low = build_expert("low_noise_model/diffusion_pytorch_model.safetensors", "duoedit_low_noise.safetensors")
|
| 167 |
tokenizer = AutoTokenizer.from_pretrained(COMPONENTS_ID, subfolder="tokenizer")
|
| 168 |
+
text_encoder = UMT5EncoderModel.from_pretrained(COMPONENTS_ID, subfolder="text_encoder", dtype=DTYPE).to(DEVICE).eval()
|
| 169 |
vae = AutoencoderKLWan.from_pretrained(COMPONENTS_ID, subfolder="vae", torch_dtype=torch.float32).to(DEVICE).eval()
|
| 170 |
LAT_MEAN = torch.tensor(vae.config.latents_mean).view(1, 16, 1, 1, 1)
|
| 171 |
LAT_STD = torch.tensor(vae.config.latents_std).view(1, 16, 1, 1, 1)
|
| 172 |
|
| 173 |
sam_processor = Sam2VideoProcessor.from_pretrained(SAM2_ID)
|
| 174 |
+
sam_model = Sam2VideoModel.from_pretrained(SAM2_ID, dtype=DTYPE).to(DEVICE).eval()
|
| 175 |
+
birefnet = AutoModelForImageSegmentation.from_pretrained(BIREFNET_ID, trust_remote_code=True).float().to(DEVICE).eval()
|
| 176 |
print(f"[load] all models ready in {time.time() - t0:.0f}s", flush=True)
|
| 177 |
|
| 178 |
BIREF_TF = transforms.Compose(
|
requirements.txt
CHANGED
|
@@ -2,7 +2,7 @@ torch==2.11.0
|
|
| 2 |
torchvision==0.26.0
|
| 3 |
torchao==0.17.0
|
| 4 |
diffusers
|
| 5 |
-
transformers
|
| 6 |
accelerate
|
| 7 |
safetensors
|
| 8 |
sentencepiece
|
|
|
|
| 2 |
torchvision==0.26.0
|
| 3 |
torchao==0.17.0
|
| 4 |
diffusers
|
| 5 |
+
transformers
|
| 6 |
accelerate
|
| 7 |
safetensors
|
| 8 |
sentencepiece
|