Soumic commited on
Commit
a458b71
·
1 Parent(s): 9e90264

:zap: Add a timer

Browse files
Files changed (1) hide show
  1. app.py +11 -0
app.py CHANGED
@@ -1,5 +1,6 @@
1
  import logging
2
  import os
 
3
  from typing import Any
4
 
5
  from huggingface_hub import PyTorchModelHubMixin
@@ -426,9 +427,19 @@ def start_bert(classifier_model, model_save_path, criterion, WINDOW, batch_size=
426
 
427
 
428
  if __name__ == "__main__":
 
 
429
  dataset_folder_prefix = "inputdata/"
430
  pytorch_model = MQtlDnaBERT6Classifier()
431
  start_bert(classifier_model=pytorch_model, model_save_path=f"weights_{pytorch_model.model_name}.pth",
432
  criterion=ReshapedBCEWithLogitsLoss(), WINDOW=4000, batch_size=12, # max 14 on my laptop...
433
  dataset_folder_prefix=dataset_folder_prefix, max_epochs=1)
 
 
 
 
 
 
 
 
434
  pass
 
1
  import logging
2
  import os
3
+ import time
4
  from typing import Any
5
 
6
  from huggingface_hub import PyTorchModelHubMixin
 
427
 
428
 
429
  if __name__ == "__main__":
430
+ start_time = time.time()
431
+
432
  dataset_folder_prefix = "inputdata/"
433
  pytorch_model = MQtlDnaBERT6Classifier()
434
  start_bert(classifier_model=pytorch_model, model_save_path=f"weights_{pytorch_model.model_name}.pth",
435
  criterion=ReshapedBCEWithLogitsLoss(), WINDOW=4000, batch_size=12, # max 14 on my laptop...
436
  dataset_folder_prefix=dataset_folder_prefix, max_epochs=1)
437
+
438
+ # Record the end time
439
+ end_time = time.time()
440
+ # Calculate the duration
441
+ duration = end_time - start_time
442
+ # Print the runtime
443
+ print(f"Runtime: {duration:.2f} seconds")
444
+
445
  pass