コード例 #1
0
 def save(self, path):
     path = os.path.expanduser(path)
     os.makedirs(path, exist_ok=True)
     try:
         with open(os.path.join(path, "best_configure.json"), 'w') as f:
             json.dump(self.tune_cfg, f)
         logger.info("save config file of quantized model to path %s" %
                     path)
     except IOError as e:
         logger.error("Unable to save configure file and weights. %s" % e)
コード例 #2
0
ファイル: model.py プロジェクト: vuiseng9/lpot
 def save(self, root=None):
     if not root:
         root = cfg.default_workspace
     root = os.path.abspath(os.path.expanduser(root))
     os.makedirs(root, exist_ok=True)
     try:
         with open(os.path.join(root, "best_configure.json"), 'w') as f:
             json.dump(self.tune_cfg, f)
         logger.info("Save config file of quantized model at %s" % root)
     except IOError as e:
         logger.error("Unable to save configure file and weights. %s" % e)
コード例 #3
0
 def save(self, path):
     path = os.path.expanduser(path)
     os.makedirs(path, exist_ok=True)
     try:
         with open(os.path.join(path, "best_configure.yaml"), 'w') as f:
             yaml.dump(self.tune_cfg, f, default_flow_style=False)
         torch.save(self._model.state_dict(),
                    os.path.join(path, "best_model_weights.pt"))
         logger.info(
             "save config file and weights of quantized model to path %s" %
             path)
     except IOError as e:
         logger.error("Unable to save configure file and weights. %s" % e)
コード例 #4
0
ファイル: model.py プロジェクト: vuiseng9/lpot
 def save(self, root=None):
     if not root:
         root = cfg.default_workspace
     root = os.path.abspath(os.path.expanduser(root))
     os.makedirs(root, exist_ok=True)
     try:
         with open(os.path.join(root, "best_configure.yaml"), 'w') as f:
             yaml.dump(self.tune_cfg, f, default_flow_style=False)
         torch.save(self._model.state_dict(),
                    os.path.join(root, "best_model_weights.pt"))
         logger.info(
             "Save config file and weights of quantized model at %s" % root)
     except IOError as e:
         logger.error("Unable to save configure file and weights. %s" % e)