diff --git a/video_prediction_savp/HPC_scripts/train_movingmnist.sh b/video_prediction_savp/HPC_scripts/train_movingmnist.sh
index 85959e52d148f2120c77e5543a79147d50427838..36dcf93ddcac99beaf393d5a9542e51fe463d501 100755
--- a/video_prediction_savp/HPC_scripts/train_movingmnist.sh
+++ b/video_prediction_savp/HPC_scripts/train_movingmnist.sh
@@ -38,7 +38,8 @@ destination_dir=/p/project/deepacf/deeprain/video_prediction_shared_folder/model
 
 # for choosing the model, convLSTM,savp, mcnet,vae
 model=convLSTM
-model_hparams=../hparams/era5/${model}/model_hparams.json
+dataset=moving_mnist
+model_hparams=../hparams/${dataset}/${model}/model_hparams.json
 
 # rund training
-srun python ../scripts/train_dummy_moving_mnist.py --input_dir  ${source_dir}/tfrecords/ --dataset moving_mnist  --model ${model} --model_hparams_dict ${model_hparams} --output_dir ${destination_dir}/${model}/ 
+srun python ../scripts/train_moving_mnist.py --input_dir  ${source_dir}/tfrecords/ --dataset moving_mnist  --model ${model} --model_hparams_dict ${model_hparams} --output_dir ${destination_dir}/${model}_bing_20200902/ 
diff --git a/video_prediction_savp/hparams/era5/convLSTM/model_hparams.json b/video_prediction_savp/hparams/era5/convLSTM/model_hparams.json
index c2edaad9f9ac158f6e7b8d94bb81db16d55d05e8..d4942bea2ab5d6af424844b74d3769ccf699502f 100644
--- a/video_prediction_savp/hparams/era5/convLSTM/model_hparams.json
+++ b/video_prediction_savp/hparams/era5/convLSTM/model_hparams.json
@@ -4,7 +4,8 @@
     "lr": 0.001,
     "max_epochs":2,
     "context_frames":10,
-    "sequence_length":20
+    "sequence_length":20,
+    "loss_fun":"rmse"
 
 }
 
diff --git a/video_prediction_savp/hparams/moving_mnist/convLSTM/model_hparams.json b/video_prediction_savp/hparams/moving_mnist/convLSTM/model_hparams.json
new file mode 100644
index 0000000000000000000000000000000000000000..b07caa0f35f54c1d5007e9fbc6802fe24f1adac0
--- /dev/null
+++ b/video_prediction_savp/hparams/moving_mnist/convLSTM/model_hparams.json
@@ -0,0 +1,12 @@
+
+{
+    "batch_size": 10,
+    "lr": 0.001,
+    "max_epochs":2,
+    "context_frames":10,
+    "sequence_length":20,
+    "loss_fun":"cross_entropy"
+}
+
+
+
diff --git a/video_prediction_savp/video_prediction/models/vanilla_convLSTM_model.py b/video_prediction_savp/video_prediction/models/vanilla_convLSTM_model.py
index 01a4f7ce5d6430f19a1e4b99c4cba956b3f7682b..d3b3d4817faa10e6f5db5257fdf4cd526e6d01c7 100644
--- a/video_prediction_savp/video_prediction/models/vanilla_convLSTM_model.py
+++ b/video_prediction_savp/video_prediction/models/vanilla_convLSTM_model.py
@@ -28,6 +28,8 @@ class VanillaConvLstmVideoPredictionModel(BaseVideoPredictionModel):
         self.sequence_length = self.hparams.sequence_length
         self.predict_frames = self.sequence_length - self.context_frames
         self.max_epochs = self.hparams.max_epochs
+        self.loss_fun = self.hparams.loss_fun
+
     def get_default_hparams_dict(self):
         """
         The keys of this dict define valid hyperparameters for instances of
@@ -40,20 +42,16 @@ class VanillaConvLstmVideoPredictionModel(BaseVideoPredictionModel):
             batch_size: batch size for training.
             lr: learning rate. if decay steps is non-zero, this is the
                 learning rate for steps <= decay_step.
-            max_steps: number of training steps.
-            context_frames: the number of ground-truth frames to pass :qin at
-                start. Must be specified during instantiation.
-            sequence_length: the number of frames in the video sequence,
-                including the context frames, so this model predicts
-                `sequence_length - context_frames` future frames. Must be
-                specified during instantiation.
-        """
+            max_epochs: number of training epochs, each epoch equal to sample_size/batch_size
+            loss_fun: string can be either "rmse" or "cross_entropy", loss function has to be set from the user 
+         """
         default_hparams = super(VanillaConvLstmVideoPredictionModel, self).get_default_hparams_dict()
         print ("default hparams",default_hparams)
         hparams = dict(
             batch_size=16,
             lr=0.001,
             max_epochs=3000,
+            loss_fun = None
         )
 
         return dict(itertools.chain(default_hparams.items(), hparams.items()))
@@ -71,9 +69,18 @@ class VanillaConvLstmVideoPredictionModel(BaseVideoPredictionModel):
         #    tf.square(self.x[:, :self.context_frames, :, :, 0] - self.x_hat_context_frames[:, :, :, :, 0]))
         # This is the loss function (RMSE):
         #This is loss function only for 1 channel (temperature RMSE)
-        self.total_loss = tf.reduce_mean(
-            tf.square(self.x[:, self.context_frames:,:,:,0] - self.x_hat_predict_frames[:,:,:,:,0]))
-            
+        if self.loss_fun == "rmse":
+            self.total_loss = tf.reduce_mean(
+                tf.square(self.x[:, self.context_frames:,:,:,0] - self.x_hat_predict_frames[:,:,:,:,0]))
+        elif self.loss_fun == "cross_entropy":
+            x_flatten = tf.reshape(self.x[:, self.context_frames:,:,:,0],[-1])
+            x_hat_predict_frames_flatten = tf.reshape(self.x_hat_predict_frames[:,:,:,:,0],[-1])
+            bce = tf.keras.losses.BinaryCrossentropy()
+            self.total_loss = bce(x_flatten,x_hat_predict_frames_flatten)  
+        else:
+            raise ValueError("Loss function is not selected properly, you should chose either 'rmse' or 'cross_entropy'")
+
+        
         #This is the loss for only all the channels(temperature, geo500, pressure)
         #self.total_loss = tf.reduce_mean(
         #    tf.square(self.x[:, self.context_frames:,:,:,:] - self.x_hat_predict_frames[:,:,:,:,:]))