PhyscalX commited on
Commit
4b0f050
1 Parent(s): 5283d70

Add model:nova-d48w1024-sdxl1024

Browse files
Files changed (2) hide show
  1. app.py +4 -4
  2. 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
- device_type = "cuda" if torch.cuda.is_available() else "cpu"
90
- device, dtype = torch.device(device_type, args.device), getattr(torch, args.precision.lower())
91
- pipe = NOVAPipeline.from_pretrained(args.model, torch_dtype=dtype).to(device)
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