Soumic commited on
Commit
09cc1f0
·
1 Parent(s): 08f515b

:lady_beetle: App crashed cz it failed to load the entire dataset at a time

Browse files
Files changed (2) hide show
  1. .gitignore +3 -1
  2. app.py +11 -8
.gitignore CHANGED
@@ -1,3 +1,5 @@
1
  lightning_logs/
2
  *.pth
3
- my-awesome-model/
 
 
 
1
  lightning_logs/
2
  *.pth
3
+ my-awesome-model/
4
+ my-awesome-model-200/
5
+ my-awesome-model-4000/
app.py CHANGED
@@ -376,16 +376,19 @@ def start(classifier_model, model_save_path, is_attention_model=False, m_optimiz
376
  if is_binned:
377
  file_suffix = "_binned"
378
 
379
- dataset_map = load_dataset("fahimfarhan/mqtl-classification-dataset-binned-200")
380
 
381
- train_dataset = MQTLDataset(dataset_map["train"], check_if_pipeline_is_ok_by_inserting_debug_motif=is_debug)
382
- val_dataset = MQTLDataset(dataset_map["validate"], check_if_pipeline_is_ok_by_inserting_debug_motif=is_debug)
383
- test_dataset = MQTLDataset(dataset_map["test"], check_if_pipeline_is_ok_by_inserting_debug_motif=is_debug)
384
 
385
  data_module = MqtlDataModule(train_ds=train_dataset, val_ds=val_dataset, test_ds=test_dataset)
386
 
387
  classifier_model = classifier_model #.to(DEVICE)
388
- classifier_model = classifier_model.from_pretrained("my-awesome-model")
 
 
 
389
 
390
  classifier_module = MQtlClassifierLightningModule(classifier=classifier_model, regularization=2,
391
  m_optimizer=m_optimizer)
@@ -403,13 +406,13 @@ def start(classifier_model, model_save_path, is_attention_model=False, m_optimiz
403
  torch.save(classifier_module.state_dict(), model_save_path)
404
 
405
  # save locally
406
- classifier_model.save_pretrained("my-awesome-model")
407
 
408
  # push to the hub
409
  classifier_model.push_to_hub(repo_id="fahimfarhan/mqtl-classifier-model", commit_message=":tada: Push model using huggingface_hub")
410
 
411
  # reload
412
- model = classifier_model.from_pretrained("my-awesome-model")
413
  # repo_url = "https://huggingface.co/fahimfarhan/mqtl-classifier-model"
414
  #
415
  # push_to_hub(
@@ -426,7 +429,7 @@ def start(classifier_model, model_save_path, is_attention_model=False, m_optimiz
426
 
427
 
428
  if __name__ == '__main__':
429
- WINDOW = 200
430
  simple_cnn = Cnn1dClassifier(seq_len=WINDOW)
431
  simple_cnn.enable_logging = True
432
 
 
376
  if is_binned:
377
  file_suffix = "_binned"
378
 
379
+ dataset_map = load_dataset("fahimfarhan/mqtl-classification-datasets")
380
 
381
+ train_dataset = MQTLDataset(dataset_map[f"train_binned_{WINDOW}"], check_if_pipeline_is_ok_by_inserting_debug_motif=is_debug)
382
+ val_dataset = MQTLDataset(dataset_map[f"validate_binned_{WINDOW}"], check_if_pipeline_is_ok_by_inserting_debug_motif=is_debug)
383
+ test_dataset = MQTLDataset(dataset_map[f"test_binned_{WINDOW}"], check_if_pipeline_is_ok_by_inserting_debug_motif=is_debug)
384
 
385
  data_module = MqtlDataModule(train_ds=train_dataset, val_ds=val_dataset, test_ds=test_dataset)
386
 
387
  classifier_model = classifier_model #.to(DEVICE)
388
+ try:
389
+ classifier_model = classifier_model.from_pretrained(f"my-awesome-model-{WINDOW}")
390
+ except Exception as x:
391
+ print(x)
392
 
393
  classifier_module = MQtlClassifierLightningModule(classifier=classifier_model, regularization=2,
394
  m_optimizer=m_optimizer)
 
406
  torch.save(classifier_module.state_dict(), model_save_path)
407
 
408
  # save locally
409
+ classifier_model.save_pretrained(f"my-awesome-model-{WINDOW}")
410
 
411
  # push to the hub
412
  classifier_model.push_to_hub(repo_id="fahimfarhan/mqtl-classifier-model", commit_message=":tada: Push model using huggingface_hub")
413
 
414
  # reload
415
+ model = classifier_model.from_pretrained(f"my-awesome-model-{WINDOW}")
416
  # repo_url = "https://huggingface.co/fahimfarhan/mqtl-classifier-model"
417
  #
418
  # push_to_hub(
 
429
 
430
 
431
  if __name__ == '__main__':
432
+ WINDOW = 4000
433
  simple_cnn = Cnn1dClassifier(seq_len=WINDOW)
434
  simple_cnn.enable_logging = True
435