Skip to content
This repository was archived by the owner on Nov 16, 2019. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions caffe-grid/src/main/scala/com/yahoo/ml/caffe/CaffeOnSpark.scala
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ object CaffeOnSpark {
//training if specified
val caffeSpark = new CaffeOnSpark(sc)
if (conf.isTraining ){
if (conf.solverParameter.hasTestInterval && (conf.solverParameter.getTestIter(0) != 0)) {
if (conf.solverParameter.hasTestInterval && (conf.solverParameter.getTestInterval() != 0) && (conf.solverParameter.getTestIter(0) != 0)) {
val sourceTrain: DataSource[Any,Any] = DataSource.getSource(conf, true).asInstanceOf[DataSource[Any, Any]]
val sourceValidation: DataSource[Any,Any] = DataSource.getSource(conf, false).asInstanceOf[DataSource[Any, Any]]
caffeSpark.trainWithValidation(sourceTrain, sourceValidation)
Expand Down Expand Up @@ -179,7 +179,7 @@ class CaffeOnSpark(@transient val sc: SparkContext) extends Serializable {
var trainDataRDD: RDD[T1] = source.makeRDD(sc)
if (trainDataRDD == null) {
log.info("No training data is given")
return
throw new IllegalStateException("No training data is given")
}

setupTraining(Array(source))
Expand Down Expand Up @@ -255,13 +255,13 @@ class CaffeOnSpark(@transient val sc: SparkContext) extends Serializable {
var trainDataRDD: RDD[T1] = sourceTrain.makeRDD(sc)
if (trainDataRDD == null) {
log.info("No training data given")
return null
throw new IllegalStateException("No training data given")
}

var validationDataRDD: RDD[T1] = sourceValidation.makeRDD(sc)
if (validationDataRDD == null) {
log.info("No validation data given")
return null
throw new IllegalStateException("No validation data given")
}

val conf = sourceTrain.conf
Expand All @@ -273,7 +273,7 @@ class CaffeOnSpark(@transient val sc: SparkContext) extends Serializable {
log.info("no_of_records_required_per_partition_train: " + no_of_records_required_per_partition_train)
if (total_records_train < no_of_records_required_per_partition_train * conf.clusterSize) {
log.error("Train data is insufficient for the hyperparameters configured. Adjust the train hyperparameters or increase the training data!")
return null
throw new IllegalStateException("Train data is insufficient for the hyperparameters configured. Adjust the train hyperparameters or increase the training data!")
}

val no_of_records_required_per_partition_validation = conf.solverParameter.getTestIter(0) * sourceValidation.batchSize()
Expand All @@ -282,7 +282,7 @@ class CaffeOnSpark(@transient val sc: SparkContext) extends Serializable {
log.info("no_of_records_required_per_partition_validation: " + no_of_records_required_per_partition_validation)
if (total_records_validation < no_of_records_required_per_partition_validation * conf.clusterSize) {
log.error("Validation data is insufficient for the hyperparameters configured. Adjust the validation hyperparameters or increase the validation data!")
return null
throw new IllegalStateException("Validation data is insufficient for the hyperparameters configured. Adjust the validation hyperparameters or increase the validation data!")
}

val validationOutputBlobNames = setupTraining(Array(sourceTrain, sourceValidation))
Expand Down