Skip to content

Commit

Permalink
Stack the enter and build decorators for the flux example (#845)
Browse files Browse the repository at this point in the history
* Stack the enter and build decorators for the flux example

* Format
  • Loading branch information
advay-modal authored Aug 17, 2024
1 parent 89a6c60 commit fbe6466
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions 06_gpu_and_ml/stable_diffusion/flux.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,12 @@
image=flux_image,
)
class Model:
@modal.build()
def build(self):
@modal.enter()
def enter(self):
from huggingface_hub import snapshot_download

snapshot_download(f"black-forest-labs/FLUX.1-{VARIANT}")

@modal.enter()
def enter(self):
self.pipe = FluxPipeline.from_pretrained(
f"black-forest-labs/FLUX.1-{VARIANT}", torch_dtype=torch.bfloat16
)
Expand Down

0 comments on commit fbe6466

Please sign in to comment.