code: public void saveWithTrainingConfig(File outputFile) throws IOException {
          if(this.trainingConfig == null) {
              throw new IllegalStateException("No training configuration found!");
          }
  
          try(BufferedOutputStream bufferedOutputStream = new BufferedOutputStream(new FileOutputStream(outputFile))) {
              saveWithTrainingConfig(this.trainingConfig, bufferedOutputStream);
              bufferedOutputStream.flush();
          }
  
      }
docs: Save this samediff instance with its training config.
  Note that if a training configuration is not defined,
  an {@link IllegalStateException} is thrown.
  
  @param outputFile the output stream to write to
  @throws IOException