Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

epochs -> iterations in examples #1472

Merged
merged 1 commit into from
Sep 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/operator/advection_aligned_pideeponet.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def periodic(x):

model = dde.Model(data, net)
model.compile("adam", lr=0.0005)
losshistory, train_state = model.train(epochs=50000)
losshistory, train_state = model.train(iterations=50000)
dde.utils.plot_loss_history(losshistory)

x = np.linspace(0, 1, num=100)
Expand Down
2 changes: 1 addition & 1 deletion examples/operator/advection_aligned_pideeponet_2d.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def periodic(x):

model = dde.Model(data, net)
model.compile("adam", lr=0.0005)
losshistory, train_state = model.train(epochs=30000)
losshistory, train_state = model.train(iterations=30000)
dde.utils.plot_loss_history(losshistory)

x = np.linspace(0, 1, num=100)
Expand Down
2 changes: 1 addition & 1 deletion examples/operator/advection_unaligned_pideeponet.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def periodic(x):

model = dde.Model(data, net)
model.compile("adam", lr=0.0005)
losshistory, train_state = model.train(epochs=50000)
losshistory, train_state = model.train(iterations=50000)
dde.utils.plot_loss_history(losshistory)

x = np.linspace(0, 1, num=100)
Expand Down
2 changes: 1 addition & 1 deletion examples/operator/advection_unaligned_pideeponet_2d.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def periodic(x):

model = dde.Model(data, net)
model.compile("adam", lr=0.0005)
losshistory, train_state = model.train(epochs=10000)
losshistory, train_state = model.train(iterations=10000)
dde.utils.plot_loss_history(losshistory)

x = np.linspace(0, 1, num=100)
Expand Down
2 changes: 1 addition & 1 deletion examples/operator/antiderivative_aligned_pideeponet.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def zero_ic(inputs, outputs):

model = dde.Model(data, net)
model.compile("adam", lr=0.0005)
losshistory, train_state = model.train(epochs=40000)
losshistory, train_state = model.train(iterations=40000)

dde.utils.plot_loss_history(losshistory)

Expand Down
2 changes: 1 addition & 1 deletion examples/operator/antiderivative_unaligned_pideeponet.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def zero_ic(inputs, outputs):

model = dde.Model(data, net)
model.compile("adam", lr=0.0005)
losshistory, train_state = model.train(epochs=40000)
losshistory, train_state = model.train(iterations=40000)

dde.utils.plot_loss_history(losshistory)

Expand Down
2 changes: 1 addition & 1 deletion examples/operator/diff_rec_aligned_pideeponet.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def pde(x, y, v):

model = dde.Model(data, net)
model.compile("adam", lr=0.0005)
losshistory, train_state = model.train(epochs=20000)
losshistory, train_state = model.train(iterations=20000)
dde.utils.plot_loss_history(losshistory)

func_feats = func_space.random(1)
Expand Down
2 changes: 1 addition & 1 deletion examples/operator/diff_rec_unaligned_pideeponet.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def pde(x, y, v):

model = dde.Model(data, net)
model.compile("adam", lr=0.0005)
losshistory, train_state = model.train(epochs=50000)
losshistory, train_state = model.train(iterations=50000)
dde.utils.plot_loss_history(losshistory)

func_feats = func_space.random(1)
Expand Down
2 changes: 1 addition & 1 deletion examples/pinn_forward/Allen_Cahn.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def output_transform(x, y):
model = dde.Model(data, net)

model.compile("adam", lr=1e-3)
model.train(epochs=40000)
model.train(iterations=40000)
model.compile("L-BFGS")
losshistory, train_state = model.train()
dde.saveplot(losshistory, train_state, issave=True, isplot=True)
Expand Down
2 changes: 1 addition & 1 deletion examples/pinn_forward/Beltrami_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ def p_func(x):
model = dde.Model(data, net)

model.compile("adam", lr=1e-3, loss_weights=[1, 1, 1, 1, 100, 100, 100, 100, 100, 100])
model.train(epochs=30000)
model.train(iterations=30000)
model.compile("L-BFGS", loss_weights=[1, 1, 1, 1, 100, 100, 100, 100, 100, 100])
losshistory, train_state = model.train()

Expand Down
2 changes: 1 addition & 1 deletion examples/pinn_forward/Burgers_RAR.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def pde(x, y):
data.add_anchors(X[x_id])
early_stopping = dde.callbacks.EarlyStopping(min_delta=1e-4, patience=2000)
model.compile("adam", lr=1e-3)
model.train(epochs=10000, disregard_previous_best=True, callbacks=[early_stopping])
model.train(iterations=10000, disregard_previous_best=True, callbacks=[early_stopping])
model.compile("L-BFGS")
losshistory, train_state = model.train()
dde.saveplot(losshistory, train_state, issave=True, isplot=True)
Expand Down
4 changes: 2 additions & 2 deletions examples/pinn_forward/Helmholtz_Dirichlet_2d_HPO.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
k0 = 2 * np.pi * n
precision_train = 10
precision_test = 30
epochs = 10000
iterations = 10000


def pde(x, y):
Expand Down Expand Up @@ -89,7 +89,7 @@ def create_model(config):


def train_model(model, config):
losshistory, train_state = model.train(epochs=epochs)
losshistory, train_state = model.train(iterations=iterations)
train = np.array(losshistory.loss_train).sum(axis=1).ravel()
test = np.array(losshistory.loss_test).sum(axis=1).ravel()
metric = np.array(losshistory.metrics_test).sum(axis=1).ravel()
Expand Down
4 changes: 2 additions & 2 deletions examples/pinn_forward/Helmholtz_Sound_hard_ABC_2d.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

# General parameters
weights = 1
epochs = 10000
iterations = 10000
learning_rate = 1e-3
num_dense_layers = 3
num_dense_nodes = 350
Expand Down Expand Up @@ -133,6 +133,6 @@ def func1_outer(x, y):
model.compile(
"adam", lr=learning_rate, loss_weights=loss_weights, metrics=["l2 relative error"]
)
losshistory, train_state = model.train(epochs=epochs)
losshistory, train_state = model.train(iterations=iterations)

dde.saveplot(losshistory, train_state, issave=True, isplot=True)
2 changes: 1 addition & 1 deletion examples/pinn_forward/heat_resample.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def pde(x, y):

# Build and train the model:
model.compile("adam", lr=1e-3)
model.train(epochs=200000, callbacks=[pde_resampler])
model.train(iterations=200000, callbacks=[pde_resampler])
model.compile("L-BFGS")
losshistory, train_state = model.train(callbacks=[pde_resampler])

Expand Down
2 changes: 1 addition & 1 deletion examples/pinn_inverse/Navier_Stokes_inverse.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ def Navier_Stokes_Equation(x, y):
dde.saveplot(loss_history, train_state, issave=True, isplot=True)
model.compile("adam", lr=1e-4, external_trainable_variables=[C1, C2])
loss_history, train_state = model.train(
epochs=10000, callbacks=[variable], display_every=1000, disregard_previous_best=True
iterations=10000, callbacks=[variable], display_every=1000, disregard_previous_best=True
)
dde.saveplot(loss_history, train_state, issave=True, isplot=True)
# model.save(save_path = "./NS_inverse_model/model")
Expand Down
4 changes: 2 additions & 2 deletions examples/pinn_inverse/elliptic_inverse_field_batch.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Backend supported: tensorflow.compat.v1, pytorch, paddle"""
lululxvi marked this conversation as resolved.
Show resolved Hide resolved
"""Backend supported: pytorch, paddle"""
import deepxde as dde
import matplotlib.pyplot as plt
import numpy as np
Expand Down Expand Up @@ -42,7 +42,7 @@ def sol(x):

model = dde.Model(data, net)
model.compile("adam", lr=0.0001, loss_weights=[1, 100, 1000])
losshistory, train_state = model.train(epochs=20000, callbacks=[pde_resampler])
losshistory, train_state = model.train(iterations=20000, callbacks=[pde_resampler])
dde.saveplot(losshistory, train_state, issave=True, isplot=True)

# view results
Expand Down