Browse Source

lets make sure this can learn via supervision first

new-sep-loss
Michael Pilosov, PhD 10 months ago
parent
commit
07b4e548e2
  1. 14
      model.py
  2. 8
      newsearch.py

14
model.py

@ -50,16 +50,24 @@ class ColorTransformerModel(L.LightningModule):
outputs, outputs,
) )
# alpha = self.hparams.alpha # TODO: decide what to do with this... # alpha = self.hparams.alpha # TODO: decide what to do with this...
loss = p_loss # loss = p_loss
# distance = torch.minimum(
# torch.norm(outputs - labels), torch.norm(1 + outputs - labels)
# ).mean()
distance = torch.norm(outputs - labels).mean()
loss = distance
self.log("train_loss", distance)
self.log("hp_metric", loss) self.log("hp_metric", loss)
self.log("p_loss", p_loss) self.log("p_loss", p_loss)
return loss return distance
def validation_step(self, batch): def validation_step(self, batch):
inputs, labels = batch # these are true HSV labels - no learning allowed. inputs, labels = batch # these are true HSV labels - no learning allowed.
outputs = self.forward(inputs) outputs = self.forward(inputs)
distance = torch.minimum( distance = torch.minimum(
torch.abs(outputs - labels), torch.abs(1 + outputs - labels) torch.norm(outputs - labels), torch.norm(1 + outputs - labels)
) )
mean_loss = torch.mean(distance) mean_loss = torch.mean(distance)
max_loss = torch.max(distance) max_loss = torch.max(distance)

8
newsearch.py

@ -6,7 +6,7 @@ import numpy as np # noqa: F401
from lightning_sdk import Machine, Studio # noqa: F401 from lightning_sdk import Machine, Studio # noqa: F401
# consistency of randomly sampled experiments. # consistency of randomly sampled experiments.
seed(19920921) seed(202419920921)
NUM_JOBS = 100 NUM_JOBS = 100
@ -23,7 +23,7 @@ NUM_JOBS = 100
# Define the ranges or sets of values for each hyperparameter # Define the ranges or sets of values for each hyperparameter
# alpha_values = list(np.round(np.linspace(2, 4, 21), 4)) # alpha_values = list(np.round(np.linspace(2, 4, 21), 4))
# learning_rate_values = list(np.round(np.logspace(-5, -3, 21), 5)) # learning_rate_values = list(np.round(np.logspace(-5, -3, 21), 5))
learning_rate_values = [1e-2] learning_rate_values = [1e-3]
alpha_values = [0] alpha_values = [0]
widths = [2**k for k in range(4, 13)] widths = [2**k for k in range(4, 13)]
depths = [1, 2, 4, 8, 16] depths = [1, 2, 4, 8, 16]
@ -65,8 +65,8 @@ for idx, params in enumerate(search_params):
python newmain.py fit \ python newmain.py fit \
--seed_everything {s} \ --seed_everything {s} \
--data.batch_size {bs} \ --data.batch_size {bs} \
--data.train_size 0 \ --data.train_size 10000 \
--data.val_size 100000 \ --data.val_size 10000 \
--model.alpha {a} \ --model.alpha {a} \
--model.width {w} \ --model.width {w} \
--model.depth {d} \ --model.depth {d} \

Loading…
Cancel
Save