Upload src/pipeline.py with huggingface_hub
Browse files- src/pipeline.py +5 -4
src/pipeline.py
CHANGED
|
@@ -30,9 +30,10 @@ REVISION = "5ef0012f11a863e5111ec56540302a023bc8587b"
|
|
| 30 |
TinyVAE = "madebyollin/taef1"
|
| 31 |
TinyVAE_REV = "2d552378e58c9c94201075708d7de4e1163b2689"
|
| 32 |
|
| 33 |
-
|
| 34 |
def load_pipeline() -> Pipeline:
|
| 35 |
-
path = os.path.join(HF_HUB_CACHE, "models--jokerbit--flux.1-schnell-Robert-int8wo/snapshots/5ef0012f11a863e5111ec56540302a023bc8587b/transformer")
|
|
|
|
| 36 |
transformer = FluxTransformer2DModel.from_pretrained(
|
| 37 |
path,
|
| 38 |
use_safetensors=False,
|
|
@@ -57,10 +58,10 @@ def load_pipeline() -> Pipeline:
|
|
| 57 |
|
| 58 |
for _ in range(4):
|
| 59 |
pipeline(prompt="onomancy, aftergo, spirantic, Platyhelmia, modificator, drupaceous, jobbernowl, hereness", width=1024, height=1024, guidance_scale=0.0, num_inference_steps=4, max_sequence_length=256)
|
| 60 |
-
|
| 61 |
return pipeline
|
| 62 |
|
| 63 |
-
@torch.inference_mode()
|
| 64 |
def infer(request: TextToImageRequest, pipeline: Pipeline, generator: torch.Generator) -> Image:
|
| 65 |
|
| 66 |
return pipeline(
|
|
|
|
| 30 |
TinyVAE = "madebyollin/taef1"
|
| 31 |
TinyVAE_REV = "2d552378e58c9c94201075708d7de4e1163b2689"
|
| 32 |
|
| 33 |
+
# @torch.inference_mode()
|
| 34 |
def load_pipeline() -> Pipeline:
|
| 35 |
+
# path = os.path.join(HF_HUB_CACHE, "models--jokerbit--flux.1-schnell-Robert-int8wo/snapshots/5ef0012f11a863e5111ec56540302a023bc8587b/transformer")
|
| 36 |
+
path = os.path.join(HF_HUB_CACHE, "models--RobertML--FLUX.1-schnell-int8wo/snapshots/307e0777d92df966a3c0f99f31a6ee8957a9857a")
|
| 37 |
transformer = FluxTransformer2DModel.from_pretrained(
|
| 38 |
path,
|
| 39 |
use_safetensors=False,
|
|
|
|
| 58 |
|
| 59 |
for _ in range(4):
|
| 60 |
pipeline(prompt="onomancy, aftergo, spirantic, Platyhelmia, modificator, drupaceous, jobbernowl, hereness", width=1024, height=1024, guidance_scale=0.0, num_inference_steps=4, max_sequence_length=256)
|
| 61 |
+
torch.cuda.empty_cache()
|
| 62 |
return pipeline
|
| 63 |
|
| 64 |
+
# @torch.inference_mode()
|
| 65 |
def infer(request: TextToImageRequest, pipeline: Pipeline, generator: torch.Generator) -> Image:
|
| 66 |
|
| 67 |
return pipeline(
|