rnwang commited on
Commit
76f4bca
1 Parent(s): 9c13db2

update code for InferenceOptimizer

Browse files
Files changed (2) hide show
  1. app.py +4 -3
  2. requirements.txt +1 -1
app.py CHANGED
@@ -45,7 +45,7 @@ import time
45
  from data import PatchDataModule, prepare_data, image2tensor, tensor2image
46
  import torch
47
  from tqdm import tqdm
48
- from bigdl.nano.pytorch.trainer import Trainer
49
  from torch.utils.data import DataLoader
50
  from pathlib import Path
51
  from torch.utils.data import Dataset
@@ -83,8 +83,9 @@ dm = PatchDataModule(train_image_dd, patch_size=2**6,
83
  # quantize model
84
  train_loader = dm.train_dataloader()
85
  train_loader_iter = iter(train_loader)
86
- quantized_model = Trainer.quantize(generator, accelerator=None,
87
- calib_dataloader=train_loader)
 
88
 
89
 
90
  def original_transfer(input_img):
 
45
  from data import PatchDataModule, prepare_data, image2tensor, tensor2image
46
  import torch
47
  from tqdm import tqdm
48
+ from bigdl.nano.pytorch import InferenceOptimizer
49
  from torch.utils.data import DataLoader
50
  from pathlib import Path
51
  from torch.utils.data import Dataset
 
83
  # quantize model
84
  train_loader = dm.train_dataloader()
85
  train_loader_iter = iter(train_loader)
86
+ quantized_model = InferenceOptimizer.quantize(generator,
87
+ accelerator=None,
88
+ calib_dataloader=train_loader)
89
 
90
 
91
  def original_transfer(input_img):
requirements.txt CHANGED
@@ -1,5 +1,5 @@
1
  # nano default
2
- bigdl-nano[pytorch]==2.1.0b20220606
3
  setuptools==58.0.4
4
  protobuf==3.20.1
5
 
 
1
  # nano default
2
+ bigdl-nano[pytorch]==2.2.0b20221022
3
  setuptools==58.0.4
4
  protobuf==3.20.1
5