rnwang commited on
Commit
f9cae44
·
1 Parent(s): 62dd104

update model weight

Browse files
app.py CHANGED
@@ -50,11 +50,15 @@ from torch.utils.data import DataLoader
50
  from pathlib import Path
51
  from torch.utils.data import Dataset
52
  import datetime
 
53
 
54
 
55
  device = 'cpu'
56
  dtype = torch.float32
57
- generator = torch.load("models/generator.pt")
 
 
 
58
  generator.eval()
59
  generator.to(device, dtype)
60
  params = {'batch_size': 1,
@@ -158,14 +162,14 @@ with demo:
158
  The video on the right shows how the user can easily enable quantization using BigDL-Nano (with just a couple of lines of code); you may refer to our [CVPR 2022 demo paper](https://arxiv.org/abs/2204.01715) for more details.
159
  ''')
160
  with gr.Column():
161
- gr.Video(value="nano_quantize_api.mp4")
162
  gr.Markdown('''
163
  <h2>Demo</h2>
164
 
165
  This section uses an image stylization example to demostrate the speedup of the above code when using quantization in BigDL-Nano (about 2~3x inference time speedup). The demo is adapted from the original [FSPBT-Image-Translation code](https://github.com/rnwzd/FSPBT-Image-Translation).
166
  ''')
167
  with gr.Row().style(equal_height=False):
168
- input_img = gr.Image(label="input image", value="Marvelous_Maisel.jpg", source="upload")
169
  with gr.Column():
170
  ori_but = gr.Button("Standard PyTorch Lightning")
171
  nano_but = gr.Button("BigDL-Nano")
 
50
  from pathlib import Path
51
  from torch.utils.data import Dataset
52
  import datetime
53
+ import huggingface_hub
54
 
55
 
56
  device = 'cpu'
57
  dtype = torch.float32
58
+ MODEL_REPO = 'CVPR/generator'
59
+ ckpt_path = huggingface_hub.hf_hub_download(
60
+ MODEL_REPO, f'generator.pt')
61
+ generator = torch.load(ckpt_path)
62
  generator.eval()
63
  generator.to(device, dtype)
64
  params = {'batch_size': 1,
 
162
  The video on the right shows how the user can easily enable quantization using BigDL-Nano (with just a couple of lines of code); you may refer to our [CVPR 2022 demo paper](https://arxiv.org/abs/2204.01715) for more details.
163
  ''')
164
  with gr.Column():
165
+ gr.Video(value="data/nano_quantize_api.mp4")
166
  gr.Markdown('''
167
  <h2>Demo</h2>
168
 
169
  This section uses an image stylization example to demostrate the speedup of the above code when using quantization in BigDL-Nano (about 2~3x inference time speedup). The demo is adapted from the original [FSPBT-Image-Translation code](https://github.com/rnwzd/FSPBT-Image-Translation).
170
  ''')
171
  with gr.Row().style(equal_height=False):
172
+ input_img = gr.Image(label="input image", value="data/Marvelous_Maisel.jpg", source="upload")
173
  with gr.Column():
174
  ori_but = gr.Button("Standard PyTorch Lightning")
175
  nano_but = gr.Button("BigDL-Nano")
Marvelous_Maisel.jpg → data/Marvelous_Maisel.jpg RENAMED
File without changes
nano_quantize_api.mp4 → data/nano_quantize_api.mp4 RENAMED
File without changes
models/generator.pt DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:975fa3b0d37bb3a019930258b52d64b8e575982069905580ac62762f2c8310d1
3
- size 12813658