code: public static int determineKerasMajorVersion(Map<String, Object> modelConfig, KerasModelConfiguration config)
              throws InvalidKerasConfigurationException {
          int kerasMajorVersion;
          if (!modelConfig.containsKey(config.getFieldKerasVersion())) {
              log.warn("Could not read keras version used (no "
                      + config.getFieldKerasVersion() + " field found) \n"
                      + "assuming keras version is 1.0.7 or earlier."
              );
              kerasMajorVersion = 1;
          } else {
              String kerasVersionString = (String) modelConfig.get(config.getFieldKerasVersion());
              if (Character.isDigit(kerasVersionString.charAt(0))) {
                  kerasMajorVersion = Character.getNumericValue(kerasVersionString.charAt(0));
              } else {
                  throw new InvalidKerasConfigurationException(
                          "Keras version was not readable (" + config.getFieldKerasVersion() + " provided)"
                  );
              }
          }
          return kerasMajorVersion;
      }
docs: Determine Keras major version
  
  @param modelConfig parsed model configuration for keras model
  @param config      basic model configuration (KerasModelConfiguration)
  @return Major Keras version (1 or 2)
  @throws InvalidKerasConfigurationException Invalid Keras config