nielsr HF staff fendiprime commited on
Commit
9e697f5
1 Parent(s): d694199

Get model weights from new MSFT URL (#3)

Browse files

- Get model weights from new MSFT URL (811144853ce0cd318009b8e76723a3c9cb0c53d9)


Co-authored-by: Fred <fendiprime@users.noreply.huggingface.co>

Files changed (1) hide show
  1. app.py +2 -1
app.py CHANGED
@@ -1,6 +1,7 @@
1
  import os
2
  os.system('pip install detectron2 -f https://dl.fbaipublicfiles.com/detectron2/wheels/cu102/torch1.9/index.html')
3
  os.system("git clone https://github.com/microsoft/unilm.git")
 
4
 
5
  import sys
6
  sys.path.append("unilm")
@@ -26,7 +27,7 @@ add_vit_config(cfg)
26
  cfg.merge_from_file("cascade_dit_base.yml")
27
 
28
  # Step 2: add model weights URL to config
29
- cfg.MODEL.WEIGHTS = "https://layoutlm.blob.core.windows.net/dit/dit-fts/publaynet_dit-b_cascade.pth"
30
 
31
  # Step 3: set device
32
  cfg.MODEL.DEVICE = "cuda" if torch.cuda.is_available() else "cpu"
 
1
  import os
2
  os.system('pip install detectron2 -f https://dl.fbaipublicfiles.com/detectron2/wheels/cu102/torch1.9/index.html')
3
  os.system("git clone https://github.com/microsoft/unilm.git")
4
+ os.system("curl -LJ -o publaynet_dit-b_cascade.pth 'https://layoutlm.blob.core.windows.net/dit/dit-fts/publaynet_dit-b_cascade.pth?sv=2022-11-02&ss=b&srt=o&sp=r&se=2033-06-08T16:48:15Z&st=2023-06-08T08:48:15Z&spr=https&sig=a9VXrihTzbWyVfaIDlIT1Z0FoR1073VB0RLQUMuudD4%3D'")
5
 
6
  import sys
7
  sys.path.append("unilm")
 
27
  cfg.merge_from_file("cascade_dit_base.yml")
28
 
29
  # Step 2: add model weights URL to config
30
+ cfg.MODEL.WEIGHTS = "publaynet_dit-b_cascade.pth"
31
 
32
  # Step 3: set device
33
  cfg.MODEL.DEVICE = "cuda" if torch.cuda.is_available() else "cpu"