              shutil.rmtree(model_dir + "_bk")
          shutil.move(model_dir,  model_dir + "_bk")
          os.mkdir(model_dir)
          if self.gpus > 1:
              self.netGA_sm.save_weights(str(self.model_dir / netGAH5))
              self.netGB_sm.save_weights(str(self.model_dir / netGBH5))
          else:
              self.netGA.save_weights(str(self.model_dir / netGAH5))
              self.netGB.save_weights(str(self.model_dir / netGBH5))
          self.netDA.save_weights(str(self.model_dir / netDAH5))
          self.netDB.save_weights(str(self.model_dir / netDBH5))
 
</s> remove         if os.path.isdir(model_dir + "_bk"):
            shutil.rmtree(model_dir + "_bk")
        shutil.move(model_dir,  model_dir + "_bk")
        os.mkdir(model_dir)
 </s> add         for model in hdf.values():
            backup_file(model_dir, model)
 </s> remove         if os.path.isdir(model_dir + "_bk"):
            shutil.rmtree(model_dir + "_bk")
        shutil.move(model_dir,  model_dir + "_bk")
        os.mkdir(model_dir)
        self.encoder.save_weights(str(self.model_dir / encoderH5))
        self.decoder_A.save_weights(str(self.model_dir / decoder_AH5))
        self.decoder_B.save_weights(str(self.model_dir / decoder_BH5))
 </s> add         for model in hdf.values():
            backup_file(model_dir, model)
        self.encoder.save_weights(str(self.model_dir / hdf['encoderH5']))
        self.decoder_A.save_weights(str(self.model_dir / hdf['decoder_AH5']))
        self.decoder_B.save_weights(str(self.model_dir / hdf['decoder_BH5'])) </s> remove             netGA.load_weights(str(self.model_dir / netGAH5))
            netGB.load_weights(str(self.model_dir / netGBH5))
 </s> add             netGA.load_weights(str(self.model_dir / hdf['netGAH5']))
            netGB.load_weights(str(self.model_dir / hdf['netGBH5']))
 </s> remove                 if os.path.isfile(str(self.model_dir / encoderH5)) is not True:
                    os.rename(str(self.model_dir / old_decoder_AH5), str(self.model_dir / decoder_AH5))
                    os.rename(str(self.model_dir / old_decoder_BH5), str(self.model_dir / decoder_BH5))
                    os.rename(str(self.model_dir / old_encoderH5), str(self.model_dir / encoderH5))
 </s> add                 if os.path.isfile(str(self.model_dir / hdf['encoderH5'])) is not True:
                    os.rename(str(self.model_dir / old_decoder_AH5), str(self.model_dir / hdf['decoder_AH5']))
                    os.rename(str(self.model_dir / old_decoder_BH5), str(self.model_dir / hdf['decoder_BH5']))
                    os.rename(str(self.model_dir / old_encoderH5), str(self.model_dir / hdf['encoderH5'])) </s> remove             self.encoder.load_weights(str(self.model_dir / encoderH5))
            self.decoder.load_weights(str(self.model_dir / decoderH5))
            self.inter_both.load_weights(str(self.model_dir / inter_bothH5))
 </s> add             self.encoder.load_weights(str(self.model_dir / hdf['encoderH5']))
            self.decoder.load_weights(str(self.model_dir / hdf['decoderH5']))
            self.inter_both.load_weights(str(self.model_dir / hdf['inter_bothH5']))
            self.netGA_sm.save_weights(str(self.model_dir / hdf['netGAH5']))
            self.netGB_sm.save_weights(str(self.model_dir / hdf['netGBH5']))

              shutil.rmtree(model_dir + "_bk")
          shutil.move(model_dir,  model_dir + "_bk")
          os.mkdir(model_dir)
          if self.gpus > 1:
            self.netGA_sm.save_weights(str(self.model_dir / hdf['netGAH5']))
            self.netGB_sm.save_weights(str(self.model_dir / hdf['netGBH5']))
            self.netGA_sm.save_weights(str(self.model_dir / hdf['netGAH5']))
            self.netGB_sm.save_weights(str(self.model_dir / hdf['netGBH5']))
          else:
              self.netGA.save_weights(str(self.model_dir / netGAH5))
              self.netGB.save_weights(str(self.model_dir / netGBH5))
          self.netDA.save_weights(str(self.model_dir / netDAH5))
          self.netDB.save_weights(str(self.model_dir / netDBH5))
keep keep keep keep replace replace keep keep keep keep keep
 Model backup bugfix (#371)

* model backup bugfix - original model

* Model backup bugfix - remaining models 
plugins/Model_GAN/Model.py