Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -30,7 +30,7 @@ translator = pipeline("translation", model="Helsinki-NLP/opus-mt-ko-en")
|
|
| 30 |
class HFEmbedder(nn.Module):
|
| 31 |
def __init__(self, version: str, max_length: int, **hf_kwargs):
|
| 32 |
super().__init__()
|
| 33 |
-
self.is_clip = version.startswith("
|
| 34 |
self.max_length = max_length
|
| 35 |
self.output_key = "pooler_output" if self.is_clip else "last_hidden_state"
|
| 36 |
|
|
@@ -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.
|
| 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)
|
|
|
|
| 30 |
class HFEmbedder(nn.Module):
|
| 31 |
def __init__(self, version: str, max_length: int, **hf_kwargs):
|
| 32 |
super().__init__()
|
| 33 |
+
self.is_clip = version.startswith("silveroxides")
|
| 34 |
self.max_length = max_length
|
| 35 |
self.output_key = "pooler_output" if self.is_clip else "last_hidden_state"
|
| 36 |
|
|
|
|
| 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)
|