File tree Expand file tree Collapse file tree 2 files changed +9
-6
lines changed
examples/pytorch/blendcnn Expand file tree Collapse file tree 2 files changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -196,13 +196,16 @@ def eval_func(model):
196
196
# print(f"Accuracy: {total_accuracy}")
197
197
198
198
if args .tune :
199
- import lpot
199
+ from lpot . experimental import Quantization
200
200
# lpot tune
201
201
model .load_state_dict (torch .load (args .input_model ))
202
202
dataloader = Bert_DataLoader (loader = data_iter , batch_size = args .batch_size )
203
203
204
- quantizer = lpot .Quantization (args .tuned_yaml )
205
- q_model = quantizer (model , q_dataloader = dataloader , eval_func = eval_func )
204
+ quantizer = Quantization (args .tuned_yaml )
205
+ quantizer .calib_dataloader = dataloader
206
+ quantizer .model = model
207
+ quantizer .eval_func = eval_func
208
+ q_model = quantizer ()
206
209
q_model .save (args .tuned_checkpoint )
207
210
208
211
elif args .int8 :
Original file line number Diff line number Diff line change @@ -608,7 +608,7 @@ class TensorflowCOCOMAP(BaseMetric):
608
608
609
609
"""
610
610
def __init__ (self , anno_path = None ):
611
- from lpot . metric .coco_label_map import category_map
611
+ from .coco_label_map import category_map
612
612
if anno_path :
613
613
import os
614
614
import json
@@ -631,7 +631,7 @@ def __init__(self, anno_path=None):
631
631
[cat for cat in self .category_map ]) #index
632
632
633
633
def update (self , predicts , labels , sample_weight = None ):
634
- from lpot . metric .coco_tools import ExportSingleImageGroundtruthToCoco ,\
634
+ from .coco_tools import ExportSingleImageGroundtruthToCoco ,\
635
635
ExportSingleImageDetectionBoxesToCoco
636
636
bbox , str_label ,int_label , image_id = labels
637
637
detection = {}
@@ -690,7 +690,7 @@ def reset(self):
690
690
self .annotation_id = 1
691
691
692
692
def result (self ):
693
- from lpot . metric .coco_tools import COCOWrapper , COCOEvalWrapper
693
+ from .coco_tools import COCOWrapper , COCOEvalWrapper
694
694
if len (self .ground_truth_list ) == 0 :
695
695
logger .warning ("sample num is 0 can't calculate mAP" )
696
696
return 0
You can’t perform that action at this time.
0 commit comments