This commit is contained in:
Andras Schmelczer 2024-06-25 09:05:26 +01:00
commit 16ba45546b
No known key found for this signature in database
GPG key ID: FC8F2C3D3D1A718C
2 changed files with 120 additions and 506 deletions

View file

@ -21,7 +21,7 @@ def random_hparam_search(
timeout_hours: int,
device: torch.device,
) -> None:
for _ in range(1):
for _ in count():
current_hyperparameters = {
k: v.rvs() if hasattr(v, "rvs") else choice(v)
for k, v in choice(hyperparameters).items()

View file

@ -64,7 +64,7 @@ def train(
optimizer.zero_grad()
predicted_original = model(edited_histogram.to(device))
loss = loss_function(
torch.log(torch.clamp(predicted_original, EPSILON, 1)),
torch.log(predicted_original + EPSILON),
original_histogram.to(device),
)
@ -101,7 +101,7 @@ def train(
):
predicted_original = model(edited_histogram.to(device))
epoch_test_loss += loss_function(
torch.log(torch.clamp(predicted_original, EPSILON, 1)),
torch.log(predicted_original + EPSILON),
original_histogram.to(device),
).item()
writer.add_hparams(