mirror of
https://github.com/wassname/attentive-neural-processes.git
synced 2026-08-12 11:50:46 +08:00
works2
This commit is contained in:
@@ -7,6 +7,7 @@ events.out.*
|
||||
/logs/
|
||||
.cache/
|
||||
notes.md
|
||||
*.db
|
||||
|
||||
# Created by https://www.gitignore.io/api/code,linux,macos,python,windows,jupyternotebook,jupyternotebooks
|
||||
# Edit at https://www.gitignore.io/?templates=code,linux,macos,python,windows,jupyternotebook,jupyternotebooks
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -129,7 +129,6 @@ class TransformerAutoR_PL(PL_Seq2Seq):
|
||||
"attention_dropout": 0.2,
|
||||
"dropout": 0.2,
|
||||
"hidden_out_size_power": 4,
|
||||
"hidden_size_power": 5,
|
||||
"learning_rate": 2e-3,
|
||||
"nhead_power": 3,
|
||||
"nlayers": 6,
|
||||
@@ -158,7 +157,6 @@ class TransformerAutoR_PL(PL_Seq2Seq):
|
||||
trial.suggest_uniform("dropout", 0, 0.75)
|
||||
# we must have nhead<==hidden_size
|
||||
# so nhead_power.max()<==hidden_size_power.min()
|
||||
trial.suggest_discrete_uniform("hidden_size_power", 4, 10, 1)
|
||||
trial.suggest_discrete_uniform("hidden_out_size_power", 4, 9, 1)
|
||||
trial.suggest_discrete_uniform("nhead_power", 1, 4, 1)
|
||||
trial.suggest_int("nlayers", 1, 12)
|
||||
|
||||
@@ -160,7 +160,6 @@ class TransformerSeq2SeqAutoR_PL(PL_Seq2Seq):
|
||||
"attention_dropout": 0.2,
|
||||
"dropout": 0.2,
|
||||
"hidden_out_size_power": 4,
|
||||
"hidden_size_power": 5,
|
||||
"learning_rate": 2e-3,
|
||||
"nhead_power": 3,
|
||||
"nlayers": 6,
|
||||
@@ -189,7 +188,7 @@ class TransformerSeq2SeqAutoR_PL(PL_Seq2Seq):
|
||||
trial.suggest_uniform("dropout", 0, 0.75)
|
||||
# we must have nhead<==hidden_size
|
||||
# so nhead_power.max()<==hidden_size_power.min()
|
||||
trial.suggest_discrete_uniform("hidden_size_power", 4, 10, 1)
|
||||
# trial.suggest_discrete_uniform("hidden_size_power", 4, 10, 1)
|
||||
trial.suggest_discrete_uniform("hidden_out_size_power", 4, 9, 1)
|
||||
trial.suggest_discrete_uniform("nhead_power", 1, 4, 1)
|
||||
trial.suggest_int("nlayers", 1, 12)
|
||||
|
||||
@@ -39,8 +39,8 @@ def plot_rows(
|
||||
context_y_rows = np.exp(context_y_rows) - eps
|
||||
|
||||
# I don't want to show too much context
|
||||
context_y_rows = context_y_rows[-96:]
|
||||
x_context_rows = x_context_rows[-96:]
|
||||
context_y_rows = context_y_rows[-48*2:]
|
||||
x_context_rows = x_context_rows[-48*2:]
|
||||
|
||||
# Plot everything
|
||||
j = 0
|
||||
|
||||
@@ -44,7 +44,7 @@ def main(
|
||||
checkpoint_callback=checkpoint_callback,
|
||||
max_epochs=hparams["max_nb_epochs"],
|
||||
weights_summary='top',
|
||||
gpus=-1 if (torch.cuda.is_available() and device=="cuda") else None,
|
||||
gpus=-1 if (torch.cuda.is_available() and device!="cpu") else None,
|
||||
early_stop_callback=PyTorchLightningPruningCallback(trial, monitor="val_loss")
|
||||
if prune
|
||||
else EarlyStopping(
|
||||
@@ -74,7 +74,7 @@ def objective(trial, PL_MODEL_CLS, name, user_attrs):
|
||||
checkpoint = checkpoints[-1]
|
||||
device = next(model.parameters()).device
|
||||
logger.info(f"Loading checkpoint {checkpoint}")
|
||||
model = model.load_from_checkpoint(checkpoint).to(device)
|
||||
model = model.load_from_checkpoint(str(checkpoint)).to(device)
|
||||
|
||||
trainer.test(model)
|
||||
|
||||
@@ -156,7 +156,7 @@ def run_trial(
|
||||
checkpoint = checkpoints[-1]
|
||||
device = next(model.parameters()).device
|
||||
logger.info(f"Loading checkpoint {checkpoint}")
|
||||
model = model.load_from_checkpoint(checkpoint).to(device)
|
||||
model = model.load_from_checkpoint(str(checkpoint)).to(device)
|
||||
|
||||
# Plot
|
||||
plot_from_loader(model.val_dataloader(), model, i=670, title='val 670')
|
||||
|
||||
Reference in New Issue
Block a user