Spaces:
Running
on
Zero
Running
on
Zero
Add model:nova-d48w1024-sdxl1024
Browse files- app.py +4 -4
- requirements.txt +1 -0
app.py
CHANGED
@@ -32,7 +32,7 @@ os.environ["PYTORCH_CUDA_ALLOC_CONF"] = "expandable_segments:True"
|
|
32 |
def parse_args():
|
33 |
"""Parse arguments."""
|
34 |
parser = argparse.ArgumentParser(description="Serve NOVA T2I application")
|
35 |
-
parser.add_argument("--model", default="", help="model path")
|
36 |
parser.add_argument("--device", type=int, default=0, help="device index")
|
37 |
parser.add_argument("--precision", default="float16", help="compute precision")
|
38 |
return parser.parse_args()
|
@@ -86,9 +86,9 @@ examples = [
|
|
86 |
if __name__ == "__main__":
|
87 |
args = parse_args()
|
88 |
|
89 |
-
|
90 |
-
|
91 |
-
pipe = NOVAPipeline.from_pretrained(args.model,
|
92 |
|
93 |
# Main Application.
|
94 |
app = gr.Blocks(css=css, theme="origin").__enter__()
|
|
|
32 |
def parse_args():
|
33 |
"""Parse arguments."""
|
34 |
parser = argparse.ArgumentParser(description="Serve NOVA T2I application")
|
35 |
+
parser.add_argument("--model", default="BAAI/nova-d48w1024-sdxl1024", help="model path")
|
36 |
parser.add_argument("--device", type=int, default=0, help="device index")
|
37 |
parser.add_argument("--precision", default="float16", help="compute precision")
|
38 |
return parser.parse_args()
|
|
|
86 |
if __name__ == "__main__":
|
87 |
args = parse_args()
|
88 |
|
89 |
+
device = torch.device("cuda" if torch.cuda.is_available() else "cpu", args.device)
|
90 |
+
model_args = {"torch_dtype": getattr(torch, args.precision.lower()), "trust_remote_code": True}
|
91 |
+
pipe = NOVAPipeline.from_pretrained(args.model, **model_args).to(device)
|
92 |
|
93 |
# Main Application.
|
94 |
app = gr.Blocks(css=css, theme="origin").__enter__()
|
requirements.txt
CHANGED
@@ -1,3 +1,4 @@
|
|
|
|
1 |
torch
|
2 |
diffusers
|
3 |
transformers
|
|
|
1 |
+
einops
|
2 |
torch
|
3 |
diffusers
|
4 |
transformers
|