kernel-elastic-autoencoder 3.2.2__tar.gz → 3.2.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: kernel_elastic_autoencoder
3
- Version: 3.2.2
3
+ Version: 3.2.4
4
4
  Summary: Implementation of Kernel-Elastic Autoencoder for Molecular Design (https://doi.org/10.1093/pnasnexus/pgae168)
5
5
  License: MIT
6
6
  Author: Felix Rotter-McCartney
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "kernel_elastic_autoencoder"
3
- version = "3.2.2"
3
+ version = "3.2.4"
4
4
  description = "Implementation of Kernel-Elastic Autoencoder for Molecular Design (https://doi.org/10.1093/pnasnexus/pgae168)"
5
5
  authors = [
6
6
  { name = "Felix Rotter-McCartney", email = "felix.rotter@mail.utoronto.ca" }
@@ -92,10 +92,14 @@ class Trainer:
92
92
  dataloader_train = torch.utils.data.DataLoader(
93
93
  dataset_train,
94
94
  batch_size=self.config_typed.common.batch_size,
95
+ pin_memory=True,
96
+ num_workers=4,
95
97
  )
96
98
  dataloader_test = torch.utils.data.DataLoader(
97
99
  dataset_test,
98
100
  batch_size=self.config_typed.common.batch_size,
101
+ pin_memory=True,
102
+ num_workers=4,
99
103
  )
100
104
  curr_epoch = 0
101
105
 
@@ -115,13 +119,12 @@ class Trainer:
115
119
  accelerator.load_state(checkpoint)
116
120
  curr_epoch = scheduler.scheduler.last_epoch + 1
117
121
 
122
+ accelerator.wait_for_everyone()
118
123
  for epoch in range(curr_epoch, self.config_typed.common.max_epochs):
119
124
  model.train()
120
- if accelerator.is_local_main_process:
121
- batch_bar = tqdm(
122
- total=len(dataloader_train), desc=f"Epoch {epoch}, Train Batch"
123
- )
124
- for input_ids, conditions, token_mask, condition_mask in dataloader_train:
125
+ for input_ids, conditions, token_mask, condition_mask in tqdm(
126
+ dataloader_train, desc=f"Epoch {epoch}, Train Batch"
127
+ ):
125
128
  optimizer.zero_grad()
126
129
  prediction, prediction_noise, latents_noise = model(
127
130
  input_ids, conditions, token_mask, condition_mask
@@ -131,15 +134,9 @@ class Trainer:
131
134
  )
132
135
  accelerator.backward(loss)
133
136
  optimizer.step()
134
- if accelerator.is_local_main_process:
135
- batch_bar.update(1)
136
137
  accelerator.print(f"Train loss: {float(loss.detach())}")
137
138
 
138
139
  model.eval()
139
- if accelerator.is_local_main_process:
140
- batch_bar = tqdm(
141
- total=len(dataloader_train), desc=f"Epoch {epoch}, Test Batch"
142
- )
143
140
  for input_ids, conditions, token_mask, condition_mask in tqdm(
144
141
  dataloader_test, desc=f"Epoch {epoch}, Test Batch"
145
142
  ):
@@ -153,8 +150,6 @@ class Trainer:
153
150
  loss = loss_fn(
154
151
  prediction, prediction_noise, input_ids[:, 1:], latents_noise
155
152
  )
156
- if accelerator.is_local_main_process:
157
- batch_bar.update(1)
158
153
  accelerator.print(f"Test loss: {float(loss.detach())}")
159
154
 
160
155
  scheduler.step()