kernel-elastic-autoencoder 3.3.2__tar.gz → 3.3.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.3.2
3
+ Version: 3.3.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.3.2"
3
+ version = "3.3.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" }
@@ -116,7 +116,7 @@ class Model(
116
116
  condition_embeddings,
117
117
  padding_mask[:, : self.config_typed.input.max_len - 1],
118
118
  )
119
- return prediction, prediction_noise, latents_noise
119
+ return prediction, prediction_noise, latents
120
120
 
121
121
  def encode(
122
122
  self,
@@ -94,13 +94,13 @@ class Trainer:
94
94
  dataset_train,
95
95
  batch_size=self.config_typed.common.batch_size,
96
96
  pin_memory=True,
97
- num_workers=4,
97
+ num_workers=0,
98
98
  )
99
99
  dataloader_test = torch.utils.data.DataLoader(
100
100
  dataset_test,
101
101
  batch_size=self.config_typed.common.batch_size,
102
102
  pin_memory=True,
103
- num_workers=4,
103
+ num_workers=0,
104
104
  )
105
105
  curr_epoch = 0
106
106
 
@@ -128,15 +128,15 @@ class Trainer:
128
128
  dataloader_train, desc=f"Epoch {epoch}, Train Batch"
129
129
  ):
130
130
  optimizer.zero_grad()
131
- prediction, prediction_noise, latents_noise = model(
131
+ prediction, prediction_noise, latents = model(
132
132
  input_ids, conditions, token_mask, condition_mask
133
133
  )
134
134
  loss = loss_fn(
135
- prediction, prediction_noise, input_ids[:, 1:], latents_noise
135
+ prediction, prediction_noise, input_ids[:, 1:], latents
136
136
  )
137
137
  accelerator.backward(loss)
138
138
  optimizer.step()
139
- torch.cat([train_loss, loss.detach().unsqueeze(-1)], dim=0)
139
+ train_loss = torch.cat([train_loss, loss.detach().unsqueeze(-1)], dim=0)
140
140
  accelerator.print(f"Avg. train loss: {train_loss.mean().item()}")
141
141
 
142
142
  model.eval()
@@ -145,16 +145,16 @@ class Trainer:
145
145
  dataloader_test, desc=f"Epoch {epoch}, Test Batch"
146
146
  ):
147
147
  with torch.no_grad():
148
- prediction, prediction_noise, latents_noise = model(
148
+ prediction, prediction_noise, latents = model(
149
149
  input_ids,
150
150
  conditions,
151
151
  token_mask,
152
152
  condition_mask,
153
153
  )
154
154
  loss = loss_fn(
155
- prediction, prediction_noise, input_ids[:, 1:], latents_noise
155
+ prediction, prediction_noise, input_ids[:, 1:], latents
156
156
  )
157
- torch.cat([test_loss, loss.detach().unsqueeze(-1)], dim=0)
157
+ test_loss = torch.cat([test_loss, loss.detach().unsqueeze(-1)], dim=0)
158
158
  accelerator.print(f"Avg. test loss: {test_loss.mean().item()}")
159
159
 
160
160
  scheduler.step()