Spaces:
Running
on
Zero
Running
on
Zero
ZhouwqZJ
commited on
Commit
·
c241698
1
Parent(s):
c0c5193
modified: app.py
Browse files
app.py
CHANGED
|
@@ -39,6 +39,7 @@ def encode(init_image, torch_device, ae):
|
|
| 39 |
init_image = init_image.to(torch_device)
|
| 40 |
with torch.no_grad():
|
| 41 |
init_image = ae.encode(init_image.to()).to(torch.bfloat16)
|
|
|
|
| 42 |
return init_image
|
| 43 |
|
| 44 |
|
|
@@ -539,7 +540,7 @@ if __name__ == "__main__":
|
|
| 539 |
parser = argparse.ArgumentParser(description="Flux")
|
| 540 |
parser.add_argument("--name", type=str, default="flux-dev", choices=list(configs.keys()), help="Model name")
|
| 541 |
parser.add_argument("--device", type=str, default="cuda" if torch.cuda.is_available() else "cpu", help="Device to use")
|
| 542 |
-
parser.add_argument("--offload",
|
| 543 |
parser.add_argument("--share", action="store_true", help="Create a public link to your demo")
|
| 544 |
parser.add_argument("--port", type=int, default=9090)
|
| 545 |
args = parser.parse_args()
|
|
|
|
| 39 |
init_image = init_image.to(torch_device)
|
| 40 |
with torch.no_grad():
|
| 41 |
init_image = ae.encode(init_image.to()).to(torch.bfloat16)
|
| 42 |
+
init_image = init_image.to(torch_device)
|
| 43 |
return init_image
|
| 44 |
|
| 45 |
|
|
|
|
| 540 |
parser = argparse.ArgumentParser(description="Flux")
|
| 541 |
parser.add_argument("--name", type=str, default="flux-dev", choices=list(configs.keys()), help="Model name")
|
| 542 |
parser.add_argument("--device", type=str, default="cuda" if torch.cuda.is_available() else "cpu", help="Device to use")
|
| 543 |
+
parser.add_argument("--offload", default=False, help="Offload model to CPU when not in use")
|
| 544 |
parser.add_argument("--share", action="store_true", help="Create a public link to your demo")
|
| 545 |
parser.add_argument("--port", type=int, default=9090)
|
| 546 |
args = parser.parse_args()
|